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 int minBaseQual,
|
||||
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
||||
final int nContigs) {
|
||||
final int nContigs,
|
||||
final boolean allowPolyploidReduction) {
|
||||
for ( String name : SampleUtils.getSAMFileSamples(header) ) {
|
||||
compressorsPerSample.put(name,
|
||||
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)
|
||||
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
|
||||
* and read group).
|
||||
|
|
@ -323,7 +329,7 @@ public class ReduceReads extends ReadWalker<LinkedList<GATKSAMRecord>, ReduceRea
|
|||
*/
|
||||
@Override
|
||||
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 ReduceReads.DownsampleStrategy downsampleStrategy;
|
||||
final private int nContigs;
|
||||
final private boolean allowPolyploidReduction;
|
||||
|
||||
private SlidingWindow slidingWindow;
|
||||
private int slidingWindowCounter;
|
||||
|
|
@ -31,7 +32,8 @@ public class SingleSampleCompressor implements Compressor {
|
|||
final double minIndelProportionToTriggerVariant,
|
||||
final int minBaseQual,
|
||||
final ReduceReads.DownsampleStrategy downsampleStrategy,
|
||||
final int nContigs) {
|
||||
final int nContigs,
|
||||
final boolean allowPolyploidReduction) {
|
||||
this.contextSize = contextSize;
|
||||
this.downsampleCoverage = downsampleCoverage;
|
||||
this.minMappingQuality = minMappingQuality;
|
||||
|
|
@ -41,6 +43,7 @@ public class SingleSampleCompressor implements Compressor {
|
|||
this.minBaseQual = minBaseQual;
|
||||
this.downsampleStrategy = downsampleStrategy;
|
||||
this.nContigs = nContigs;
|
||||
this.allowPolyploidReduction = allowPolyploidReduction;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -62,7 +65,7 @@ public class SingleSampleCompressor implements Compressor {
|
|||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public class SlidingWindow {
|
|||
|
||||
private final int nContigs;
|
||||
|
||||
private boolean allowPolyploidReduction;
|
||||
|
||||
/**
|
||||
* 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.downsampleCoverage = downsampleCoverage;
|
||||
|
||||
|
|
@ -114,6 +116,8 @@ public class SlidingWindow {
|
|||
this.downsampleStrategy = downsampleStrategy;
|
||||
this.hasIndelQualities = hasIndelQualities;
|
||||
this.nContigs = nContigs;
|
||||
|
||||
this.allowPolyploidReduction = allowPolyploidReduction;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -485,23 +489,26 @@ public class SlidingWindow {
|
|||
boolean canCompress = true;
|
||||
boolean foundEvent = false;
|
||||
Object[] header = windowHeader.toArray();
|
||||
for (int i = start; i<=stop; i++) {
|
||||
nHaplotypes = ((HeaderElement) header[i]).getNumberOfHaplotypes(MIN_ALT_BASE_PROPORTION_TO_TRIGGER_VARIANT);
|
||||
if (nHaplotypes > nContigs) {
|
||||
canCompress = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// guarantees that there is only 1 site in the variant region that needs more than one haplotype
|
||||
if (nHaplotypes > 1) {
|
||||
if (!foundEvent) {
|
||||
foundEvent = true;
|
||||
hetRefPosition = i;
|
||||
}
|
||||
else {
|
||||
if ( allowPolyploidReduction ) { // foundEvent will remain false if we don't allow polyploid reduction
|
||||
for (int i = start; i<=stop; i++) {
|
||||
nHaplotypes = ((HeaderElement) header[i]).getNumberOfHaplotypes(MIN_ALT_BASE_PROPORTION_TO_TRIGGER_VARIANT);
|
||||
if (nHaplotypes > nContigs) {
|
||||
canCompress = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// guarantees that there is only 1 site in the variant region that needs more than one haplotype
|
||||
if (nHaplotypes > 1) {
|
||||
if (!foundEvent) {
|
||||
foundEvent = true;
|
||||
hetRefPosition = i;
|
||||
}
|
||||
else {
|
||||
canCompress = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue