Added test for determining the fraction of a sequence that's taken up by the most frequent base (quick-and-dirty homopolymer testing).
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@780 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
d61a5261c1
commit
bdf772f017
|
|
@ -0,0 +1,25 @@
|
|||
package org.broadinstitute.sting.utils;
|
||||
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.junit.Test;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class BaseUtilsTest extends BaseTest {
|
||||
@BeforeClass
|
||||
public static void init() { }
|
||||
|
||||
@Test
|
||||
public void testMostFrequentBaseFraction() {
|
||||
logger.warn("Executing testMostFrequentBaseFraction");
|
||||
|
||||
compareFrequentBaseFractionToExpected("AAAAA", 1.0);
|
||||
compareFrequentBaseFractionToExpected("ACCG", 0.5);
|
||||
compareFrequentBaseFractionToExpected("ACCCCTTTTG", 4.0/10.0);
|
||||
}
|
||||
|
||||
private void compareFrequentBaseFractionToExpected(String sequence, double expected) {
|
||||
double fraction = BaseUtils.mostFrequentBaseFraction(sequence.getBytes());
|
||||
Assert.assertTrue(MathUtils.compareDoubles(fraction, expected) == 0);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue