Aloha!
I have a fasta file that looks like the following:
>FFSA34B_100_M7_ID10014
ATCTAACAATGTTGCTCATGCAGGCCCTGCAGTAGATTTAACCATTCTATCCCTTCACCTAGCAGGTGTATCCTCCTTAATAGGAGCCATCAATTTTACAACTACTATTGCTAACAGACGTTTAGAAGGTATACCTACAGAAAAAATACCCTTATTTATT
>ART01B_100_M7_ID10021
TGTCTTCTAATATTTCCCATGGAGGGGCCTCTGTTGATATGGCTACTTTTTCTCTCCACCTGGCTGGTGTGTCCTCTATTTTGGGTGCTATCAATTTTATAACTACTATTATTAATATGCGGAGTAATTCCTTGTCTTTTGTGCGGGTTCCTTTGTTTGT
>PHR01B_100_M7_ID100236
TAAGAGGAAATGTAGCCCATAGTGGACCTGCAGTAGATTTAGGAATTTTTTCTTTACATTTAGCTGGGGTTTCTTCTATTTTAGGGGCTATTAACTTTATTACTACAATTATTAGTATACGGGAGAATATGGGGATAGAAAAAGTTACTTTATTTAGTTG
I have a text file that looks like the following:
FFSA34B_100_M7_ID10014 2
ART01B_100_M7_ID10021 454
PHR01B_100_M7_ID100236 43
And I would like to append the second column of the text file to the matching fasta header to produce the following output:
>FFSA34B_100_M7_ID10014_2
ATCTAACAATGTTGCTCATGCAGGCCCTGCAGTAGATTTAACCATTCTATCCCTTCACCTAGCAGGTGTATCCTCCTTAATAGGAGCCATCAATTTTACAACTACTATTGCTAACAGACGTTTAGAAGGTATACCTACAGAAAAAATACCCTTATTTATT
>ART01B_100_M7_ID10021_454
TGTCTTCTAATATTTCCCATGGAGGGGCCTCTGTTGATATGGCTACTTTTTCTCTCCACCTGGCTGGTGTGTCCTCTATTTTGGGTGCTATCAATTTTATAACTACTATTATTAATATGCGGAGTAATTCCTTGTCTTTTGTGCGGGTTCCTTTGTTTGT
>PHR01B_100_M7_ID100236_43
TAAGAGGAAATGTAGCCCATAGTGGACCTGCAGTAGATTTAGGAATTTTTTCTTTACATTTAGCTGGGGTTTCTTCTATTTTAGGGGCTATTAACTTTATTACTACAATTATTAGTATACGGGAGAATATGGGGATAGAAAAAGTTACTTTATTTAGTTG
The fasta headers and the text file in the real example will not be in the same order so the command will have to match the fasta header to the first column of the text file and then append the second column value to the fasta header. Anyone know of a why to easily do this?
Thanks in advance!
please, validate your previous questions: C: Inserting a string after placing the last underscore in a header if a fasta file ; Removing everything after the last underscore in the header of a fastafile