[Biojava-dev] [BUG] Infinite regress when calling DNATools.createDNASequence with a DNA string containing a '~' char

Carl Mäsak cmasak at gmail.com
Wed Aug 26 13:29:24 UTC 2009


Hello,

Two things:

1. The BioJava wiki links to a Bugzilla instance, saying bugs should
be posted there ([1]). As I write this, that Bugzilla instance gives a
500 Internal Server Error ([2]).

[1] <http://biojava.org/wiki/BioJava:MailingLists#Bug_Reports>
[2] <http://bugzilla.open-bio.org/enter_bug.cgi?product=BioJava>

2. In the face of this, I hope you don't mind I leave my bug report
here for the time being. We're wrapping BioJava in the Bioclipse
project. We've found what appears to be a logical bug causing an
infinite regress and a stack overflow.

Let's call DNATools.createDNASequence("~", ""). The following code in
that method (org/biojava/bio/seq/DNATools.java:188) will be executed.

  public static Sequence createDNASequence(String dna, String name)
  throws IllegalSymbolException {
    //should I be calling createGappedDNASequence?
    if(dna.indexOf('-') != -1 || dna.indexOf('~') != -1){//there is a gap
        return createGappedDNASequence(dna, name);
    }

The following code in createGappedDNASequence (DNATools.java:207) will
be executed:

    /** Get a new dna as a GappedSequence */
    public static GappedSequence createGappedDNASequence(String dna,
String name) throws IllegalSymbolException{
        String dna1 = dna.replaceAll("-", "");
        Sequence dnaSeq = createDNASequence(dna1, name);

The infinite regress is caused by these two methods calling each
other, for ever. There is no bottoming-out, because none of these
lines removes '~' characters.

We experience this problem in Biojava 1.6, but the above code and line
numbers are from 1.7, where the issue remains.

Regards,
// Carl Mäsak




More information about the biojava-dev mailing list