Categories
Linux Mastering Development

sort fasta file based on its alphanumeric ids

Ipunensis_00386 Yfr1
GCGGAGACGAAAGTTTCCGTTCACTCCTCACACCACACTCCGCCCAAATCATTGATTTGG
GCGGTT
Ipunensis_00401 tRNA-Gly(gcc)
GCGGGTATAGCTCAGTGGTAGAGCGTCACCTTGCCAAGGTGAATGTCGCGCGTTCGAATC
GCGTTACCCGCT
Ipunensis_00001 transposase IS4 family protein
ATGCAGAAGTTTCAGGGCATCCACTGGGTCAACCTAGACGGGCAGCACCAGGTTAGCAAT
CTCAGTGATGAGCGACGCTTAATCATCCACCTCTTGGGGCCACCTGTTGAGCGCTACTAC
CATGCCCCTGGTTAA
Ipunensis_00002 Photosystem I assembly protein Ycf3
ATGCGTCACCCCGCCAAGTTACTCGGGTTAGTCACTCTCACCAGTATGCTTACGCTGGCT
Ipunensis_00003 Cell wall-associated protease
ATGAAACGTTTTCTGACCAGTCTTTTGCTGACGGGCCTGCTTTGGCATAGTGGGGGCAGC
GTTGGGGTTGGGAGAGGTGCGATCGCACAAACCCAGTCCACCCCAGACCTCTACTACACC
Ipunensis_00004 Photosystem I assembly protein Ycf3
TTGACCTGCGGCCCGCAGCCCTACCTGCCCAACCTGACTCCAGAAATTCCCATGATCTAC
CGCCTCTCGTCTCCCGGATTTTTGCTGGCGCTGCTGCTGCTATCTGCCGTCGATCCGGCA
Ipunensis_00226 tRNA-Leu(gag)
TGCGGATGTGGTGGAACTGGTAGACACGCACGTTTGAGGGGCGTGTGGCTTACGCCTTGC
GAGTTCGAGTCTCGCCATCCGCAT
Ipunensis_00045 tRNA-Ala(cgc)
GGGGAATTAGCTCAGCTGGTAGAGCGCTGCGATCGCACCGCAGAGGTCAGGAGTTCGAAT
CTCCTATTCTCCA
Ipunensis_00357 glnA
ATCGTTCATCTCTTCAAACTGTCAAAGCTACTTACAAAAGCTACAGACGCACCAAGAGAC
GGAAGTAGGGGTCTGATCCCCCCGAAGGAACGCGCC
Ipunensis_00403 tRNA-Gly(gcc)
GCGGGTATAGCTCAGTGGTAGAGCGTCACCTTGCCAAGGTGAATGTCGCGCGTTCGAATC

How can I sort the above fasta file based on its ids?

Desired output:

Ipunensis_00001 transposase IS4 family protein
ATGCAGAAGTTTCAGGGCATCCACTGGGTCAACCTAGACGGGCAGCACCAGGTTAGCAAT
CTCAGTGATGAGCGACGCTTAATCATCCACCTCTTGGGGCCACCTGTTGAGCGCTACTAC
CATGCCCCTGGTTAA
Ipunensis_00002 Photosystem I assembly protein Ycf3
ATGCGTCACCCCGCCAAGTTACTCGGGTTAGTCACTCTCACCAGTATGCTTACGCTGGCT
Ipunensis_00003 Cell wall-associated protease
ATGAAACGTTTTCTGACCAGTCTTTTGCTGACGGGCCTGCTTTGGCATAGTGGGGGCAGC
GTTGGGGTTGGGAGAGGTGCGATCGCACAAACCCAGTCCACCCCAGACCTCTACTACACC
Ipunensis_00004 Photosystem I assembly protein Ycf3
TTGACCTGCGGCCCGCAGCCCTACCTGCCCAACCTGACTCCAGAAATTCCCATGATCTAC
CGCCTCTCGTCTCCCGGATTTTTGCTGGCGCTGCTGCTGCTATCTGCCGTCGATCCGGCA
Ipunensis_00226 tRNA-Leu(gag)
TGCGGATGTGGTGGAACTGGTAGACACGCACGTTTGAGGGGCGTGTGGCTTACGCCTTGC
GAGTTCGAGTCTCGCCATCCGCAT
Ipunensis_00357 glnA
ATCGTTCATCTCTTCAAACTGTCAAAGCTACTTACAAAAGCTACAGACGCACCAAGAGAC
GGAAGTAGGGGTCTGATCCCCCCGAAGGAACGCGCC
Ipunensis_00403 tRNA-Gly(gcc)
GCGGGTATAGCTCAGTGGTAGAGCGTCACCTTGCCAAGGTGAATGTCGCGCGTTCGAATC
Ipunensis_00386 Yfr1
GCGGAGACGAAAGTTTCCGTTCACTCCTCACACCACACTCCGCCCAAATCATTGATTTGG
GCGGTT
Ipunensis_00401 tRNA-Gly(gcc)
GCGGGTATAGCTCAGTGGTAGAGCGTCACCTTGCCAAGGTGAATGTCGCGCGTTCGAATC
GCGTTACCCGCT

Leave a Reply

Your email address will not be published. Required fields are marked *