in reply to writing to arrays
The other (better?) way is the very nice Bioperl modules that have methods that specifically handle multifasta flat files. Also check out EMBOSS, a sequence analysis suite that interfaces with BioPerl...EMBOSS + BioPerl makes life sooo much easier... From the bioperl tutorial...open( FASTAFILE, $ARGV[0] ); while (<FASTAFILE>) { if ( /^>/ && $seqflag == 1 ) { push ( @sequences, $fasta ); $fasta = ""; $fasta = $_; } elsif (/^>/) { $fasta = $_; $seqflag = 1; } else { $fasta .= $_; } } push ( @sequences, $fasta ); #then iterate @sequences to run over BLAST
Hope this helps,# script 1: create the index use Bio::Index::Fasta; # using fasta file format $Index_File_Name = shift; $inx = Bio::Index::Fasta->new( -filename => $Index_File_Name, -write_flag => 1); $inx->make_index(@ARGV); # script 2: retrieve some files use Bio::Index::Fasta; $Index_File_Name = shift; $inx = Bio::Index::Fasta->new($Index_File_Name); foreach $id (@ARGV) { $seq = $inx->fetch($id); # Returns Bio::Seq object # do something with the sequence }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: writing to arrays
by Anonymous Monk on Dec 26, 2002 at 17:20 UTC |