This is a test version of Biostars. For the public version, visit https://www.biostars.org.
splitting fasta sequences into variables

Hi everyone

I am really new to perl and I wish if some one could ever help

I have a multi fasta file, I need to split each fasta sequence into different variable to I can do some types of analysis, any one could help me with any idea (please, not BioPerl)

I am thinking of Creating a regex but it became more complicated each minute

Thanks everyone

perl multi-fasta

"into different variable " what do you mean ? a variable from any language ?

I had to read it twice myself, but it says "Perl" the second line

1 answer

Here you can find a simple Fasta Parser in Perl.
https://github.com/BioInf-Wuerzburg-teaching/teaching-Fasta-Parser/blob/master/Fasta-Parser.pl

This is a neat one-liner, in case you want to split a FASTA file in individual sequences

csplit -z FILE.fa '/>/' '{*}'

With Mac OS X the equivalent is

split -p ">" file.fa

Output is xaa, xab, xac, etc. -a suffixLength is useful for bigger files

Log in to answer this question.