1) Revert previous change - indel recalibration is turned on by default and users of the Lite version will need to turn it off to avoid a User Error. 2) Implemented the engine.isGATKLite() method.
This commit is contained in:
parent
40618ac471
commit
62c5228048
|
|
@ -0,0 +1,34 @@
|
|||
package org.broadinstitute.sting.utils;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The Broad Institute
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import org.broadinstitute.sting.utils.classloader.ProtectedPackageSource;
|
||||
|
||||
public class DummyProtectedClass implements ProtectedPackageSource {
|
||||
|
||||
// THIS CLASS IS USED JUST SO THAT WE CAN TEST WHETHER WE ARE USING THE LITE OR FULL VERSION OF THE GATK
|
||||
|
||||
}
|
||||
|
|
@ -104,10 +104,10 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
@DataProvider(name = "PRTest")
|
||||
public Object[][] createPRTestData() {
|
||||
return new Object[][]{
|
||||
{new PRTest("", "66aa65223f192ee39c1773aa187fd493")},
|
||||
{new PRTest(" -qq -1 -IQ", "b7053d3d67aba6d8892f0a60f0ded338")},
|
||||
{new PRTest(" -qq 6 -IQ", "bfbf0855185b2b70aa35237fb71e4487")},
|
||||
{new PRTest(" -IQ", "d2d6ed8667cdba7e56f5db97d6262676")}
|
||||
{new PRTest("", "d2d6ed8667cdba7e56f5db97d6262676")},
|
||||
{new PRTest(" -qq -1", "b7053d3d67aba6d8892f0a60f0ded338")},
|
||||
{new PRTest(" -qq 6", "bfbf0855185b2b70aa35237fb71e4487")},
|
||||
{new PRTest(" -DIQ", "66aa65223f192ee39c1773aa187fd493")}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import org.broadinstitute.sting.gatk.samples.SampleDBBuilder;
|
|||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
|
|
@ -197,17 +198,28 @@ public class GenomeAnalysisEngine {
|
|||
private BaseRecalibration baseRecalibration = null;
|
||||
public BaseRecalibration getBaseRecalibration() { return baseRecalibration; }
|
||||
public boolean hasBaseRecalibration() { return baseRecalibration != null; }
|
||||
public void setBaseRecalibration(final File recalFile, final int quantizationLevels, final boolean useIndelQuals, final int preserveQLessThan) {
|
||||
baseRecalibration = new BaseRecalibration(recalFile, quantizationLevels, useIndelQuals, preserveQLessThan, isGATKLite());
|
||||
public void setBaseRecalibration(final File recalFile, final int quantizationLevels, final boolean disableIndelQuals, final int preserveQLessThan) {
|
||||
baseRecalibration = new BaseRecalibration(recalFile, quantizationLevels, disableIndelQuals, preserveQLessThan, isGATKLite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to determine whether this is the lite version of the GATK
|
||||
*/
|
||||
public boolean isGATKLite() {
|
||||
// TODO -- this is just a place holder for now
|
||||
return false;
|
||||
if ( isLiteVersion == null ) {
|
||||
final List<Class<? extends Object>> classes = new PluginManager<Object>(Object.class).getPlugins();
|
||||
isLiteVersion = true;
|
||||
for ( Class c : classes ) {
|
||||
if ( c.getSimpleName().equals(DummyProtectedClassName)) {
|
||||
isLiteVersion = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isLiteVersion;
|
||||
}
|
||||
private static final String DummyProtectedClassName = "DummyProtectedClass";
|
||||
private static Boolean isLiteVersion = null;
|
||||
|
||||
/**
|
||||
* Actually run the GATK with the specified walker.
|
||||
|
|
@ -239,7 +251,7 @@ public class GenomeAnalysisEngine {
|
|||
|
||||
// if the use specified an input BQSR recalibration table then enable on the fly recalibration
|
||||
if (args.BQSR_RECAL_FILE != null)
|
||||
setBaseRecalibration(args.BQSR_RECAL_FILE, args.quantizationLevels, args.enableIndelQuals, args.PRESERVE_QSCORES_LESS_THAN);
|
||||
setBaseRecalibration(args.BQSR_RECAL_FILE, args.quantizationLevels, args.disableIndelQuals, args.PRESERVE_QSCORES_LESS_THAN);
|
||||
|
||||
// Determine how the threads should be divided between CPU vs. IO.
|
||||
determineThreadAllocation();
|
||||
|
|
|
|||
|
|
@ -215,10 +215,10 @@ public class GATKArgumentCollection {
|
|||
public int quantizationLevels = 0;
|
||||
|
||||
/**
|
||||
* Turns on printing of the base insertion and base deletion tags when using the -BQSR argument. By default, only the base substitution qualities will be produced.
|
||||
* Turns off printing of the base insertion and base deletion tags when using the -BQSR argument and only the base substitution qualities will be produced.
|
||||
*/
|
||||
@Argument(fullName="enable_indel_quals", shortName = "IQ", doc = "If true, enables printing of base insertion and base deletion tags (with -BQSR)", required=false)
|
||||
public boolean enableIndelQuals = false;
|
||||
@Argument(fullName="disable_indel_quals", shortName = "DIQ", doc = "If true, disables printing of base insertion and base deletion tags (with -BQSR)", required=false)
|
||||
public boolean disableIndelQuals = false;
|
||||
|
||||
/**
|
||||
* Do not modify quality scores less than this value but rather just write them out unmodified in the recalibrated BAM file.
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ public class UserException extends ReviewedStingException {
|
|||
}
|
||||
|
||||
public static class NotSupportedInGATKLite extends UserException {
|
||||
public NotSupportedInGATKLite(String argument) {
|
||||
super(String.format("Unfortunately, the argument %s is not supported in the Lite version of the GATK", argument));
|
||||
public NotSupportedInGATKLite(String message) {
|
||||
super(String.format("GATK Lite does support all of the features of the full version: %s", message));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class BaseRecalibration {
|
|||
private final RecalibrationTables recalibrationTables;
|
||||
private final Covariate[] requestedCovariates; // list of all covariates to be used in this calculation
|
||||
|
||||
private final boolean emitIndelQuals;
|
||||
private final boolean disableIndelQuals;
|
||||
private final int preserveQLessThan;
|
||||
|
||||
private static final NestedHashMap[] qualityScoreByFullCovariateKey = new NestedHashMap[EventType.values().length]; // Caches the result of performSequentialQualityCalculation(..) for all sets of covariate values.
|
||||
|
|
@ -64,14 +64,14 @@ public class BaseRecalibration {
|
|||
*
|
||||
* @param RECAL_FILE a GATK Report file containing the recalibration information
|
||||
* @param quantizationLevels number of bins to quantize the quality scores
|
||||
* @param emitIndelQuals if true, emit base indel qualities
|
||||
* @param disableIndelQuals if true, do not emit base indel qualities
|
||||
* @param preserveQLessThan preserve quality scores less than this value
|
||||
* @param isGATKLite is this being called from the full or Lite version of the GATK
|
||||
*/
|
||||
public BaseRecalibration(final File RECAL_FILE, final int quantizationLevels, final boolean emitIndelQuals, final int preserveQLessThan, final boolean isGATKLite) {
|
||||
public BaseRecalibration(final File RECAL_FILE, final int quantizationLevels, final boolean disableIndelQuals, final int preserveQLessThan, final boolean isGATKLite) {
|
||||
// check for unsupported access
|
||||
if (isGATKLite && emitIndelQuals)
|
||||
throw new UserException.NotSupportedInGATKLite("enable_indel_quals");
|
||||
if (isGATKLite && !disableIndelQuals)
|
||||
throw new UserException.NotSupportedInGATKLite("base insertion/deletion recalibration is not supported, please use the --disable_indel_quals argument");
|
||||
|
||||
RecalibrationReport recalibrationReport = new RecalibrationReport(RECAL_FILE);
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ public class BaseRecalibration {
|
|||
quantizationInfo.quantizeQualityScores(quantizationLevels);
|
||||
|
||||
readCovariates = new ReadCovariates(MAXIMUM_RECALIBRATED_READ_LENGTH, requestedCovariates.length);
|
||||
this.emitIndelQuals = emitIndelQuals;
|
||||
this.disableIndelQuals = disableIndelQuals;
|
||||
this.preserveQLessThan = preserveQLessThan;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public class BaseRecalibration {
|
|||
public void recalibrateRead(final GATKSAMRecord read) {
|
||||
RecalDataManager.computeCovariates(read, requestedCovariates, readCovariates); // compute all covariates for the read
|
||||
for (final EventType errorModel : EventType.values()) { // recalibrate all three quality strings
|
||||
if (!emitIndelQuals && errorModel != EventType.BASE_SUBSTITUTION) {
|
||||
if (disableIndelQuals && errorModel != EventType.BASE_SUBSTITUTION) {
|
||||
read.setBaseQualities(null, errorModel);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue