Question: extract sequences based on ids file
0
gravatar for Mehmet
12 weeks ago by
Mehmet230
Japan
Mehmet230 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 • 209 views
ADD COMMENTlink modified 12 weeks ago by Alex Reynolds22k • written 12 weeks ago by Mehmet230
1
gravatar for Alex Reynolds
12 weeks ago by
Alex Reynolds22k
Seattle, WA USA
Alex Reynolds22k 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 12 weeks ago • written 12 weeks ago by Alex Reynolds22k

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

ADD REPLYlink written 12 weeks ago by Mehmet230
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: 1340 users visited in the last hour