Extract out fasta sequences using sequence headers.
I usually extract out fasta sequences using samtools:
i.e to extract the sequences for gene 000001
samtools faidx /path/to/transcriptome 000001
However, I was wondering whether there was a better method for extracting isoform sequences. I have tried the following command, but to no avail, to extract the sequences for gene isoforms 000001.1, 000001.2, 000001.3:
samtools faidx /path/to/transcriptome 000001.*
Does anyone have any tips on how to do this effectively?
• 2,024 views
•
link
1 answer
You can do this with Awk :
awk '/'000001.*'/{flag=1;print $0;next}/^>/{flag=0}flag' file.fasta >> outfile.fasta
• 0 views
•
link
Log in to answer this question.
BBMap's filterbyname tool will work like this: