Question: extract sequences based on ids file
0
gravatar for Mehmet
26 days ago by
Mehmet170
Japan
Mehmet170 wrote:

Dear all,

I have a ids list that has random order of ids and a fasta file that has the ids. I want to extract sequence of each id from the fasta file.

I tried but each time output has different order rather than the order in the ids file.

How to extract sequences based on the order in the ids file?

sequence genome gene • 138 views
ADD COMMENTlink modified 26 days ago by Alex Reynolds21k • written 26 days ago by Mehmet170
1
gravatar for Alex Reynolds
26 days ago by
Alex Reynolds21k
Seattle, WA USA
Alex Reynolds21k wrote:

Via bash shell and awk:

$ while read -r line; do awk -v pattern=$line -v RS=">" '$0 ~ pattern { printf(">%s", $0); }' sequences.fa; done < patterns.txt
ADD COMMENTlink modified 26 days ago • written 26 days ago by Alex Reynolds21k

Thank you very much. It was what I really wanted.

ADD REPLYlink written 26 days ago by Mehmet170
Please log in to add an answer.

Help
Access

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