Question: (Closed) how to sort fasta format DNA sequences based on a given sequence name list
0
gravatar for Yongjie Zhang
20 months ago by
UC Berkeley, USA/ Shanxi Univ, China
Yongjie Zhang80 wrote:

Hello,

I have a fasta file with many DNA sequences. I want to sort these sequence based on a designated order in a sequence name list file. How to acheive this?

Thanks.

Yongjie

sort fasta sequences • 987 views
ADD COMMENTlink modified 20 months ago by natallah10 • written 20 months ago by Yongjie Zhang80

Biopython or python, create a dictionary and then sort the keys as you wish :) .

ADD REPLYlink written 20 months ago by Buffo1.7k

Hello Yongjie Zhang!

Questions similar to yours can already be found at:

We have closed your question to allow us to keep similar content in the same thread.

If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.

Cheers!

PS: Thanks for the pointer, natallah

ADD REPLYlink modified 20 months ago • written 20 months ago by RamRS24k
1
gravatar for natallah
20 months ago by
natallah10
USA/West Lafayette/Purdue University
natallah10 wrote:

Hi! I believe that this was answered before: Sort Sequences In A Fasta File According To The Sequence List In Another Fasta/Txt File

ADD COMMENTlink written 20 months ago by natallah10
0
gravatar for Joe
20 months ago by
Joe14k
United Kingdom
Joe14k wrote:

If you first linearise your fasta sequences (search this forum for many, many ways to do this), then the following should work:

while read line ; do grep -A 1 "$line" sequences.fasta >> sorted_sequences.fasta ; done < indexfile.txt

(Not tested)

ADD COMMENTlink modified 20 months ago • written 20 months ago by Joe14k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1219 users visited in the last hour