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
• 1,320 views
•
link
2 answers
- linearize
- use
pasteto get two sequences on the same line. eg. : A: how to write two fastq files into one - use
cutto select columns you want - use
trto restore the final fasta.
• 0 views
•
link
parallel --xapply echo ::: $(sed 'n;d' file2.fa) ::: $(sed '1d; n; d' file1.fa) | tr ' ' '\n'
• 0 views
•
link
Log in to answer this question.
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?