Assalam o alaikum everyone,
I am working with multiple genes and in each gene folder i have multiple FASTA (70-75) files and each FASTA file contains single gene sequence. e.g.
AMY2b_Gene_folder
Chimpanzee_AMY2B_CDS.fasta
Human_AMY2B_CDS.fasta
Pygmy_chimpanzee_AMY2B_CDS.fasta
Western_gorrila_AMY2B_CDS.fasta
cat Chimpanzee_AMY2B_CDS.fasta
>lcl|NM_020978.4_cds_NP_066188.1_1 [gene=AMY2B] [protein=alpha-amylase 2B precursor] [protein_id=NP_066188.1] [location=673..2208]
ATGAAGTTCTTTCTGTTGCTTTTCACCATTGGGTTCTGCTGGGCTCAGTATTCCCCAAATACACAACAAG
GACGGACATCTATTGTTCATCTGTTTGAATGGCGATGGGTTGATATTGCTCTTGAATGTGAGCGATATTT
AGCTCCCAAGGGATTTGGAGGGGTTCAGGTCTCTCCACCAAATGAAAATGTTGCAATTCACAACCCTTTC
Human_AMY2B_CDS.fasta
>lcl|NM_020978.4_cds_NP_066188.1_1 [gene=AMY2B] [protein=alpha-amylase 2B precursor] [protein_id=NP_066188.1] [location=673..2208]
> ATGAAGTTCTTTCTGTTGCTTTTCACCATTGGGTTCTGCTGGGCTCAGTATTCCCCAAATACACAACAAG
> GACGGACATCTATTGTTCATCTGTTTGAATGGCGATGGGTTGATATTGCTCTTGAATGTGAGCGATATTT
> AGCTCCCAAGGGATTTGGAGGGGTTCAGGTCTCTCCACCAAATGAAAATGTTGCAATTCACAACCCTTTC
I want to change headers of each fasta file according to a specific order given in text file.
cat Headers.txt
MP.C_AMY2B
FP.H_AMY2B
The output should be look like
>MP.C_AMY2B
ATGAAGTTCTTTCTGTTGCTTTTCACCATTGGGTTCTGCTGGGCTCAGTATTCCCCAAATACACAACAAG GACGGACATCTATTGTTCATCTGTTTGAATGGCGATGGGTTGATATTGCTCTTGAATGTGAGCGATATTT AGCTCCCAAGGGATTTGGAGGGGTTCAGGTCTCTCCACCAAATGAAAATGTTGCAATTCACAACCCTTTC
I have tried perl script given in following biostar posts but these scripts did not worked for multiple FASTA files which have single gene sequence.
Renaming Entries In A Fasta File
Renaming fasta headers according to a matching name list
Kindly guide me is there any command-line solution to do so????
Without the mapping rule of names in Headers.txt and the FASTA files, we can't rename them rightly.