Merge branch 'master' of ssh://gsa2.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
11540da98b
|
|
@ -54,11 +54,12 @@ public class MultiSampleCompressor implements Compressor {
|
||||||
final double minIndelProportionToTriggerVariant,
|
final double minIndelProportionToTriggerVariant,
|
||||||
final int minBaseQual,
|
final int minBaseQual,
|
||||||
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
||||||
final int nContigs) {
|
final int nContigs,
|
||||||
|
final boolean allowPolyploidReduction) {
|
||||||
for ( String name : SampleUtils.getSAMFileSamples(header) ) {
|
for ( String name : SampleUtils.getSAMFileSamples(header) ) {
|
||||||
compressorsPerSample.put(name,
|
compressorsPerSample.put(name,
|
||||||
new SingleSampleCompressor(contextSize, downsampleCoverage,
|
new SingleSampleCompressor(contextSize, downsampleCoverage,
|
||||||
minMappingQuality, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, downsampleStrategy, nContigs));
|
minMappingQuality, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, downsampleStrategy, nContigs, allowPolyploidReduction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,12 @@ public class ReduceReads extends ReadWalker<LinkedList<GATKSAMRecord>, ReduceRea
|
||||||
@Argument(fullName = "minimum_tail_qualities", shortName = "mintail", doc = "", required = false)
|
@Argument(fullName = "minimum_tail_qualities", shortName = "mintail", doc = "", required = false)
|
||||||
private byte minTailQuality = 2;
|
private byte minTailQuality = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow the experimental polyploid-based reduction capabilities of this tool
|
||||||
|
*/
|
||||||
|
@Argument(fullName = "allow_polyploid_reduction", shortName = "polyploid", doc = "", required = false)
|
||||||
|
private boolean USE_POLYPLOID_REDUCTION = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not simplify read (strip away all extra information of the read -- anything other than bases, quals
|
* Do not simplify read (strip away all extra information of the read -- anything other than bases, quals
|
||||||
* and read group).
|
* and read group).
|
||||||
|
|
@ -323,7 +329,7 @@ public class ReduceReads extends ReadWalker<LinkedList<GATKSAMRecord>, ReduceRea
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ReduceReadsStash reduceInit() {
|
public ReduceReadsStash reduceInit() {
|
||||||
return new ReduceReadsStash(new MultiSampleCompressor(getToolkit().getSAMFileHeader(), contextSize, downsampleCoverage, minMappingQuality, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, downsampleStrategy, nContigs));
|
return new ReduceReadsStash(new MultiSampleCompressor(getToolkit().getSAMFileHeader(), contextSize, downsampleCoverage, minMappingQuality, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, downsampleStrategy, nContigs, USE_POLYPLOID_REDUCTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ public class SingleSampleCompressor implements Compressor {
|
||||||
final private int minBaseQual;
|
final private int minBaseQual;
|
||||||
final private ReduceReads.DownsampleStrategy downsampleStrategy;
|
final private ReduceReads.DownsampleStrategy downsampleStrategy;
|
||||||
final private int nContigs;
|
final private int nContigs;
|
||||||
|
final private boolean allowPolyploidReduction;
|
||||||
|
|
||||||
private SlidingWindow slidingWindow;
|
private SlidingWindow slidingWindow;
|
||||||
private int slidingWindowCounter;
|
private int slidingWindowCounter;
|
||||||
|
|
@ -31,7 +32,8 @@ public class SingleSampleCompressor implements Compressor {
|
||||||
final double minIndelProportionToTriggerVariant,
|
final double minIndelProportionToTriggerVariant,
|
||||||
final int minBaseQual,
|
final int minBaseQual,
|
||||||
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
||||||
final int nContigs) {
|
final int nContigs,
|
||||||
|
final boolean allowPolyploidReduction) {
|
||||||
this.contextSize = contextSize;
|
this.contextSize = contextSize;
|
||||||
this.downsampleCoverage = downsampleCoverage;
|
this.downsampleCoverage = downsampleCoverage;
|
||||||
this.minMappingQuality = minMappingQuality;
|
this.minMappingQuality = minMappingQuality;
|
||||||
|
|
@ -41,6 +43,7 @@ public class SingleSampleCompressor implements Compressor {
|
||||||
this.minBaseQual = minBaseQual;
|
this.minBaseQual = minBaseQual;
|
||||||
this.downsampleStrategy = downsampleStrategy;
|
this.downsampleStrategy = downsampleStrategy;
|
||||||
this.nContigs = nContigs;
|
this.nContigs = nContigs;
|
||||||
|
this.allowPolyploidReduction = allowPolyploidReduction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -62,7 +65,7 @@ public class SingleSampleCompressor implements Compressor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( slidingWindow == null) { // this is the first read
|
if ( slidingWindow == null) { // this is the first read
|
||||||
slidingWindow = new SlidingWindow(read.getReferenceName(), read.getReferenceIndex(), contextSize, read.getHeader(), read.getReadGroup(), slidingWindowCounter, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, minMappingQuality, downsampleCoverage, downsampleStrategy, read.hasBaseIndelQualities(), nContigs);
|
slidingWindow = new SlidingWindow(read.getReferenceName(), read.getReferenceIndex(), contextSize, read.getHeader(), read.getReadGroup(), slidingWindowCounter, minAltProportionToTriggerVariant, minIndelProportionToTriggerVariant, minBaseQual, minMappingQuality, downsampleCoverage, downsampleStrategy, read.hasBaseIndelQualities(), nContigs, allowPolyploidReduction);
|
||||||
slidingWindowCounter++;
|
slidingWindowCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ public class SlidingWindow {
|
||||||
|
|
||||||
private final int nContigs;
|
private final int nContigs;
|
||||||
|
|
||||||
|
private boolean allowPolyploidReduction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The types of synthetic reads to use in the finalizeAndAdd method
|
* The types of synthetic reads to use in the finalizeAndAdd method
|
||||||
*/
|
*/
|
||||||
|
|
@ -85,7 +87,7 @@ public class SlidingWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SlidingWindow(String contig, int contigIndex, int contextSize, SAMFileHeader samHeader, GATKSAMReadGroupRecord readGroupAttribute, int windowNumber, final double minAltProportionToTriggerVariant, final double minIndelProportionToTriggerVariant, int minBaseQual, int minMappingQuality, int downsampleCoverage, final ReduceReads.DownsampleStrategy downsampleStrategy, boolean hasIndelQualities, int nContigs) {
|
public SlidingWindow(String contig, int contigIndex, int contextSize, SAMFileHeader samHeader, GATKSAMReadGroupRecord readGroupAttribute, int windowNumber, final double minAltProportionToTriggerVariant, final double minIndelProportionToTriggerVariant, int minBaseQual, int minMappingQuality, int downsampleCoverage, final ReduceReads.DownsampleStrategy downsampleStrategy, boolean hasIndelQualities, int nContigs, boolean allowPolyploidReduction) {
|
||||||
this.contextSize = contextSize;
|
this.contextSize = contextSize;
|
||||||
this.downsampleCoverage = downsampleCoverage;
|
this.downsampleCoverage = downsampleCoverage;
|
||||||
|
|
||||||
|
|
@ -114,6 +116,8 @@ public class SlidingWindow {
|
||||||
this.downsampleStrategy = downsampleStrategy;
|
this.downsampleStrategy = downsampleStrategy;
|
||||||
this.hasIndelQualities = hasIndelQualities;
|
this.hasIndelQualities = hasIndelQualities;
|
||||||
this.nContigs = nContigs;
|
this.nContigs = nContigs;
|
||||||
|
|
||||||
|
this.allowPolyploidReduction = allowPolyploidReduction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -485,6 +489,8 @@ public class SlidingWindow {
|
||||||
boolean canCompress = true;
|
boolean canCompress = true;
|
||||||
boolean foundEvent = false;
|
boolean foundEvent = false;
|
||||||
Object[] header = windowHeader.toArray();
|
Object[] header = windowHeader.toArray();
|
||||||
|
|
||||||
|
if ( allowPolyploidReduction ) { // foundEvent will remain false if we don't allow polyploid reduction
|
||||||
for (int i = start; i<=stop; i++) {
|
for (int i = start; i<=stop; i++) {
|
||||||
nHaplotypes = ((HeaderElement) header[i]).getNumberOfHaplotypes(MIN_ALT_BASE_PROPORTION_TO_TRIGGER_VARIANT);
|
nHaplotypes = ((HeaderElement) header[i]).getNumberOfHaplotypes(MIN_ALT_BASE_PROPORTION_TO_TRIGGER_VARIANT);
|
||||||
if (nHaplotypes > nContigs) {
|
if (nHaplotypes > nContigs) {
|
||||||
|
|
@ -504,6 +510,7 @@ public class SlidingWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int refStart = windowHeader.get(start).getLocation();
|
int refStart = windowHeader.get(start).getLocation();
|
||||||
int refStop = windowHeader.get(stop).getLocation();
|
int refStop = windowHeader.get(stop).getLocation();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue