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.
Linearize your fasta file using code here
Then use the solutions in: Split Fasta file and rename output files with contig names
with awk and flattened fasta:
This only works for the first line of sequences.