[Biojava-dev] [Bug 2540] New: RichSequenceIterator does not skip sequence when exception is thrown

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Jul 10 10:27:55 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2540

           Summary: RichSequenceIterator does not skip sequence when
                    exception is thrown
           Product: BioJava
           Version: 1.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: seq.io
        AssignedTo: biojava-dev at biojava.org
        ReportedBy: martin.jones at ed.ac.uk


I have a file containing GenBank records, and I want to process them thus:

RichSequenceIterator seqs = RichSequence.IOTools.readGenbankDNA(myReader,
null);
while (seqs.hasNext()) {
     RichSequence seq = seqs.nextRichSequence();
     // processing code
}

however, some records cannot be parsed by biojava... this is to be expected as
I'm processing half a million records - some are bound to be wonky.  So I use a
try-catch to skip over troublesome records:


RichSequenceIterator seqs = RichSequence.IOTools.readGenbankDNA(myReader,
null);
while (seqs.hasNext()) {
     try{
         RichSequence seq = seqs.nextRichSequence();
         // processing code
     } catch (BioException e){
          System.out.println("record count not be parsed!");
     }
}
However, it seems that the position in the input file is not changed if an
exception is thrown during parsing.  If I run the above code on a file
containing a single un-parseable record, it gets stuck in a non-terminating
loop - i.e. each time seqs.nextRichSequence() is called, an exception is
thrown, but seqs.hasNext() still returns true.  

This may be true for other parsers.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the biojava-dev mailing list