[Biojava-dev] [Bug 2467] New: BioJava : IOTools.writeFasta() : Infinite Exception loop

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Mar 6 23:16:49 UTC 2008


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

           Summary: BioJava : IOTools.writeFasta() : Infinite Exception loop
           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: benjamin.pavie at gmail.com


Opening a non correct fasta file and then write it as Fasta give an infinite
Exception loop.
Here is an example :

public class GeneralReader {
  public static void main(String[] args) {
      try {
        Class.forName("org.biojavax.bio.seq.io.FastaFormat");
      }
      catch (ClassNotFoundException e) {
        e.printStackTrace();
      }
      try
      {
        RichSequenceIterator iter = IOTools.readFile(new File (args[0]), ns);   
        IOTools.writeFasta(System.out, iter, ns);
      }
      catch (FileNotFoundException ex)
      {
        ex.printStackTrace();
      }
      catch (IOException ex)
      {
        ex.printStackTrace();
      }
    }
  }
}

When we give as arg[0] a file containing :

>
MAIDVDRTLAVLRRKLEALGYSDPLEPASLQLVQKLVEDLVHTTDSYTAVKQQCAKQAQEIAAFDTRLESVRQDSVRLQS
ENSQLHVLVMQHAERHEREAREHYTAVKRLEDTIAELSYWKHAAAEKLASADKENAGLRKRCEELAKLTDRLASGAATPQ

the operation 
RichSequenceIterator iter = IOTools.readFile(new File (args[0]), ns);
works well, but 
IOTools.writeFasta(System.out, iter, ns);
give a infinity loop of exception :

org.biojava.bio.BioException: Could not read sequence
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:113)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextSequence(RichStreamReader.java:92)
        at
org.biojavax.bio.seq.io.RichStreamWriter.writeStream(RichStreamWriter.java:66)
        at
org.biojavax.bio.seq.RichSequence$IOTools.writeFasta(RichSequence.java:1279)
        at GeneralReader.main(GeneralReader.java:12)
Caused by: java.io.IOException: Stream does not appear to contain FASTA
formatted data: >
        at
org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:189)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
        ... 4 more
org.biojava.bio.BioException: Could not read sequence
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:113)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextSequence(RichStreamReader.java:92)
        at
org.biojavax.bio.seq.io.RichStreamWriter.writeStream(RichStreamWriter.java:66)
        at
org.biojavax.bio.seq.RichSequence$IOTools.writeFasta(RichSequence.java:1279)
        at GeneralReader.main(GeneralReader.java:12)
Caused by: java.io.IOException: Stream does not appear to contain FASTA
formatted data:
MAIDVDRTLAVLRRKLEALGYSDPLEPASLQLVQKLVEDLVHTTDSYTAVKQQCAKQAQEIAAFDTRLESVRQDSVRLQSENSQLHVLVMQHAERHEREAREHYTAVKRLEDTIAELSYWKHAAAEKLASADKENAGLRKRCEELAKLTDRLASGAATPQ
        at
org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:182)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
        ... 4 more
org.biojava.bio.BioException: Could not read sequence
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:113)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextSequence(RichStreamReader.java:92)
        at
org.biojavax.bio.seq.io.RichStreamWriter.writeStream(RichStreamWriter.java:66)
        at
org.biojavax.bio.seq.RichSequence$IOTools.writeFasta(RichSequence.java:1279)
        at GeneralReader.main(GeneralReader.java:12)
Caused by: java.io.IOException: Premature stream end
        at
org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:173)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
        ... 4 more
etc ...


-- 
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