How to split fasta file by ID, making sure to keep two entrys in each file
Hi, I have a fasta file which looks like:
>reference
AGCT
>entry1
AGCT
>entry2
AGCT
I want to split the fasta file by ID, but also include the reference in each file.
So far I am using seqkit split --by-id file.fasta and then cat reference.fasta file1.fasta > results.fasta
However this is quite slow, is there a way of doing this in one command?
• 1,168 views
•
link
1 answer
If you have already split your files then it is just a question of looping through the list, you can loop in bash or more elegantly with parallel:
ls -1 *.fa | parallel 'cat reference.fa {}.fa > {}.merged.fasta'
• 0 views
•
link
Log in to answer this question.