I have a multi-fasta file namely genome.fasta as follows

genome.fasta
>LI5896452.1 Liverpool 2 kg/dp/Kng
ATGCTAG
>1582.LC madi kg 5/58/8
GATGAT

I need to split the genome.fasta file into single fasta file and file name should be the corresponding first word of the fasta header. The expected output as follows,

LI5896452.1.fasta
>LI5896452.1 Liverpool 2 kg/dp/Kng
ATGCTAG

1582.LC.fasta
>1582.LC madi kg 5/58/8
GATGAT

I found many script available online but all are splitting the file and naming each by its own, I could not find any script which keeps header as file name. Please help me to do the same.



Source link