How To Merge Fasta Header With Description Using Perl :
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
• 3,222 views
•
link
1 answer
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.
• 0 views
•
link
Log in to answer this question.
had a look at BioPerl? It's much more safe to parse Blast output with it than using using your home-brewed scripts.
I think that this question would be more succesfull on http://stackoverflow.com/, as it is directly linked to programming.
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.