[Biojava-dev] Some problems with createDNASequence
William Stott
w.p.q.stott.s04 at cranfield.ac.uk
Thu Nov 18 02:11:28 EST 2004
Hi,
I'm just evaluating BioJava and seem to have encountered a problem:
Sequence dna = DNATools.createDNASequence("atgctgB", "dna_1");
I expected an exception to be thrown (see attached Unit Test) as B is not a valid character for a DNA sequence (atgc), but it wasn't.
Do you publish the JUnit Tests for BioJava? Where can they be obtained? Is there a more formal mechanism for submitting defect reports?
Regards
Will
P.S. I sent this message before, but it got bounced due to a suspicious header
createDNASequence
public static Sequence createDNASequence(java.lang.String dna,
java.lang.String name)
throws IllegalSymbolException
Return a new DNA Sequence for dna.
Parameters:
dna - a String to parse into DNA
name - a String to use as the name
Returns:
a Sequence created form dna
Throws:
IllegalSymbolException - if dna contains any non-DNA characters
-------------- next part --------------
package BioJavaTests;
/**
* PACKAGE_NAME
* User: Bills Date: 17-Nov-2004 Time: 19:06:01
* Copyright 2004 Will Stott
*/
import junit.framework.TestCase;
import junit.framework.Assert;
import org.biojava.bio.seq.Sequence;
import org.biojava.bio.seq.DNATools;
import org.biojava.bio.symbol.IllegalSymbolException;
public class ToolsCheck extends TestCase
{
public void testCreateGoodDNASequence() throws Exception
{
Sequence dna = DNATools.createDNASequence("atgct", "dna_1");
Assert.assertEquals("atgct", dna.seqString());
}
public void testCreateBadDNASequence() throws Exception
{
try
{
Sequence dna = DNATools.createDNASequence("aBtgctg", "dna_1");
throw new Exception("this should not be thrown");
}
catch(IllegalSymbolException e)
{
Assert.assertEquals("This tokenization doesn't contain character: 'B'", e.getMessage());
}
}
public ToolsCheck(String test)
{
super(test);
}
protected void setUp() throws Exception
{
}
protected void tearDown() throws Exception
{
}
}
More information about the biojava-dev
mailing list