[Bioperl-l] PrimarySeq object question

Sam Al-Droubi saldroubi at yahoo.com
Thu Dec 8 14:51:09 EST 2005

 I am fairly new to bioperl as well.  But I have written a program that reads fasta format files. 
 I gave my program an empty file and it worked.  The difference I see is that you are reading a different format.  I am wondering if you found a bug.  Did you try a differnt format, like fasta?
 If you did find a bug may be you can call "ls" from Perl and check the file size before you try to open it.  I am assuming you are running this on UNIX/Linux.
 Snippet of my code is below
     $seqio_obj = Bio::SeqIO->new(-file => $fname,-format => "fasta" );
         while ($seq_obj = $seqio_obj->next_seq){

kevin.mcmahon at ttuhsc.edu wrote: Everyone,
I'm new to this, so please bear with me.
I'm having some trouble with a scf to fasta converting program I'm writing.
  my $in  = Bio::SeqIO->new(-file => $infile , '-format' => 'scf', -alphabet
=> 'dna');
    my $seq = $in->next_seq();
    print "My sequence is:  " . $seq->seq() . "\n";
Above is the code in discussion.  The $in object contains information from a
file ($infile) in scf format.  
Here's my problem.  When we get to $in->next_seq(), if the file is empty,
the program dies and returns:
"MSG: If you want me to create a PrimarySeq object for your empty sequence
 you must specify a -alphabet to satisfy the constructor
requirements for a Bio::PrimarySeq object with no sequence.  Read the POD
for it, luke."
I guess what I need to know is: if this $in->next_seq() doesn't work, how
can I test for this before I get this reply.
Thanks in advance,
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org

Sam Al-Droubi, M.S.
saldroubi at yahoo.com

More information about the Bioperl-l mailing list