diff --git a/protected/java/src/org/broadinstitute/sting/utils/DummyProtectedClass.java b/protected/java/src/org/broadinstitute/sting/utils/DummyProtectedClass.java new file mode 100644 index 000000000..e4021981b --- /dev/null +++ b/protected/java/src/org/broadinstitute/sting/utils/DummyProtectedClass.java @@ -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 + +} diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRIntegrationTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRIntegrationTest.java index 5d472189a..b9ea26e64 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRIntegrationTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRIntegrationTest.java @@ -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")} }; } diff --git a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java index ef54e7cc6..e1b66829f 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java @@ -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> classes = new PluginManager(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(); diff --git a/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java b/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java index a5e38155f..e31af0b50 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java +++ b/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java @@ -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. diff --git a/public/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java b/public/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java index f91d5e127..f950cbfb3 100755 --- a/public/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java +++ b/public/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java @@ -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)); } } diff --git a/public/java/src/org/broadinstitute/sting/utils/recalibration/BaseRecalibration.java b/public/java/src/org/broadinstitute/sting/utils/recalibration/BaseRecalibration.java index ca6ac5c9a..efb6ecef9 100644 --- a/public/java/src/org/broadinstitute/sting/utils/recalibration/BaseRecalibration.java +++ b/public/java/src/org/broadinstitute/sting/utils/recalibration/BaseRecalibration.java @@ -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; }