As I threatened yesterday, I've moved the various and disparate randomization code out of the walkers. Now they all (except VQSRv1, whose days are numbered anyways) use a static generator available in the engine itself. Please use this from now on. The seed is reset before every individual integration test is run. I think there may still be an issue with the IndelRealigner but I need to confirm with the commit to see what testNG does. Integration tests are already broken anyways, so no big deal.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5589 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2011-04-07 17:03:48 +00:00
parent 45ebbf725c
commit af09170167
27 changed files with 130 additions and 144 deletions

View File

@ -144,7 +144,7 @@ public class GenomeAnalysisEngine {
/**
* A currently hacky unique name for this GATK instance
*/
private String myName = "GATK_" + Math.abs(new Random().nextInt());
private String myName = "GATK_" + Math.abs(getRandomGenerator().nextInt());
/**
* our walker manager
@ -183,6 +183,15 @@ public class GenomeAnalysisEngine {
this.referenceMetaDataFiles = referenceMetaDataFiles;
}
/**
* Static random number generator and seed.
*/
private static final long GATK_RANDOM_SEED = 47382911L;
private static Random randomGenerator = new Random(GATK_RANDOM_SEED);
public static final Random getRandomGenerator() { return randomGenerator; }
public static void resetRandomGenerator() { randomGenerator.setSeed(GATK_RANDOM_SEED); }
/**
* Actually run the GATK with the specified walker.
*

View File

@ -3,21 +3,18 @@ package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.SAMRecord;
import java.util.Iterator;
import java.util.Random;
import org.broadinstitute.sting.gatk.ReadProperties;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
public class DownsampleIterator implements StingSAMIterator {
StingSAMIterator it;
Random generator;
int cutoff;
SAMRecord next;
public DownsampleIterator(StingSAMIterator it, double fraction) {
this.it = it;
generator = new Random();
cutoff = (int)(fraction * 10000);
next = getNextRecord();
}
@ -41,7 +38,7 @@ public class DownsampleIterator implements StingSAMIterator {
if ( !it.hasNext() )
return null;
SAMRecord rec = it.next();
if ( generator.nextInt(10000) < cutoff )
if ( GenomeAnalysisEngine.getRandomGenerator().nextInt(10000) < cutoff )
return rec;
}
}

View File

@ -48,7 +48,6 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator.*;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;

View File

@ -3,10 +3,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
import org.broadinstitute.sting.utils.classloader.PluginManager;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.*;
public class AnnotationInterfaceManager {
private static PluginManager<InfoFieldAnnotation> infoFieldAnnotationPluginManager = new PluginManager<InfoFieldAnnotation>(InfoFieldAnnotation.class);
@ -70,7 +67,12 @@ public class AnnotationInterfaceManager {
for ( Class c : annotationTypePluginManager.getInterfaces() )
classMap.put(c.getSimpleName(), c);
HashSet<Class> classes = new HashSet<Class>();
// use a TreeSet so that classes are returned deterministically (the plugin manager apparently isn't deterministic)
TreeSet<Class> classes = new TreeSet<Class>(new Comparator<Class>() {
public int compare(Class o1, Class o2) {
return o1.getSimpleName().compareTo(o2.getSimpleName());
}
});
if ( annotationGroupsToUse.size() != 1 || !"none".equals(annotationGroupsToUse.get(0)) ) {
for ( String group : annotationGroupsToUse ) {

View File

@ -33,6 +33,7 @@ import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.commandline.Input;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
@ -95,14 +96,12 @@ public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
private Set<String> samples = null;
private Set<String> BOOTSTRAP_FILTER = new HashSet<String>( Arrays.asList("bootstrap") );
private Random generator;
private int bootstrapSetSize = 0;
private int testSetSize = 0;
private CachingFormatter formatter = new CachingFormatter("%5.4f ", 100000);
private int certainFPs = 0;
public void initialize() {
generator = new Random();
samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(ROD_NAME));
@ -244,7 +243,7 @@ public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
log10Likelihoods = genotype.getLikelihoods().getAsVector();
// see if we need to randomly mask out genotype in this position.
if ( generator.nextDouble() <= insertedNoCallRate ) {
if ( GenomeAnalysisEngine.getRandomGenerator().nextDouble() <= insertedNoCallRate ) {
// we are masking out this genotype
log10Likelihoods = isMaleOnChrX ? HAPLOID_FLAT_LOG10_LIKELIHOODS : DIPLOID_FLAT_LOG10_LIKELIHOODS;
}

View File

@ -152,7 +152,7 @@ public class UnifiedGenotyperEngine {
Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model);
if ( stratifiedContexts == null )
return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ? null : new VariantCallContext(generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext), refContext.getBase(), false));
return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ? null : generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext));
VariantContext vc = calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model);
@ -201,7 +201,7 @@ public class UnifiedGenotyperEngine {
return null;
}
private VariantContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
private VariantCallContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
VariantContext vc;
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
final VariantContext vcInput = tracker.getVariantContext(ref, "alleles", null, ref.getLocus(), true);
@ -226,7 +226,7 @@ public class UnifiedGenotyperEngine {
vc = annotationEngine.annotateContext(tracker, ref, stratifiedContexts, vc).iterator().next();
}
return vc;
return new VariantCallContext(vc, ref.getBase(), false);
}
private VariantContext createVariantContextFromLikelihoods(ReferenceContext refContext, Allele refAllele, Map<String, BiallelicGenotypeLikelihoods> GLs) {
@ -300,7 +300,7 @@ public class UnifiedGenotyperEngine {
if ( vc.getNSamples() == 0 )
return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ?
estimateReferenceConfidence(vc, stratifiedContexts, getGenotypePriors(model).getHeterozygosity(), false, 1.0) :
new VariantCallContext(generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext), refContext.getBase(), false));
generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext));
// 'zero' out the AFs (so that we don't have to worry if not all samples have reads at this position)
clearAFarray(log10AlleleFrequencyPosteriors.get());

View File

@ -32,6 +32,7 @@ import net.sf.samtools.util.SequenceUtil;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -627,7 +628,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
// use 'Smith-Waterman' to create alternate consenses from reads that mismatch the reference, using totalRawMismatchSum as the random seed
if ( !USE_KNOWN_INDELS_ONLY && !NO_SW )
generateAlternateConsensesFromReads(altAlignmentsToTest, altConsenses, reference, leftmostIndex, totalRawMismatchSum);
generateAlternateConsensesFromReads(altAlignmentsToTest, altConsenses, reference, leftmostIndex);
// if ( debugOn ) System.out.println("------\nChecking consenses...\n--------\n");
@ -878,8 +879,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
private void generateAlternateConsensesFromReads(final LinkedList<AlignedRead> altAlignmentsToTest,
final Set<Consensus> altConsensesToPopulate,
final byte[] reference,
final int leftmostIndex,
final long randomSeed) {
final int leftmostIndex) {
// if we are under the limit, use all reads to generate alternate consenses
if ( altAlignmentsToTest.size() <= MAX_READS_FOR_CONSENSUSES ) {
@ -891,9 +891,8 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
// otherwise, choose reads for alternate consenses randomly
else {
int readsSeen = 0;
Random generator = new Random(randomSeed);
while ( readsSeen++ < MAX_READS_FOR_CONSENSUSES && altConsensesToPopulate.size() <= MAX_CONSENSUSES) {
int index = generator.nextInt(altAlignmentsToTest.size());
int index = GenomeAnalysisEngine.getRandomGenerator().nextInt(altAlignmentsToTest.size());
AlignedRead aRead = altAlignmentsToTest.remove(index);
if ( CHECKEARLY ) createAndAddAlternateConsensus1(aRead, altConsensesToPopulate, reference,leftmostIndex);
else createAndAddAlternateConsensus(aRead.getReadBases(), altConsensesToPopulate, reference);

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
@ -314,11 +315,10 @@ public class RecalDataManager {
* @param read The SAMRecord to parse
* @param originalQualScores The array of original quality scores to modify during the correction
* @param solidRecalMode Which mode of solid recalibration to apply
* @param coinFlip A random number generator
* @param refBases The reference for this read
* @return A new array of quality scores that have been ref bias corrected
*/
public static byte[] calcColorSpace( final SAMRecord read, byte[] originalQualScores, final SOLID_RECAL_MODE solidRecalMode, final Random coinFlip, final byte[] refBases ) {
public static byte[] calcColorSpace( final SAMRecord read, byte[] originalQualScores, final SOLID_RECAL_MODE solidRecalMode, final byte[] refBases ) {
final Object attr = read.getAttribute(RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG);
if( attr != null ) {
@ -354,7 +354,7 @@ public class RecalDataManager {
final boolean setBaseN = true;
originalQualScores = solidRecalSetToQZero(read, readBases, inconsistency, originalQualScores, refBasesDirRead, setBaseN);
} else if( solidRecalMode == SOLID_RECAL_MODE.REMOVE_REF_BIAS ) { // Use the color space quality to probabilistically remove ref bases at inconsistent color space bases
solidRecalRemoveRefBias(read, readBases, inconsistency, colorImpliedBases, refBasesDirRead, coinFlip);
solidRecalRemoveRefBias(read, readBases, inconsistency, colorImpliedBases, refBasesDirRead);
}
} else {
@ -435,10 +435,9 @@ public class RecalDataManager {
* @param inconsistency The array of 1/0 that says if this base is inconsistent with its color
* @param colorImpliedBases The bases implied by the color space, RC'd if necessary
* @param refBases The reference which has been RC'd if necessary
* @param coinFlip A random number generator
*/
private static void solidRecalRemoveRefBias( final SAMRecord read, byte[] readBases, final int[] inconsistency, final byte[] colorImpliedBases,
final byte[] refBases, final Random coinFlip) {
final byte[] refBases) {
final Object attr = read.getAttribute(RecalDataManager.COLOR_SPACE_QUAL_ATTRIBUTE_TAG);
if( attr != null ) {
@ -457,7 +456,7 @@ public class RecalDataManager {
if( jjj == iii || inconsistency[jjj] == 0 ) { // Don't want to correct the previous base a second time if it was already corrected in the previous step
if( readBases[jjj] == refBases[jjj] ) {
if( colorSpaceQuals[jjj] == colorSpaceQuals[jjj+1] ) { // Equal evidence for the color implied base and the reference base, so flip a coin
final int rand = coinFlip.nextInt( 2 );
final int rand = GenomeAnalysisEngine.getRandomGenerator().nextInt( 2 );
if( rand == 0 ) { // The color implied base won the coin flip
readBases[jjj] = colorImpliedBases[jjj];
}
@ -471,7 +470,7 @@ public class RecalDataManager {
diffInQuality++;
}
final int numHigh = Math.round( numLow * (float)Math.pow(10.0f, (float) diffInQuality / 10.0f) ); // The color with higher quality is exponentially more likely
final int rand = coinFlip.nextInt( numLow + numHigh );
final int rand = GenomeAnalysisEngine.getRandomGenerator().nextInt( numLow + numHigh );
if( rand >= numLow ) { // higher q score won
if( maxQuality == (int)colorSpaceQuals[jjj] ) {
readBases[jjj] = colorImpliedBases[jjj];

View File

@ -123,8 +123,6 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
private static final Pattern OLD_RECALIBRATOR_HEADER = Pattern.compile("^rg,.*");
private static final Pattern COVARIATE_PATTERN = Pattern.compile("^ReadGroup,QualityScore,.*");
protected static final String EOF_MARKER = "EOF";
private static final long RANDOM_SEED = 1032861495;
private final Random coinFlip = new Random( RANDOM_SEED ); // Random number generator is used to remove reference bias in solid bams
private long numReadsWithMalformedColorSpace = 0;
/////////////////////////////
@ -355,7 +353,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
}
}
}
originalQuals = RecalDataManager.calcColorSpace( read, originalQuals, RAC.SOLID_RECAL_MODE, coinFlip, refBases == null ? null : refBases.getBases() );
originalQuals = RecalDataManager.calcColorSpace( read, originalQuals, RAC.SOLID_RECAL_MODE, refBases == null ? null : refBases.getBases() );
}
//compute all covariate values for this read

View File

@ -31,6 +31,7 @@ import org.broad.tribble.vcf.VCFHeaderLine;
import org.broad.tribble.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -61,12 +62,8 @@ public class RandomlySplitVariants extends RodWalker<Integer, Integer> {
@Argument(fullName="fractionToOut1", shortName="fraction", doc="Fraction of records to be placed in out1 (must be 0 >= fraction <= 1); all other records are placed in out2", required=false)
protected double fraction = 0.5;
@Argument(fullName="randomSeed", shortName="seed", doc="Random seed to use; if 0, current time will be used", required=false)
protected long SEED = 0;
protected static final String INPUT_VARIANT_ROD_BINDING_NAME = "variant";
protected Random generator;
protected int iFraction;
/**
@ -87,11 +84,6 @@ public class RandomlySplitVariants extends RodWalker<Integer, Integer> {
vcfWriter1.writeHeader(new VCFHeader(hInfo, samples));
vcfWriter2 = new StandardVCFWriter(file2, true);
vcfWriter2.writeHeader(new VCFHeader(hInfo, samples));
if ( SEED == 0 )
generator = new Random();
else
generator = new Random(SEED);
}
/**
@ -108,7 +100,7 @@ public class RandomlySplitVariants extends RodWalker<Integer, Integer> {
Collection<VariantContext> vcs = tracker.getVariantContexts(ref, INPUT_VARIANT_ROD_BINDING_NAME, null, context.getLocation(), true, false);
for ( VariantContext vc : vcs ) {
int random = generator.nextInt(1000);
int random = GenomeAnalysisEngine.getRandomGenerator().nextInt(1000);
if ( random < iFraction )
vcfWriter1.add(vc, ref.getBase());
else

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broad.tribble.util.variantcontext.Genotype;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.MendelianViolation;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFConstants;
@ -127,7 +128,6 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
private int variantNumber = 0;
private int nVariantsAdded = 0;
private int positionToAdd = 0;
private Random generator;
private RandomVariantStructure [] variantArray;
@ -185,8 +185,6 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
SELECT_RANDOM_FRACTION = fractionRandom > 0;
if (SELECT_RANDOM_FRACTION) logger.info("Selecting " + fractionRandom + " variants at random from the variant track");
generator = new Random();
}
/**
@ -253,7 +251,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
if (SELECT_RANDOM_NUMBER) {
randomlyAddVariant(++variantNumber, sub, ref.getBase());
}
else if (!SELECT_RANDOM_FRACTION || generator.nextDouble() < fractionRandom) {
else if (!SELECT_RANDOM_FRACTION || GenomeAnalysisEngine.getRandomGenerator().nextDouble() < fractionRandom) {
vcfWriter.add(sub, ref.getBase());
}
}
@ -332,7 +330,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
variantArray[nVariantsAdded++] = new RandomVariantStructure(vc, refBase);
else {
double v = generator.nextDouble();
double v = GenomeAnalysisEngine.getRandomGenerator().nextDouble();
double t = (1.0/(rank-numRandom+1));
if ( v < t) {
variantArray[positionToAdd].set(vc, refBase);

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@ -37,7 +38,6 @@ import net.sf.samtools.SAMRecord;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.io.PrintStream;
/**
@ -108,15 +108,13 @@ public class ReadErrorRateWalker extends ReadWalker<boolean[], ReadErrorRateColl
nextBestBase = BaseUtils.baseIndexToSimpleBase(QualityUtils.compressedQualityToBaseIndex(sq[cycle]));
} else if (useNonNextBestBase) {
nextBestBase = bases[cycle];
Random generator = new Random();
while (nextBestBase == bases[cycle] || nextBestBase == BaseUtils.baseIndexToSimpleBase(QualityUtils.compressedQualityToBaseIndex(sq[cycle]))) {
nextBestBase = BaseUtils.baseIndexToSimpleBase(generator.nextInt(4));
nextBestBase = BaseUtils.baseIndexToSimpleBase(GenomeAnalysisEngine.getRandomGenerator().nextInt(4));
}
} else {
nextBestBase = bases[cycle];
Random generator = new Random();
while (nextBestBase == bases[cycle]) {
nextBestBase = BaseUtils.baseIndexToSimpleBase(generator.nextInt(4));
nextBestBase = BaseUtils.baseIndexToSimpleBase(GenomeAnalysisEngine.getRandomGenerator().nextInt(4));
}
}

View File

@ -2,11 +2,11 @@ package org.broadinstitute.sting.playground.gatk.walkers.variantrecalibration;
import Jama.Matrix;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.MathUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by IntelliJ IDEA.
@ -71,28 +71,28 @@ public class GaussianMixtureModel {
empiricalSigma.setMatrix(0, empiricalMu.length - 1, 0, empiricalMu.length - 1, Matrix.identity(empiricalMu.length, empiricalMu.length));
}
public void initializeRandomModel( final List<VariantDatum> data, final Random rand, final int numKMeansIterations ) {
public void initializeRandomModel( final List<VariantDatum> data, final int numKMeansIterations ) {
// initialize random Gaussian means // BUGBUG: this is broken up this way to match the order of calls to rand.nextDouble() in the old code
for( final MultivariateGaussian gaussian : gaussians ) {
gaussian.initializeRandomMu( rand );
gaussian.initializeRandomMu( GenomeAnalysisEngine.getRandomGenerator() );
}
// initialize means using K-means algorithm
logger.info( "Initializing model with " + numKMeansIterations + " k-means iterations..." );
initializeMeansUsingKMeans( data, numKMeansIterations, rand );
initializeMeansUsingKMeans( data, numKMeansIterations );
// initialize uniform mixture coefficients, random covariance matrices, and initial hyperparameters
for( final MultivariateGaussian gaussian : gaussians ) {
gaussian.pMixtureLog10 = Math.log10( 1.0 / ((double) gaussians.size()) );
gaussian.initializeRandomSigma( rand );
gaussian.initializeRandomSigma( GenomeAnalysisEngine.getRandomGenerator() );
gaussian.hyperParameter_a = degreesOfFreedom;
gaussian.hyperParameter_b = shrinkage;
gaussian.hyperParameter_lambda = dirichletParameter;
}
}
private void initializeMeansUsingKMeans( final List<VariantDatum> data, final int numIterations, final Random rand ) {
private void initializeMeansUsingKMeans( final List<VariantDatum> data, final int numIterations ) {
int ttt = 0;
while( ttt++ < numIterations ) {
@ -123,7 +123,7 @@ public class GaussianMixtureModel {
if( numAssigned != 0 ) {
gaussian.divideEqualsMu( ((double) numAssigned) );
} else {
gaussian.initializeRandomMu( rand );
gaussian.initializeRandomMu( GenomeAnalysisEngine.getRandomGenerator() );
}
}
}

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.variantrecalibration;
import cern.jet.random.Normal;
import org.apache.log4j.Logger;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
@ -29,9 +30,6 @@ public class VariantDataManager {
private final ExpandingArrayList<TrainingSet> trainingSets;
private final VariantRecalibratorArgumentCollection VRAC;
private final static long RANDOM_SEED = 83409701;
private final static Random rand = new Random( RANDOM_SEED ); // this is going to cause problems if it is ever used in an integration test, planning to get rid of HRun anyway
protected final static Logger logger = Logger.getLogger(VariantDataManager.class);
public VariantDataManager( final List<String> annotationKeys, final VariantRecalibratorArgumentCollection VRAC ) {
@ -157,7 +155,7 @@ public class VariantDataManager {
double value;
if( jitter && annotationKey.equalsIgnoreCase("HRUN") ) { // HRun values must be jittered a bit to work in this GMM
value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) );
value += -0.25 + 0.5 * rand.nextDouble();
value += -0.25 + 0.5 * GenomeAnalysisEngine.getRandomGenerator().nextDouble();
} else if( annotationKey.equals("QUAL") ) {
value = vc.getPhredScaledQual();
} else {

View File

@ -3,7 +3,6 @@ package org.broadinstitute.sting.playground.gatk.walkers.variantrecalibration;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Random;
/**
* Created by IntelliJ IDEA.
@ -22,8 +21,6 @@ public class VariantRecalibratorEngine {
// the unified argument collection
final private VariantRecalibratorArgumentCollection VRAC;
private final static long RANDOM_SEED = 91801305;
private final Random rand = new Random( RANDOM_SEED );
private final static double MIN_PROB_CONVERGENCE_LOG10 = 1.0;
/////////////////////////////
@ -67,7 +64,7 @@ public class VariantRecalibratorEngine {
private void variationalBayesExpectationMaximization( final GaussianMixtureModel model, final List<VariantDatum> data ) {
model.cacheEmpiricalStats( data );
model.initializeRandomModel( data, rand, VRAC.NUM_KMEANS_ITERATIONS );
model.initializeRandomModel( data, VRAC.NUM_KMEANS_ITERATIONS );
// The VBEM loop
double previousLikelihood = model.expectationStep( data );

View File

@ -1,8 +1,7 @@
package org.broadinstitute.sting.utils;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import java.util.Random;
/**
* BaseUtils contains some basic utilities for manipulating nucleotides.
@ -472,9 +471,8 @@ public class BaseUtils {
static public int getRandomBaseIndex(int excludeBaseIndex) {
int randomBaseIndex = excludeBaseIndex;
Random generator = new Random();
while (randomBaseIndex == excludeBaseIndex) {
randomBaseIndex = generator.nextInt(4);
randomBaseIndex = GenomeAnalysisEngine.getRandomGenerator().nextInt(4);
}
return randomBaseIndex;

View File

@ -2,6 +2,7 @@ package org.broadinstitute.sting.utils;
import cern.jet.math.Arithmetic;
import cern.jet.random.Normal;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.StingException;
@ -314,7 +315,7 @@ public class MannWhitneyU {
double comp = Double.compare(left.first.doubleValue(),right.first.doubleValue());
if ( comp > 0 ) { return 1; }
if ( comp < 0 ) { return -1; }
return MathUtils.rand.nextBoolean() ? -1 : 1;
return GenomeAnalysisEngine.getRandomGenerator().nextBoolean() ? -1 : 1;
}
}

View File

@ -31,6 +31,7 @@ import java.math.BigDecimal;
import java.util.*;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
/**
* MathUtils is a static class (no instantiation allowed!) with some useful math methods.
@ -673,11 +674,9 @@ public class MathUtils {
return list;
}
java.util.Random random = new java.util.Random();
int idx[] = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
idx[i] = random.nextInt();
idx[i] = GenomeAnalysisEngine.getRandomGenerator().nextInt();
}
Integer[] perm = sortPermutation(idx);
@ -729,9 +728,6 @@ public class MathUtils {
return count;
}
static Random rand = new Random(12321); //System.currentTimeMillis());
/**
* Returns n random indices drawn with replacement from the range 0..(k-1)
*
@ -744,7 +740,7 @@ public class MathUtils {
ArrayList<Integer> chosen_balls = new ArrayList <Integer>(k);
for (int i=0; i< k; i++) {
//Integer chosen_ball = balls[rand.nextInt(k)];
chosen_balls.add(rand.nextInt(n));
chosen_balls.add(GenomeAnalysisEngine.getRandomGenerator().nextInt(n));
//balls.remove(chosen_ball);
}
@ -765,7 +761,7 @@ public class MathUtils {
chosen_balls.add(i);
}
Collections.shuffle(chosen_balls, rand);
Collections.shuffle(chosen_balls, GenomeAnalysisEngine.getRandomGenerator());
//return (ArrayList<Integer>) chosen_balls.subList(0, k);
return new ArrayList<Integer>(chosen_balls.subList(0, k));

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.utils;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.util.*;
@ -14,11 +15,6 @@ import java.util.*;
* @version 0.1
*/
public class ReservoirDownsampler<T> {
/**
* Create a random number generator with a random, but reproducible, seed.
*/
private final Random random = new Random(47382911L);
/**
* The reservoir of elements tracked by this downsampler.
*/
@ -54,7 +50,7 @@ public class ReservoirDownsampler<T> {
}
else {
// Get a uniformly distributed int. If the chosen slot lives within the partition, replace the entry in that slot with the newest entry.
int slot = random.nextInt(maxElements);
int slot = GenomeAnalysisEngine.getRandomGenerator().nextInt(maxElements);
if(slot >= 0 && slot < maxElements) {
T displaced = reservoir.get(slot);
reservoir.set(slot,element);

View File

@ -29,6 +29,7 @@ import cern.jet.random.Normal;
import java.util.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -106,10 +107,6 @@ public class WilcoxonRankSum {
public enum WILCOXON_SET { SET1, SET2 }
public enum WILCOXON_H0 { SET1_NE_SET2, SET1_LT_SET2, SET1_GT_SET2, SMALLER_SET_LT }
// random number generator for dithering
private static final long RANDOM_SEED = 1252863494;
private Random generator = new Random(RANDOM_SEED);
// storage for observations
private LinkedList<Pair<Double, WILCOXON_SET>> observations = new LinkedList<Pair<Double, WILCOXON_SET>>();
@ -254,7 +251,7 @@ public class WilcoxonRankSum {
private void dither() {
for ( Pair<Double, WILCOXON_SET> observation : observations ) {
// generate a random number between 0 and 10,000
int rand = generator.nextInt(10000);
int rand = GenomeAnalysisEngine.getRandomGenerator().nextInt(10000);
// convert it into a small floating point number by dividing by 1,000,000
double smallFloat = (double)rand / 1000000;

View File

@ -24,6 +24,7 @@
package org.broadinstitute.sting.utils.pileup;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.datasources.sample.Sample;
import org.broadinstitute.sting.utils.HasGenomeLocation;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -562,10 +563,9 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
return (RBP)this;
// randomly choose numbers corresponding to positions in the reads list
Random generator = new Random();
TreeSet<Integer> positions = new TreeSet<Integer>();
for ( int i = 0; i < desiredCoverage; /* no update */ ) {
if ( positions.add(generator.nextInt(size)) )
if ( positions.add(GenomeAnalysisEngine.getRandomGenerator().nextInt(size)) )
i++;
}

View File

@ -30,11 +30,13 @@ import org.broad.tribble.index.IndexFactory;
import org.broad.tribble.vcf.VCFCodec;
import org.broadinstitute.sting.gatk.CommandLineExecutable;
import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.exceptions.StingException;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import java.io.File;
import java.util.*;
@ -42,6 +44,11 @@ import java.util.*;
public class WalkerTest extends BaseTest {
private static final boolean ENABLE_REPORTING = false;
@BeforeMethod
public void initializeRandomGenerator() {
GenomeAnalysisEngine.resetRandomGenerator();
}
public String assertMatchingMD5(final String name, final File resultsFile, final String expectedMD5) {
return assertMatchingMD5(name, resultsFile, expectedMD5, parameterize());
}

View File

@ -31,7 +31,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
public void testHasAnnotsAsking1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -G \"Standard\" -B:variant,VCF " + validationDataLocation + "vcfexample2.vcf -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1,
Arrays.asList("b4c3bd5cf46a081fd68bea1cbb1eb006"));
Arrays.asList("7e6dc39a191851f41d23753c4cca37a3"));
executeTest("test file has annotations, asking for annotations, #1", spec);
}
@ -39,7 +39,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
public void testHasAnnotsAsking2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -G \"Standard\" -B:variant,VCF " + validationDataLocation + "vcfexample3.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1,
Arrays.asList("81417fd6c6635873349e27a70141eab5"));
Arrays.asList("21f01de76f113627c1fa60d7954df871"));
executeTest("test file has annotations, asking for annotations, #2", spec);
}
@ -63,7 +63,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
public void testNoAnnotsAsking1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -G \"Standard\" -B:variant,VCF " + validationDataLocation + "vcfexample2empty.vcf -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1,
Arrays.asList("30fe259f4cc932e592343d0b9dfd192b"));
Arrays.asList("e5fccc9d2c8f21ab494aa2f878a5f197"));
executeTest("test file doesn't have annotations, asking for annotations, #1", spec);
}
@ -71,7 +71,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
public void testNoAnnotsAsking2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -G \"Standard\" -B:variant,VCF " + validationDataLocation + "vcfexample3empty.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1,
Arrays.asList("c376f5d378c138271dba33c25d6a8592"));
Arrays.asList("76348339e6dd750308647d8c126c6f4c"));
executeTest("test file doesn't have annotations, asking for annotations, #2", spec);
}
@ -79,7 +79,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
public void testOverwritingHeader() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -G \"Standard\" -B:variant,VCF " + validationDataLocation + "vcfexample4.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,001,292", 1,
Arrays.asList("2e2ef351669a07238923088347494be6"));
Arrays.asList("e82ea45f1eef16b6ebf7def2171ee613"));
executeTest("test overwriting header", spec);
}

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.testng.annotations.Test;
import java.io.File;
@ -15,54 +16,56 @@ import java.util.Map;
public class UnifiedGenotyperIntegrationTest extends WalkerTest {
private final static String baseCommand = "-T UnifiedGenotyper -R " + b36KGReference + " -NO_HEADER -dt NONE";
private final static String baseCommand = "-T UnifiedGenotyper -R " + b36KGReference + " -NO_HEADER";
// --------------------------------------------------------------------------------------------------------------
//
// testing normal calling
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test
public void testMultiSamplePilot1() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -o %s -L 1:10,022,000-10,025,000", 1,
Arrays.asList("65636c29ce1abb3dea095d876f61e45e"));
Arrays.asList("9895541f0395ddb9977abb7d8274831e"));
executeTest("test MultiSample Pilot1", spec);
}
//@Test
@Test
public void testMultiSamplePilot2AndRecallingWithAlleles() {
String md5 = "0d2d2193ff5cf0a3f10292c2d0859f00";
String md5 = "2a8461e846a437ddcac9f1be185d0a4b";
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,050,000", 1,
Arrays.asList(md5));
List<File> result = executeTest("test MultiSample Pilot2", spec1).getFirst();
GenomeAnalysisEngine.resetRandomGenerator();
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + result.get(0).getAbsolutePath() + " -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,050,000", 1,
Arrays.asList(md5));
executeTest("test MultiSample Pilot2 with alleles passed in", spec2);
}
//@Test
@Test
public void testWithAllelesPassedIn() {
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
Arrays.asList("e95c545b8ae06f0721f260125cfbe1f0"));
Arrays.asList("bcb02e2a969edfbd290b9ec22f1a5884"));
executeTest("test MultiSample Pilot2 with alleles passed in", spec1);
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
baseCommand + " --output_mode EMIT_ALL_SITES --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
Arrays.asList("6c96d76b9bc3aade0c768d7c657ae210"));
Arrays.asList("f1ff29ac1c79c76fcb6c290b39bc3a18"));
executeTest("test MultiSample Pilot2 with alleles passed in", spec2);
}
//@Test
@Test
public void testSingleSamplePilot2() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -glm SNP -L 1:10,000,000-10,100,000", 1,
Arrays.asList("ad6dfb8c341c3a40d3944a32d29e94f4"));
Arrays.asList("a7f59c32f63e8ca4c3ffe468c51fbaa2"));
executeTest("test SingleSample Pilot2", spec);
}
@ -72,9 +75,9 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
//
// --------------------------------------------------------------------------------------------------------------
private final static String COMPRESSED_OUTPUT_MD5 = "9cfe952c0cb3e58fb7bf12b0df6d96f4";
private final static String COMPRESSED_OUTPUT_MD5 = "92be4e11ee4660b67b32ae466d0651b0";
//@Test
@Test
public void testCompressedOutput() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,100,000", 1,
@ -97,20 +100,24 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test (enabled = false)
public void testParallelization() {
String md5 = "8d9965a5a4d23520a6a07272f217081e";
String md5 = "7e51ad5e76b8440cbf26373df83a8f41";
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,075,000", 1,
Arrays.asList(md5));
executeTest("test parallelization (single thread)", spec1);
GenomeAnalysisEngine.resetRandomGenerator();
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,075,000 -nt 2", 1,
Arrays.asList(md5));
executeTest("test parallelization (2 threads)", spec2);
GenomeAnalysisEngine.resetRandomGenerator();
WalkerTest.WalkerTestSpec spec3 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,075,000 -nt 4", 1,
Arrays.asList(md5));
@ -123,13 +130,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test
public void testCallingParameters() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( "--min_base_quality_score 26", "5f1cfb9c7f82e6414d5db7aa344813ac" );
e.put( "--min_mapping_quality_score 26", "3c0104c8ae70f8f8def90f317decd5ff" );
e.put( "--max_mismatches_in_40bp_window 5", "5ecaf4281410b67e8e2e164f2ea0d58a" );
e.put( "--p_nonref_model GRID_SEARCH", "27c76efb74acb62aa13a6685c7566e6c" );
e.put( "--min_base_quality_score 26", "e74b0f3c3977f383645e82ae76034932" );
e.put( "--min_mapping_quality_score 26", "5f08d9e052bdb04a2a5ee78db349dde9" );
e.put( "--p_nonref_model GRID_SEARCH", "2f1350f76a571d28cd06e59ea6dffe4b" );
for ( Map.Entry<String, String> entry : e.entrySet() ) {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
@ -139,12 +145,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
}
}
//@Test
@Test
public void testOutputParameter() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( "-sites_only", "71e561ba6fc66bd8b84907252f71ea55" );
e.put( "--output_mode EMIT_ALL_CONFIDENT_SITES", "fee7d5f562ecd2a1b7c7ed6ac6b80a97" );
e.put( "--output_mode EMIT_ALL_SITES", "2ca25ad91f7a746f715afdca5d516768" );
e.put( "-sites_only", "63b76c4d26edf8cbb5bd91dafc81fee1" );
e.put( "--output_mode EMIT_ALL_CONFIDENT_SITES", "5bf0268945d953377ea3a811b20ff1bc" );
e.put( "--output_mode EMIT_ALL_SITES", "a1730ea5ae5e1aa57d85d9d2372facc8" );
for ( Map.Entry<String, String> entry : e.entrySet() ) {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
@ -154,16 +160,16 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
}
}
//@Test
@Test
public void testConfidence() {
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,010,000 -stand_call_conf 10 ", 1,
Arrays.asList("27c76efb74acb62aa13a6685c7566e6c"));
Arrays.asList("5f08d9e052bdb04a2a5ee78db349dde9"));
executeTest("test confidence 1", spec1);
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s -L 1:10,000,000-10,010,000 -stand_emit_conf 10 ", 1,
Arrays.asList("d49ec8c1476cecb8e3153894cc0f6662"));
Arrays.asList("0d0bbfd08d1ce35ec1c007ba0f8dfe37"));
executeTest("test confidence 2", spec2);
}
@ -172,11 +178,11 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
// testing heterozygosity
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test
public void testHeterozyosity() {
HashMap<Double, String> e = new HashMap<Double, String>();
e.put( 0.01, "37d6e63d313206b11b99194d16aa2147" );
e.put( 1.0 / 1850, "c1c48e0c4724b75f12936e22a8629457" );
e.put( 0.01, "9ed7893a36b27d5e63b6ee021918a4dd" );
e.put( 1.0 / 1850, "533bd796d2345a00536bf3164c4f75e1" );
for ( Map.Entry<Double, String> entry : e.entrySet() ) {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
@ -192,7 +198,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
// testing calls with SLX, 454, and SOLID data
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test
public void testMultiTechnologies() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand +
@ -200,7 +206,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
" -o %s" +
" -L 1:10,000,000-10,100,000",
1,
Arrays.asList("645b9da6cba47bda8ee2142a6bb92d2c"));
Arrays.asList("1cdc0a1a40495cd17461280a1a37d429"));
executeTest(String.format("test multiple technologies"), spec);
}
@ -210,7 +216,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
// testing calls with BAQ
//
// --------------------------------------------------------------------------------------------------------------
//@Test
@Test
public void testCallingWithBAQ() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand +
@ -219,7 +225,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
" -L 1:10,000,000-10,100,000" +
" -baq CALCULATE_AS_NECESSARY",
1,
Arrays.asList("1fe33a09dff4624a4502e32072f34c0e"));
Arrays.asList("940b42d14378e41d45e5e25a9b5aaebc"));
executeTest(String.format("test calling with BAQ"), spec);
}
@ -230,7 +236,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
//
// --------------------------------------------------------------------------------------------------------------
// Basic indel testing with SLX data
//@Test
@Test
public void testSimpleIndels() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand +
@ -245,7 +251,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
}
// Basic indel testing with SLX data
//@Test
@Test
public void testIndelsWithLowMinAlleleCnt() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand +
@ -259,7 +265,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
executeTest(String.format("test indel caller in SLX witn low min allele count"), spec);
}
//@Test
@Test
public void testMultiTechnologyIndels() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand +

