How To Merge Fasta Header With Description Using Perl :
1
0
Entering edit mode
12.7 years ago

I have a fasta file that contains sequences like so :

>PT_TAC_1
ATGCATGCATGC

>PT_TAC_2
ATGCATCGATCG

Following BLASTx, i obtained blast results in tabular format. The Sequence ID is in one column and the corresponding description is in the other, like so :

ID          Description
PT_TAC_1   Some_unique_description

How do i merge the description so as to result in a fasta file containing :

>PT_TAC_1_some_unique_description
ATGCATGCATGC
perl blast fasta • 2.7k views
ADD COMMENT
1
Entering edit mode

had a look at BioPerl? It's much more safe to parse Blast output with it than using using your home-brewed scripts.

ADD REPLY
0
Entering edit mode

I think that this question would be more succesfull on http://stackoverflow.com/, as it is directly linked to programming.

ADD REPLY
0
Entering edit mode

As I keep saying...please preview questions as you type them, to help with correct formatting. This is especially important with FASTA format because the ">" does not display in the question unless formatted properly (with 4 leading spaces). Thanks.

ADD REPLY
1
Entering edit mode
12.7 years ago
toni ★ 2.2k

You could first parse your blastx results and build a hash where the keys are your fasta IDs (PT_TAC_1 for instance) and values your unique_description.

Then open the fasta file, read it line by line and modify headers on the fly with the help of the hash built above, while writing to a new file.

ADD COMMENT

Login before adding your answer.

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