Clear the ReadCovariates keysCache before runs of individual Unit Tests
- normal runs have a constant covariate count, so this is not necessary
This commit is contained in:
parent
07a1d55209
commit
ec16439387
|
|
@ -78,6 +78,14 @@ public class ReadCovariates {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The keys cache is only valid for a single covariate count. Normally this will remain constant for the analysis.
|
||||||
|
* If running multiple analyses (or the unit test suite), it's necessary to clear the cache.
|
||||||
|
*/
|
||||||
|
public static void clearKeysCache() {
|
||||||
|
keysCache.remove();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our keys, indexed by event type x read length x covariate
|
* Our keys, indexed by event type x read length x covariate
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import org.broadinstitute.sting.utils.recalibration.ReadCovariates;
|
||||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
|
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
@ -62,6 +63,11 @@ import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class ReadRecalibrationInfoUnitTest extends BaseTest {
|
public final class ReadRecalibrationInfoUnitTest extends BaseTest {
|
||||||
|
@BeforeMethod
|
||||||
|
public void init() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
@DataProvider(name = "InfoProvider")
|
@DataProvider(name = "InfoProvider")
|
||||||
public Object[][] createCombineTablesProvider() {
|
public Object[][] createCombineTablesProvider() {
|
||||||
List<Object[]> tests = new ArrayList<Object[]>();
|
List<Object[]> tests = new ArrayList<Object[]>();
|
||||||
|
|
@ -74,7 +80,6 @@ public final class ReadRecalibrationInfoUnitTest extends BaseTest {
|
||||||
|
|
||||||
return tests.toArray(new Object[][]{});
|
return tests.toArray(new Object[][]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "InfoProvider")
|
@Test(dataProvider = "InfoProvider")
|
||||||
public void testReadInfo(final int readLength, final boolean includeIndelErrors) {
|
public void testReadInfo(final int readLength, final boolean includeIndelErrors) {
|
||||||
final ReadCovariates covariates = new ReadCovariates(readLength, 2);
|
final ReadCovariates covariates = new ReadCovariates(readLength, 2);
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +71,11 @@ public class ContextCovariateUnitTest {
|
||||||
RAC = new RecalibrationArgumentCollection();
|
RAC = new RecalibrationArgumentCollection();
|
||||||
covariate = new ContextCovariate();
|
covariate = new ContextCovariate();
|
||||||
covariate.initialize(RAC);
|
covariate.initialize(RAC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void initCache() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,6 +72,11 @@ public class CycleCovariateUnitTest {
|
||||||
covariate.initialize(RAC);
|
covariate.initialize(RAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void initCache() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testSimpleCycles() {
|
public void testSimpleCycles() {
|
||||||
short readLength = 10;
|
short readLength = 10;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMReadGroupRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
@ -63,9 +64,14 @@ import java.util.Random;
|
||||||
*/
|
*/
|
||||||
public class ReadCovariatesUnitTest {
|
public class ReadCovariatesUnitTest {
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void init() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
public void testCovariateGeneration() {
|
public void testCovariateGeneration() {
|
||||||
final RecalibrationArgumentCollection RAC = new RecalibrationArgumentCollection();
|
final RecalibrationArgumentCollection RAC = new RecalibrationArgumentCollection();
|
||||||
final String RGID = "id";
|
final String RGID = "id";
|
||||||
|
|
||||||
ReadGroupCovariate rgCov = new ReadGroupCovariate();
|
ReadGroupCovariate rgCov = new ReadGroupCovariate();
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,6 +71,11 @@ public class ReadGroupCovariateUnitTest {
|
||||||
covariate.initialize(RAC);
|
covariate.initialize(RAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void initCache() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testSingleRecord() {
|
public void testSingleRecord() {
|
||||||
final String expected = "SAMPLE.1";
|
final String expected = "SAMPLE.1";
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMReadGroupRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -63,6 +64,11 @@ import java.util.*;
|
||||||
* @since 4/21/12
|
* @since 4/21/12
|
||||||
*/
|
*/
|
||||||
public class RecalibrationReportUnitTest {
|
public class RecalibrationReportUnitTest {
|
||||||
|
@BeforeMethod
|
||||||
|
public void init() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
private static RecalDatum createRandomRecalDatum(int maxObservations, int maxErrors) {
|
private static RecalDatum createRandomRecalDatum(int maxObservations, int maxErrors) {
|
||||||
final Random random = new Random();
|
final Random random = new Random();
|
||||||
final int nObservations = random.nextInt(maxObservations);
|
final int nObservations = random.nextInt(maxObservations);
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -82,6 +83,11 @@ public class RepeatCovariatesUnitTest {
|
||||||
rurlCovariate.initialize(RAC);
|
rurlCovariate.initialize(RAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void initCache() {
|
||||||
|
ReadCovariates.clearKeysCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testFindNumberOfRepetitions() {
|
public void testFindNumberOfRepetitions() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue