This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how can I retrieve FASTA sequence using ID in another text file?

Dear BIostar community

I have around 50,000 sequence identifier in a text file and around 1Million sequences in a large fasta file.

I want to get the sequence of these 50,000 from the fasta file.

I checked the questions and answers already in the community pages. But most of them are using perl,linux,python.

How can it be done in R(fasomerecord/grep/something else)?

Any suggestion?

Thanks

fasta

You want this done with grep, but not in linux?

I just want to know it this is possible in R?

2 answers

If you really want to do this in R, you could use the seqinr package. You end up loading the fasta file into memory, subsetting the results according to the names() accessor, and then writing the results of that to a file. Presumably you could alternatively pass only the names you want to write.fasta().

From google , may be is : a-little-book-of-r-for-bioinformatics.readthedocs.org/en/latest/src/chapter1.html

Log in to answer this question.