Please let me know how the coding can be done for extracting each sequence in separate files, from a single file (.txt or .fa) containing those multiple sequences in Fasta format.
Now, please let me elaborate this:
Suppose I have a file MultiFasta.txt which containes these three sequences in Fasta format:
Now I want these sequences should be extracted in separate files (eithe text format or fasta format). Please let me know what should be the code for the same. I was trying but, all in vein.
One becomes good at something only by trying repeatedly and reducing failure at each step. Saying "I'm not good at XYZ" is no good if said skill is crucial to one's profession or passion.
Also, you could always use a different programming language. And when people give you suggestions that they know will help beginners, it is in your benefit to accept and try the suggestion.
This awk command will produce one fasta file for each sequence stored in your file. The name of the output files will be the header of each fasta record stored in your multifasta file. I don't know if you are familiar with awk but just in case:
/^>/ ---> if line starts with > (header line of fasta record).
f=substr($1,2) ---> Remove the > of header and save the string in f variable (this variable will be the output filename)
s=f".fasta" ---> Output file will be the content of variable $f (header) concatenated with the extension ".fasta"
print > s ---> save the fasta record to $s variable (output file).
There are about 100 questions dealing with something similar like this. See: similar posts. Does any of those help you?
For using BioPerl see the SeqIO documentation: http://www.bioperl.org/wiki/HOWTO:SeqIO
What specifically have you tried?
As a side note, in contrast to the code presented in the tutorial, your program should always start like this
If you get any error message from such a script, you may post it here, otherwise not ;) (because that means you already know what you are doing)
I am not an expert in Perl. I have Goggle'd for the codes. A number of codes are available, but I did not find where it is stumbling.
Thanks for the help.
One becomes good at something only by trying repeatedly and reducing failure at each step. Saying "I'm not good at XYZ" is no good if said skill is crucial to one's profession or passion.
Also, you could always use a different programming language. And when people give you suggestions that they know will help beginners, it is in your benefit to accept and try the suggestion.