[Bioperl-l] perl one-liner with Bio::SeqIO

Stefan Kirov stefan.kirov at bms.com
Thu Jul 22 14:30:06 UTC 2010


 From what I see in /bioperl-live/Bio/Tools/GuessSeqFormat.pm

     if (defined $self->{-file}) {
         # Close the file we opened.
         close($fh);
     } elsif (ref $fh eq 'GLOB') {
         # Try seeking to the start position.
 >>>        seek($fh, $start_pos, 0);
     } elsif (defined $fh && $fh->can('setpos')) {
         # Seek to the start position.
         $fh->setpos($start_pos);
     }
     return ($done ? $fmt_string : undef);

   seek($fh, $start_pos, 0); does not reset as expected- tell $fh after 
reset is where the second non-null line starts.
I am not sure why- all manuals claim this should work?
Hope this helps.
Stefan

On 7/22/2010 9:27 AM, Chris Fields wrote:
> cat test.fa | perl -MBio::SeqIO -e 'my $seq=Bio::SeqIO->new(-fh
> >>>  =>\*STDIN); while ($myseq=$seq->next_seq){ print
> >>>  $myseq->id,"\t",$myseq->seq,"\n"}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stefan_kirov.vcf
Type: text/x-vcard
Size: 207 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20100722/59d55415/attachment-0004.vcf>


More information about the Bioperl-l mailing list