This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to swap the headers between fasta files ?

Dear All, I have two files file1.fasta file2.fasta. Both contain same sequences but different headers. I want to swap the headers of file 2 to file 1.

file1.fasta

>name1
atcgtatcta
>name2
ttttacgtcgcgc

file2.fasta

>otu1_name1
atcgtatcta
>otu2_name2
ttttacgtcgcgc

Thanks in advance. Regards, Dinesh S L

sequence sequencing next-gen

You can as well keep the 2nd file it self. Only headers are different between two files and if you copy headers from file 2, first file would be copy of second one. Am I missing something here?

2 answers

parallel --xapply echo ::: $(sed 'n;d' file2.fa) ::: $(sed '1d; n; d' file1.fa) | tr ' ' '\n'

Log in to answer this question.