Extract sequence ids from otu map based on representative sequence id
1
0
Entering edit mode
7.6 years ago
c.older • 0

I have an otu map that I would like to extract sequences id corresponding to specific representative sequence ids. For just one representative sequence id I can do

grep "representativesequenceid" otu_map.txt > output.txt

But I would like to do this for a list of ~100 sequence ids, rather than do this 100 times :) Any ideas?

sequence next-gen • 2.1k views
ADD COMMENT
0
Entering edit mode
7.6 years ago
grep -f ids_file otu_map.txt > output.txt

ids_file contains list of your representative sequence ids with one id per line.

grep usage:

$ grep --help | grep '\-f' 
  -f, --file=FILE           obtain PATTERN from FILE
ADD COMMENT
0
Entering edit mode

Tried it but just got a blank text file. Any idea what I might've done wrong?

ADD REPLY
0
Entering edit mode

did you copy and paste your representative sequence ids into the ids_file ?

ADD REPLY
0
Entering edit mode

Yes, it is a tab-delimited file with one representative sequence id per line.

ADD REPLY
0
Entering edit mode

Please show several rows

ADD REPLY
0
Entering edit mode
New.CleanUp.ReferenceOTU236161
New.CleanUp.ReferenceOTU307379
New.CleanUp.ReferenceOTU403578
New.CleanUp.ReferenceOTU40971
New.CleanUp.ReferenceOTU128105
138304
New.CleanUp.ReferenceOTU19208
New.CleanUp.ReferenceOTU176865
ADD REPLY
1
Entering edit mode

It should be the \r in your IDs file. Did you create that file in Windows?

Run

dos2unix ids_file

And then

grep -f ids_file otu_map.txt > output.txt

This should work.

ADD REPLY
0
Entering edit mode

It worked, thank you!

ADD REPLY

Login before adding your answer.

Traffic: 2328 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