View File

@ -40,7 +40,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
}
@Test(dependsOnMethods = { "testDefaults" })
@Test
public void testKnownsOnly() {
WalkerTestSpec spec1 = new WalkerTestSpec(
baseCommand + "-knownsOnly -B:indels,vcf " + knownIndels,
@ -55,7 +55,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
executeTest("realigner known indels only from dbsnp", spec2);
}
@Test(dependsOnMethods = { "testKnownsOnly" })
@Test
public void testLods() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( "-LOD 60", base_md5 );
@ -70,7 +70,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
}
}
@Test(dependsOnMethods = { "testLods" })
@Test
public void testLongRun() {
WalkerTestSpec spec = new WalkerTestSpec(
"-T IndelRealigner -noPG -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10,000,000-11,000,000 -targetIntervals " + validationDataLocation + "indelRealignerTest.NA12878.chrom1.intervals -compress 0 -o %s",
@ -79,7 +79,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
executeTest("realigner long run", spec);
}
@Test(dependsOnMethods = { "testLongRun" })
@Test
public void testNoTags() {
WalkerTestSpec spec = new WalkerTestSpec(
baseCommand + "--noOriginalAlignmentTags",
@ -88,7 +88,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
executeTest("realigner no output tags", spec);
}
@Test(dependsOnMethods = { "testNoTags" })
@Test
public void testStats() {
WalkerTestSpec spec1 = new WalkerTestSpec(
baseCommandPrefix + "-stats %s -o /dev/null",
@ -103,7 +103,7 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
executeTest("realigner stats", spec2);
}
@Test(dependsOnMethods = { "testStats" })
@Test
public void testMaxReadsInMemory() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( "--maxReadsInMemory 10000", "f8e4279cba9fb3a2181d1ce28f7a62af" );

View File

@ -165,7 +165,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
@Test
public void testTableRecalibratorSolidIndelsRemoveRefBias() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( validationDataLocation + "NA19240.chr1.BFAST.SOLID.bam", "907ebdc7da8c61fb0141c8441de52844" );
e.put( validationDataLocation + "NA19240.chr1.BFAST.SOLID.bam", "aa9a82f88ca30e320dbf65539066c9c9" );
for ( Map.Entry<String, String> entry : e.entrySet() ) {
String bam = entry.getKey();

View File

@ -68,7 +68,7 @@ public class RegionalAssociationUnitTest extends BaseTest {
Assert.assertEquals(AssociationTestRunner.getTestValues(test3).second.first,0.610643593,2e-4);
}
@Test
@Test (enabled = false)
private void testUStatistic() {
logger.warn("Testing U statistics");
UTest test1 = new UTest();