I am working with a large FASTA file that is subdivided into "Scaffolds", similar to this sample:
>Scaffold1
AAGTCCTGACTNNNNNNNNNNNNCGTACGTATCGATCG
>Scaffold2
ACGTAGCTAATCGAGATCGATCNNNNNNNNNNNNNCGATTACGTACGATGTG
>Scaffold3
ACGTATCGTACGTGTANNNNNNNNNNNNCGTACGATGCTACTCACGGATTACAAA
I was wondering if there was a way in R to split the one large FASTA file into smaller FASTA files each containing one Scaffold. Thank you!
Any particular reason you want to do this in R? You should always try and use the right tool for the job; in this case something like csplit, perhaps? Certainly not R.