reorder sequences in fasta file based on ids from different file
1
0
Entering edit mode
6.6 years ago
Mehmet ▴ 820

Dear all,

I searched for solution but I could not find any. My question is how to reorder sequences in fasta file based on ids from different file. For instance,

I have a fasta file, but I want to reorder sequences based on new order of sequences.

in fasta file

1 2 3 4 and in ids file:

223 3000 433 201

I want to reorder sequences in fasta file based on ids file order.

New fasta file should be in this order:

223 3000 433 201

sequence gene genome • 4.5k views
ADD COMMENT
1
Entering edit mode
6.6 years ago
h.mon 35k

You can do this easily with samtools and process substitution:

samtools faidx sequences.fasta

samtools faidx sequences.fasta $(cat order.txt) > sequences.reordered.fasta
ADD COMMENT

Login before adding your answer.

Traffic: 1973 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6