[Bioperl-l] seqIO

Shawn Hoon shawnh at stanford.edu
Tue Oct 7 21:46:41 EDT 2003


> Hi Lincoln,
>
> Thanks but what am I to do after this?
>
> I have a file that contains EMBL sequences. And I'm reading it into an 
> array, manipulating it and then print it a file in fasta format.
>
> I know how to use the:
>
> my $seq_in = Bio::SeqIO->new('-file' => filename1, '-format' => 
> 'embl');
> my $seq_out = Bio::SeqIO->new('-file' => filename2, '-format' => 
> 'fasta');
>
> while ( my $inseq = $seq_in->next_seq ) {
>   $seq_out->write_seq($inseq);
> }
>
> But I don't have a file for filename1 but an array. Is there a way for 
> reading the array (the manipulated embl one) and then write it as a 
> fasta file?
>

Uhm I don't get it. Once you have read the sequences into memory (i.e. 
into the array) you have Seq objects which SeqIO objects
can take regardless of the source format, embl/genbank etc so you can 
pass it to SeqIO in a loop like so:

my $seq_in = Bio::SeqIO->new('-file' => filename1, '-format' => 'embl');
my @array;

while ( my $inseq = $seq_in->next_seq ) {
  push @array, $inseq;
}

#do some manipulation here...


my $sout = Bio::SeqIO->new(-file=>">output.fa",-format=>'fasta');
foreach my $s(@array){
	$sout->write_seq($s);
}






> Thanks.
>
> -----Original Message-----
> From: Lincoln Stein [mailto:lstein at cshl.edu]
> Sent: Wednesday, October 08, 2003 7:18 AM
> To: Desmond Lim; Hilmar Lapp; BioPerl
> Subject: Re: [Bioperl-l] seqIO
>
>
> If you have an array of sequences then you can just create them using
> Bio::Seq:
>
> 	@bioperl_sequences = map {Bio::Seq->new(-seq=>$_)} @raw_seq;
>
> Lincoln
>
>
> On Tuesday 07 October 2003 12:45 am, Desmond Lim wrote:
>>> What made you think it would accept a -ph parameter? Besides, if
>>> there was
>>> one you'd have to provide an array reference.
>>
>> I didn't think it would work but I wanted to try it out.
>>
>> What I'm trying to do is get SeqIO to accept an array of sequences 
>> and not
>> a file.
>>
>> Desmond
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
> -- 
> Lincoln Stein
> lstein at cshl.edu
> Cold Spring Harbor Laboratory
> 1 Bungtown Road
> Cold Spring Harbor, NY 11724
> (516) 367-8380 (voice)
> (516) 367-8389 (fax)
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
-shawn



More information about the Bioperl-l mailing list