Skip to content

Commit 08f5a94

Browse files
Refactoring / housekeeping Mutect2IntegrationTest (#6184)
1 parent 572dd0b commit 08f5a94

File tree

8 files changed

+376
-808
lines changed

8 files changed

+376
-808
lines changed

src/main/java/org/broadinstitute/hellbender/engine/spark/AssemblyRegionArgumentCollection.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@
22

33
import org.broadinstitute.barclay.argparser.Advanced;
44
import org.broadinstitute.barclay.argparser.Argument;
5+
import org.broadinstitute.hellbender.engine.AssemblyRegionWalker;
56

67
import java.io.Serializable;
78

89
public abstract class AssemblyRegionArgumentCollection implements Serializable {
910
private static final long serialVersionUID = 1L;
1011

11-
@Argument(fullName = "min-assembly-region-size", doc = "Minimum size of an assembly region", optional = true)
12+
@Argument(fullName = AssemblyRegionWalker.MIN_ASSEMBLY_LONG_NAME, doc = "Minimum size of an assembly region", optional = true)
1213
public int minAssemblyRegionSize = defaultMinAssemblyRegionSize();
1314

14-
@Argument(fullName = "max-assembly-region-size", doc = "Maximum size of an assembly region", optional = true)
15+
@Argument(fullName = AssemblyRegionWalker.MAX_ASSEMBLY_LONG_NAME, doc = "Maximum size of an assembly region", optional = true)
1516
public int maxAssemblyRegionSize = defaultMaxAssemblyRegionSize();
1617

17-
@Argument(fullName = "assembly-region-padding", doc = "Number of additional bases of context to include around each assembly region", optional = true)
18+
@Argument(fullName = AssemblyRegionWalker.ASSEMBLY_PADDING_LONG_NAME, doc = "Number of additional bases of context to include around each assembly region", optional = true)
1819
public int assemblyRegionPadding = defaultAssemblyRegionPadding();
1920

20-
@Argument(fullName = "max-reads-per-alignment-start", doc = "Maximum number of reads to retain per alignment start position. Reads above this threshold will be downsampled. Set to 0 to disable.", optional = true)
21+
@Argument(fullName = AssemblyRegionWalker.MAX_STARTS_LONG_NAME, doc = "Maximum number of reads to retain per alignment start position. Reads above this threshold will be downsampled. Set to 0 to disable.", optional = true)
2122
public int maxReadsPerAlignmentStart = defaultMaxReadsPerAlignmentStart();
2223

2324
@Advanced
24-
@Argument(fullName = "active-probability-threshold", doc="Minimum probability for a locus to be considered active.", optional = true)
25+
@Argument(fullName = AssemblyRegionWalker.THRESHOLD_LONG_NAME, doc="Minimum probability for a locus to be considered active.", optional = true)
2526
public double activeProbThreshold = defaultActiveProbThreshold();
2627

2728
@Advanced
28-
@Argument(fullName = "max-prob-propagation-distance", doc="Upper limit on how many bases away probability mass can be moved around when calculating the boundaries between active and inactive assembly regions", optional = true)
29+
@Argument(fullName = AssemblyRegionWalker.PROPAGATION_LONG_NAME, doc="Upper limit on how many bases away probability mass can be moved around when calculating the boundaries between active and inactive assembly regions", optional = true)
2930
public int maxProbPropagationDistance = defaultMaxProbPropagationDistance();
3031

3132
/**

src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/ReadThreadingAssemblerArgumentCollection.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public abstract class ReadThreadingAssemblerArgumentCollection implements Serial
2121
public static final String ERROR_CORRECT_READS_LONG_NAME = "error-correct-reads";
2222

2323
public static final String CAPTURE_ASSEMBLY_FAILURE_BAM_LONG_NAME = "capture-assembly-failure-bam";
24+
public static final String KMER_SIZE_LONG_NAME = "kmer-size";
25+
public static final String DONT_INCREASE_KMER_SIZE_LONG_NAME = "dont-increase-kmer-sizes-for-cycles";
2426

2527

2628
//---------------------------------------------------------------------------------------------------------------
@@ -58,15 +60,15 @@ public abstract class ReadThreadingAssemblerArgumentCollection implements Serial
5860
* Multiple kmer sizes can be specified, using e.g. `--kmer-size 10 --kmer-size 25`.
5961
*/
6062
@Advanced
61-
@Argument(fullName="kmer-size", doc="Kmer size to use in the read threading assembler", optional = true)
63+
@Argument(fullName= KMER_SIZE_LONG_NAME, doc="Kmer size to use in the read threading assembler", optional = true)
6264
public List<Integer> kmerSizes = Lists.newArrayList(10,25);
6365

6466
/**
6567
* When graph cycles are detected, the normal behavior is to increase kmer sizes iteratively until the cycles are
6668
* resolved. Disabling this behavior may cause the program to give up on assembling the ActiveRegion.
6769
*/
6870
@Advanced
69-
@Argument(fullName="dont-increase-kmer-sizes-for-cycles", doc="Disable iterating over kmer sizes when graph cycles are detected", optional = true)
71+
@Argument(fullName= DONT_INCREASE_KMER_SIZE_LONG_NAME, doc="Disable iterating over kmer sizes when graph cycles are detected", optional = true)
7072
public boolean dontIncreaseKmerSizesForCycles = false;
7173

7274
/**

src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2ArgumentCollection.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public class M2ArgumentCollection extends AssemblyBasedCallerArgumentCollection
6262

6363
public static final double DEFAULT_MITO_PRUNING_LOG_ODDS_THRESHOLD = MathUtils.log10ToLog(-4);
6464
public static final String INDEPENDENT_MATES_LONG_NAME = "independent-mates";
65+
public static final String MINIMUM_ALLELE_FRACTION_LONG_NAME = "minimum-allele-fraction";
66+
public static final String MINIMUM_ALLELE_FRACTION_SHORT_NAME = "min-AF";
67+
public static final String LOD_BAND_LONG_NAME = "gvcf-lod-band";
68+
public static final String LOD_BAND_SHORT_NAME = "LODB";
6569

6670
@Override
6771
protected int getDefaultMaxMnpDistance() { return 1; }
@@ -239,7 +243,7 @@ public double getInitialLogOdds() {
239243
* Note that, unlike the GQ used by HaplotypeCaller GVCFs, here the reference calls with the highest confidence are the most negative.
240244
*/
241245
@Advanced
242-
@Argument(fullName = "gvcf-lod-band", shortName = "LODB", doc = "Exclusive upper bounds for reference confidence LOD bands " +
246+
@Argument(fullName = LOD_BAND_LONG_NAME, shortName = LOD_BAND_SHORT_NAME, doc = "Exclusive upper bounds for reference confidence LOD bands " +
243247
"(must be specified in increasing order)", optional = true)
244248
public List<Double> GVCFGQBands = new ArrayList<>(70);
245249
{
@@ -249,7 +253,7 @@ public double getInitialLogOdds() {
249253
}
250254

251255
@Advanced
252-
@Argument(fullName = "minimum-allele-fraction", shortName = "min-AF", doc = "Lower bound of variant allele fractions to consider when calculating variant LOD", optional = true)
256+
@Argument(fullName = MINIMUM_ALLELE_FRACTION_LONG_NAME, shortName = MINIMUM_ALLELE_FRACTION_SHORT_NAME, doc = "Lower bound of variant allele fractions to consider when calculating variant LOD", optional = true)
253257
public double minAF = 0.00;
254258

255259
@Advanced

src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2TestingUtils.java

+3-23
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,27 @@ public class M2TestingUtils {
2424
*/
2525
private static final int DEFAULT_ALIGNMENT_START = 99_991;
2626
private static final int DEFAULT_CHROM_INDEX = 0;
27-
private static final byte DEFAULT_BASEQ = 26;
2827
private static final int DEFAULT_MAPQ = 60;
2928
private static final int DEFAULT_NUM_CHROMOSOMES = 1;
3029
private static final int DEFAULT_STARTING_CHROM = 1;
3130
private static final int DEFAULT_CHROMOSOME_SIZE = 1_000_000;
3231
public static final byte[] DEFAULT_REF_BASES = "CATCACACTCACTAAGCACACAGAGAATAAT".getBytes();
33-
// Bases for C->T SNP at position 100,000 *
34-
public static final byte[] DEFAULT_ALT_BASES = "CATCACACTTACTAAGCACACAGAGAATAAT".getBytes();
35-
public static final int DEFAULT_START_POSITION = 99_991;
36-
public static final int DEFAULT_END_POSITION = 100_021;
37-
public static final int DEFAULT_SNP_POSITION = 100_000;
38-
public static final int DEFAULT_READ_LENGTH = DEFAULT_REF_BASES.length;
39-
public static final String DEFAULT_SAMPLE_NAME = "sample1";
4032

4133
public static SAMFileGATKReadWriter getBareBonesSamWriter(final File samFile, final SAMFileHeader samHeader) {
4234
return new SAMFileGATKReadWriter(ReadUtils.createCommonSAMWriter(samFile, null, samHeader, true, true, false));
4335
}
4436

45-
public static byte[] getUniformBQArray(final byte quality, final int readLength){
46-
final byte[] quals = new byte[readLength];
47-
Arrays.fill(quals, quality);
48-
return quals;
49-
}
50-
5137
public static List<GATKRead> createReads(final int numReads, final byte[] bases, final SAMFileHeader samHeader,
5238
final byte baseQuality, final String namePrefix){
5339
final int readLength = bases.length;
5440

5541
final List<GATKRead> reads = new ArrayList<>(numReads);
5642
for (int i = 0; i < numReads; i++) {
5743
final String cigar = bases.length + "M";
44+
final byte[] quals = new byte[readLength];
45+
Arrays.fill(quals, baseQuality);
5846
final GATKRead read = ArtificialReadUtils.createArtificialRead(samHeader, namePrefix + i, DEFAULT_CHROM_INDEX,
59-
DEFAULT_ALIGNMENT_START, bases, getUniformBQArray(baseQuality, readLength), cigar);
47+
DEFAULT_ALIGNMENT_START, bases, quals, cigar);
6048
read.setReadGroup(DEFAULT_READ_GROUP_NAME);
6149
read.setMappingQuality(DEFAULT_MAPQ);
6250
read.setIsFirstOfPair();
@@ -67,14 +55,6 @@ public static List<GATKRead> createReads(final int numReads, final byte[] bases,
6755
return reads;
6856
}
6957

70-
public static List<GATKRead> createReads(final int numReads, final byte[] bases, final SAMFileHeader samHeader){
71-
return createReads(numReads, bases, samHeader, DEFAULT_BASEQ, "read");
72-
}
73-
74-
public static SAMFileHeader createSamHeader(){
75-
return createSamHeader(DEFAULT_SAMPLE_NAME);
76-
}
77-
7858
public static SAMFileHeader createSamHeader(final String sampleName){
7959
final SAMFileHeader samHeader = ArtificialReadUtils.createArtificialSamHeader(
8060
DEFAULT_NUM_CHROMOSOMES, DEFAULT_STARTING_CHROM, DEFAULT_CHROMOSOME_SIZE);

0 commit comments

Comments
 (0)