I have python a list that looks like the following:
['T20221019A_E3.B Allele Freq',
'T20221019A_E3.Log R Ratio',
'T20221019A_E3.Gtype',
'Father_FM.B Allele Freq',
'Father_FM.Log R Ratio',
'Father_FM.Gtype',
'Mother_FS.B Allele Freq',
'Mother_FS.Log R Ratio',
'Mother_FS.Gtype']
First I would like to order this list based on what it is left of the dot '.' marker with the following order: Mother
, Father
and T20221019A_E3
. This would be my first-level sort.
Then I would like to sort the string right of the dot '.' with the following order: Gtype
, B Allele Freq
and Log R Ratio
such that my re-ordered list look like so:
['Mother_FS.Gtype',
'Mother_FS.B Allele Freq',
'Mother_FS.Log R Ratio',
'Father_FM.Gtype',
'Father_FM.B Allele Freq',
'Father_FM.Log R Ratio',
'T20221019A_E3.Gtype',
'T20221019A_E3.B Allele Freq',
'T20221019A_E3.Log R Ratio',]
What would be the cleanest way of achieving this?