Question: Extract out fasta sequences using sequence headers.
1
gravatar for a.rex
2.0 years ago by
a.rex190
a.rex190 wrote:

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?

gene • 717 views
ADD COMMENTlink modified 2.0 years ago by Jake Warner690 • written 2.0 years ago by a.rex190
1

BBMap's filterbyname tool will work like this:

filterbyname.sh in=transcriptome.fa out=filtered.fa include names=000001. substring=name
ADD REPLYlink written 2.0 years ago by Brian Bushnell16k
1
gravatar for Jake Warner
2.0 years ago by
Jake Warner690
Jake Warner690 wrote:

You can do this with Awk :

awk '/'000001.*'/{flag=1;print $0;next}/^>/{flag=0}flag' file.fasta >> outfile.fasta
ADD COMMENTlink written 2.0 years ago by Jake Warner690
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: 1521 users visited in the last hour