diff --git a/build.xml b/build.xml
index 0a4cd2171..ca5d22a5a 100644
--- a/build.xml
+++ b/build.xml
@@ -646,7 +646,7 @@
-
+
@@ -679,20 +679,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -750,12 +736,6 @@
-
-
-
-
-
-
@@ -1249,11 +1229,7 @@
-
-
-
-
-
+
diff --git a/ivy.xml b/ivy.xml
index 5a8c3986a..0761cb411 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -23,86 +23,90 @@
-->
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
-
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/licensing/GATK2_beta_license.doc b/licensing/GATK2_beta_license.doc
index 4fa04a3f6..6c12bfe30 100644
Binary files a/licensing/GATK2_beta_license.doc and b/licensing/GATK2_beta_license.doc differ
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/ReadGroupCovariate.java b/protected/java/src/org/broadinstitute/sting/gatk/DummyProtectedClass.java
old mode 100755
new mode 100644
similarity index 52%
rename from public/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/ReadGroupCovariate.java
rename to protected/java/src/org/broadinstitute/sting/gatk/DummyProtectedClass.java
index 33adf4417..c1324aea4
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/ReadGroupCovariate.java
+++ b/protected/java/src/org/broadinstitute/sting/gatk/DummyProtectedClass.java
@@ -1,7 +1,4 @@
-package org.broadinstitute.sting.gatk.walkers.recalibration;
-
-import org.broadinstitute.sting.utils.recalibration.BaseRecalibration;
-import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
+package org.broadinstitute.sting.gatk;
/*
* Copyright (c) 2009 The Broad Institute
@@ -28,34 +25,10 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
* OTHER DEALINGS IN THE SOFTWARE.
*/
-/**
- * Created by IntelliJ IDEA.
- * User: rpoplin
- * Date: Oct 30, 2009
- *
- * The Read Group covariate.
- */
+import org.broadinstitute.sting.utils.classloader.ProtectedPackageSource;
-public class ReadGroupCovariate implements RequiredCovariate {
+public class DummyProtectedClass implements ProtectedPackageSource {
- // Initialize any member variables using the command-line arguments passed to the walkers
- @Override
- public void initialize(final RecalibrationArgumentCollection RAC) {
- }
-
- @Override
- public void getValues(final GATKSAMRecord read, final Comparable[] comparable) {
- final String readGroupId = read.getReadGroup().getReadGroupId();
- for (int i = 0; i < read.getReadLength(); i++) {
- comparable[i] = readGroupId;
- }
- }
-
- // Used to get the covariate's value from input csv file in TableRecalibrationWalker
- @Override
- public final Comparable getValue(final String str) {
- return str;
- }
+ // THIS CLASS IS USED JUST SO THAT WE CAN TEST WHETHER WE ARE USING THE LITE OR FULL VERSION OF THE GATK
+ // **** DO NOT REMOVE! ****
}
-
-
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/AdvancedRecalibrationEngine.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/AdvancedRecalibrationEngine.java
new file mode 100644
index 000000000..d714ca185
--- /dev/null
+++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/AdvancedRecalibrationEngine.java
@@ -0,0 +1,103 @@
+package org.broadinstitute.sting.gatk.walkers.bqsr;
+
+/*
+ * 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.recalibration.covariates.Covariate;
+import org.broadinstitute.sting.utils.BaseUtils;
+import org.broadinstitute.sting.utils.classloader.ProtectedPackageSource;
+import org.broadinstitute.sting.utils.collections.NestedIntegerArray;
+import org.broadinstitute.sting.utils.pileup.PileupElement;
+import org.broadinstitute.sting.utils.recalibration.EventType;
+import org.broadinstitute.sting.utils.recalibration.ReadCovariates;
+import org.broadinstitute.sting.utils.recalibration.RecalDatum;
+import org.broadinstitute.sting.utils.recalibration.RecalibrationTables;
+
+public class AdvancedRecalibrationEngine extends StandardRecalibrationEngine implements ProtectedPackageSource {
+
+ // optimizations: don't reallocate an array each time
+ private byte[] tempQualArray;
+ private boolean[] tempErrorArray;
+
+ public void initialize(final Covariate[] covariates, final RecalibrationTables recalibrationTables) {
+ super.initialize(covariates, recalibrationTables);
+ tempQualArray = new byte[EventType.values().length];
+ tempErrorArray = new boolean[EventType.values().length];
+ }
+
+ /**
+ * Loop through the list of requested covariates and pick out the value from the read, offset, and reference
+ * Using the list of covariate values as a key, pick out the RecalDatum and increment,
+ * adding one to the number of observations and potentially one to the number of mismatches for all three
+ * categories (mismatches, insertions and deletions).
+ *
+ * @param pileupElement The pileup element to update
+ * @param refBase The reference base at this locus
+ */
+ public synchronized void updateDataForPileupElement(final PileupElement pileupElement, final byte refBase) {
+ final int offset = pileupElement.getOffset();
+ final ReadCovariates readCovariates = covariateKeySetFrom(pileupElement.getRead());
+
+ tempQualArray[EventType.BASE_SUBSTITUTION.index] = pileupElement.getQual();
+ tempErrorArray[EventType.BASE_SUBSTITUTION.index] = !BaseUtils.basesAreEqual(pileupElement.getBase(), refBase);
+ tempQualArray[EventType.BASE_INSERTION.index] = pileupElement.getBaseInsertionQual();
+ tempErrorArray[EventType.BASE_INSERTION.index] = (pileupElement.getRead().getReadNegativeStrandFlag()) ? pileupElement.isAfterInsertion() : pileupElement.isBeforeInsertion();
+ tempQualArray[EventType.BASE_DELETION.index] = pileupElement.getBaseDeletionQual();
+ tempErrorArray[EventType.BASE_DELETION.index] = (pileupElement.getRead().getReadNegativeStrandFlag()) ? pileupElement.isAfterDeletedBase() : pileupElement.isBeforeDeletedBase();
+
+ for (final EventType eventType : EventType.values()) {
+ final int[] keys = readCovariates.getKeySet(offset, eventType);
+ final int eventIndex = eventType.index;
+ final byte qual = tempQualArray[eventIndex];
+ final boolean isError = tempErrorArray[eventIndex];
+
+ final NestedIntegerArray rgRecalTable = recalibrationTables.getTable(RecalibrationTables.TableType.READ_GROUP_TABLE);
+ final RecalDatum rgPreviousDatum = rgRecalTable.get(keys[0], eventIndex);
+ final RecalDatum rgThisDatum = createDatumObject(qual, isError);
+ if (rgPreviousDatum == null) // key doesn't exist yet in the map so make a new bucket and add it
+ rgRecalTable.put(rgThisDatum, keys[0], eventIndex);
+ else
+ rgPreviousDatum.combine(rgThisDatum);
+
+ final NestedIntegerArray qualRecalTable = recalibrationTables.getTable(RecalibrationTables.TableType.QUALITY_SCORE_TABLE);
+ final RecalDatum qualPreviousDatum = qualRecalTable.get(keys[0], keys[1], eventIndex);
+ if (qualPreviousDatum == null)
+ qualRecalTable.put(createDatumObject(qual, isError), keys[0], keys[1], eventIndex);
+ else
+ qualPreviousDatum.increment(isError);
+
+ for (int i = 2; i < covariates.length; i++) {
+ if (keys[i] < 0)
+ continue;
+ final NestedIntegerArray covRecalTable = recalibrationTables.getTable(i);
+ final RecalDatum covPreviousDatum = covRecalTable.get(keys[0], keys[1], keys[i], eventIndex);
+ if (covPreviousDatum == null)
+ covRecalTable.put(createDatumObject(qual, isError), keys[0], keys[1], keys[i], eventIndex);
+ else
+ covPreviousDatum.increment(isError);
+ }
+ }
+ }
+}
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAMWalker.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAM.java
similarity index 95%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAMWalker.java
rename to protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAM.java
index 3e07295e7..9809709a8 100644
--- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAMWalker.java
+++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompareBAM.java
@@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.compression.reducereads;
import org.broadinstitute.sting.commandline.Argument;
+import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.filters.DuplicateReadFilter;
@@ -11,6 +12,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
+import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
import java.util.HashMap;
import java.util.Map;
@@ -39,8 +41,9 @@ import java.util.Map;
* @since 10/30/11
*/
+@DocumentedGATKFeature( groupName = "Quality Control and Simple Analysis Tools", extraDocs = {CommandLineGATK.class} )
@ReadFilters({UnmappedReadFilter.class,NotPrimaryAlignmentFilter.class,DuplicateReadFilter.class,FailsVendorQualityCheckFilter.class})
-public class CompareBAMWalker extends LocusWalker