> getIndelLikelihoodMap() {
return indelLikelihoodMap.get();
}
@@ -443,8 +433,8 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood
// so that per-sample DP will include deletions covering the event.
protected int getFilteredDepth(ReadBackedPileup pileup) {
int count = 0;
- for ( PileupElement p : pileup ) {
- if (p.isDeletion() || BaseUtils.isRegularBase(p.getBase()) )
+ for (PileupElement p : pileup) {
+ if (p.isDeletion() || p.isInsertionAtBeginningOfRead() || BaseUtils.isRegularBase(p.getBase()))
count++;
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
index 81c766e4d..d9ee2ba1b 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
@@ -212,7 +212,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
public class BAQedPileupElement extends PileupElement {
public BAQedPileupElement( final PileupElement PE ) {
- super(PE.getRead(), PE.getOffset());
+ super(PE.getRead(), PE.getOffset(), PE.isDeletion());
}
@Override
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/QCRefWalker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/QCRefWalker.java
new file mode 100644
index 000000000..bddf27d84
--- /dev/null
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/QCRefWalker.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+package org.broadinstitute.sting.gatk.walkers.qc;
+
+import net.sf.picard.reference.IndexedFastaSequenceFile;
+import net.sf.picard.reference.ReferenceSequence;
+import net.sf.samtools.SAMSequenceRecord;
+import org.broad.tribble.Feature;
+import org.broadinstitute.sting.commandline.Argument;
+import org.broadinstitute.sting.commandline.Input;
+import org.broadinstitute.sting.commandline.Output;
+import org.broadinstitute.sting.commandline.RodBinding;
+import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
+import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
+import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
+import org.broadinstitute.sting.gatk.walkers.RefWalker;
+import org.broadinstitute.sting.utils.BaseUtils;
+import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
+import org.broadinstitute.sting.utils.collections.Pair;
+import org.broadinstitute.sting.utils.exceptions.StingException;
+
+import java.io.PrintStream;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Prints out counts of the number of reference ordered data objects encountered.
+ *
+ *
+ * Input
+ *
+ * One reference file only. And optionally -L intervals
+ *
+ *
+ * Output
+ *
+ * If ok, nothing, else will throw an exception at the site where there's been a problem
+ *
+ *
+ * Examples
+ *
+ * java -Xmx2g -jar GenomeAnalysisTK.jar \
+ * -R ref.fasta \
+ * -T QCRefWalker
+ *
+ *
+ */
+public class QCRefWalker extends RefWalker {
+ @Output
+ public PrintStream out;
+
+ String contigName = "";
+ int contigStart, contigEnd;
+ IndexedFastaSequenceFile uncachedRef;
+ byte[] uncachedBases;
+
+ @Override
+ public void initialize() {
+ super.initialize(); //To change body of overridden methods use File | Settings | File Templates.
+ uncachedRef = getToolkit().getReferenceDataSource().getReference();
+ }
+
+ private final void throwError(ReferenceContext ref, String message) {
+ throw new StingException(String.format("Site %s failed: %s", ref, message));
+ }
+
+ public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
+ final String locusContigName = ref.getLocus().getContig();
+ if ( ! locusContigName.equals(contigName) ) {
+ contigName = locusContigName;
+ ReferenceSequence refSeq = uncachedRef.getSequence(contigName);
+ contigStart = 1;
+ contigEnd = contigStart + refSeq.length();
+ uncachedBases = uncachedRef.getSubsequenceAt(contigName, contigStart, contigEnd).getBases();
+ logger.warn(String.format("Loading contig %s (%d-%d)", contigName, contigStart, contigEnd));
+ }
+
+ final byte refBase = ref.getBase();
+ if (! ( BaseUtils.isRegularBase(refBase) || BaseUtils.isNBase(refBase) ) )
+ throwError(ref, String.format("Refbase isn't a regular base (%d %c)", refBase, (char)refBase));
+
+ // check bases are equal
+ final int pos = (int)context.getPosition() - contigStart;
+ if ( pos > contigEnd )
+ throwError(ref, String.format("off contig (len=%d)", contigEnd));
+ final byte uncachedBase = uncachedBases[pos];
+
+ if ( uncachedBase != refBase )
+ throwError(ref, String.format("Provided refBase (%d %c) not equal to uncached one (%d %c)",
+ refBase, (char)refBase, uncachedBase, (char)uncachedBase));
+
+ return 1;
+ }
+
+ public Integer reduceInit() {
+ return 0;
+ }
+
+ public Integer reduce(Integer one, Integer sum) {
+ return one + sum;
+ }
+}
\ No newline at end of file
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
index ea12ada48..07cd95997 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
@@ -80,6 +80,10 @@ public class GenotypePhasingEvaluator extends VariantEvaluator {
return getName() + ": ";
}
+ public String update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
+ return update2(eval,comp,tracker,ref,context,null);
+ }
+
public String update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context, NewEvaluationContext group) {
//public String update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context, VariantEvalWalker.EvaluationContext group) {
Reasons interesting = new Reasons();
diff --git a/public/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java b/public/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java
index d7b34a253..f948a9bcf 100644
--- a/public/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java
+++ b/public/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java
@@ -71,6 +71,14 @@ import org.broadinstitute.sting.jna.clibrary.LibC;
public class LibBat {
static {
+ // via Platform LSF Configuration Reference, by default quiet the BSUB output.
+ if ("Y".equals(System.getProperty("BSUB_QUIET", "Y")))
+ LibC.setenv("BSUB_QUIET", "Y", 1);
+ String lsfLibDir = System.getenv("LSF_LIBDIR");
+ if (lsfLibDir != null) {
+ NativeLibrary.addSearchPath("lsf", lsfLibDir);
+ NativeLibrary.addSearchPath("bat", lsfLibDir);
+ }
/*
LSF 7.0.6 on the mac is missing the unsatisfied exported symbol for environ which was removed on MacOS X 10.5+.
nm $LSF_LIBDIR/liblsf.dylib | grep environ
@@ -79,16 +87,14 @@ public class LibBat {
*/
if (Platform.isMac())
NativeLibrary.getInstance("environhack");
- String lsfLibDir = System.getenv("LSF_LIBDIR");
- if (lsfLibDir != null) {
- NativeLibrary.addSearchPath("lsf", lsfLibDir);
- NativeLibrary.addSearchPath("bat", lsfLibDir);
- }
- NativeLibrary.getInstance("lsf");
- // via Platform LSF Configuration Reference, by default quiet the BSUB output.
- if ("Y".equals(System.getProperty("BSUB_QUIET", "Y")))
- LibC.setenv("BSUB_QUIET", "Y", 1);
+ NativeLibrary liblsf = NativeLibrary.getInstance("lsf");
Native.register("bat");
+ // HACK: Running into a weird error:
+ // java.lang.UnsatisfiedLinkError: Unable to load library 'bat': <$LSF_LIBDIR>/libbat.so: undefined symbol: xdr_resourceInfoReq
+ // This function is very clearly unsatisfied by running 'nm $LSF_LIBDIR/libbat.so | grep xdr_resourceInfoReq' but is
+ // found in liblsf.so when running 'nm $LSF_LIBDIR/liblsf.so | grep xdr_resourceInfoReq'. For now holding on to a reference
+ // to the LSF lib just in case this is a problem with the NativeLibrary's internal WeakReferences and the library being unloaded?
+ liblsf.getFunction("xdr_resourceInfoReq").getName();
}
// Via support@platform.com:
diff --git a/public/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java b/public/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
index 71640c66a..00a6ac1ae 100644
--- a/public/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
+++ b/public/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
@@ -468,7 +468,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
}
@Override protected String getFreezeFields() {
return String.format(
- ("if (%2$s != null)%n" +
+ ("if (%2$s != null && !org.broadinstitute.sting.utils.io.IOUtils.isSpecialFile(%2$s))%n" +
" if (!org.broadinstitute.sting.gatk.io.stubs.VCFWriterArgumentTypeDescriptor.isCompressed(%2$s.getPath))%n" +
" %1$s = new File(%2$s.getPath + \"%3$s\")%n"),
auxFieldName, originalFieldName, Tribble.STANDARD_INDEX_EXTENSION);
@@ -481,7 +481,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
}
@Override protected String getFreezeFields() {
return String.format(
- ("if (%2$s != null)%n" +
+ ("if (%2$s != null && !org.broadinstitute.sting.utils.io.IOUtils.isSpecialFile(%2$s))%n" +
" if (!%3$s)%n" +
" %1$s = new File(%2$s.getPath.stripSuffix(\".bam\") + \"%4$s\")%n"),
auxFieldName, originalFieldName, SAMFileWriterArgumentTypeDescriptor.DISABLE_INDEXING_FULLNAME, BAMIndex.BAMIndexSuffix);
@@ -494,7 +494,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
}
@Override protected String getFreezeFields() {
return String.format(
- ("if (%2$s != null)%n" +
+ ("if (%2$s != null && !org.broadinstitute.sting.utils.io.IOUtils.isSpecialFile(%2$s))%n" +
" if (%3$s)%n" +
" %1$s = new File(%2$s.getPath + \"%4$s\")%n"),
auxFieldName, originalFieldName, SAMFileWriterArgumentTypeDescriptor.ENABLE_MD5_FULLNAME, ".md5");
diff --git a/public/java/src/org/broadinstitute/sting/utils/fasta/CachingIndexedFastaSequenceFile.java b/public/java/src/org/broadinstitute/sting/utils/fasta/CachingIndexedFastaSequenceFile.java
index 43ef4aa74..44b586bcd 100644
--- a/public/java/src/org/broadinstitute/sting/utils/fasta/CachingIndexedFastaSequenceFile.java
+++ b/public/java/src/org/broadinstitute/sting/utils/fasta/CachingIndexedFastaSequenceFile.java
@@ -167,7 +167,7 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
if ( start < myCache.start || stop > myCache.stop || myCache.seq == null || myCache.seq.getContigIndex() != contigInfo.getSequenceIndex() ) {
cacheMisses++;
myCache.start = Math.max(start - cacheMissBackup, 0);
- myCache.stop = Math.min(myCache.start + cacheSize, contigInfo.getSequenceLength());
+ myCache.stop = Math.min(start + cacheSize + cacheMissBackup, contigInfo.getSequenceLength());
myCache.seq = super.getSubsequenceAt(contig, myCache.start, myCache.stop);
//System.out.printf("New cache at %s %d-%d%n", contig, cacheStart, cacheStop);
} else {
diff --git a/public/java/src/org/broadinstitute/sting/utils/io/IOUtils.java b/public/java/src/org/broadinstitute/sting/utils/io/IOUtils.java
index b3fdb93d3..a5ba857ef 100644
--- a/public/java/src/org/broadinstitute/sting/utils/io/IOUtils.java
+++ b/public/java/src/org/broadinstitute/sting/utils/io/IOUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, The Broad Institute
+ * Copyright (c) 2012, The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -37,6 +37,7 @@ import java.util.*;
public class IOUtils {
private static Logger logger = Logger.getLogger(IOUtils.class);
+ private static final File DEV_DIR = new File("/dev");
/**
* Checks if the temp directory has been setup and throws an exception if they user hasn't set it correctly.
@@ -301,12 +302,17 @@ public class IOUtils {
}
/**
- * Tries to delete a file. Emits a warning if the file was unable to be deleted.
+ * Tries to delete a file. Emits a warning if the file
+ * is not a special file and was unable to be deleted.
*
* @param file File to delete.
* @return true if the file was deleted.
*/
public static boolean tryDelete(File file) {
+ if (isSpecialFile(file)) {
+ logger.debug("Not trying to delete " + file);
+ return false;
+ }
boolean deleted = FileUtils.deleteQuietly(file);
if (deleted)
logger.debug("Deleted " + file);
@@ -385,4 +391,13 @@ public class IOUtils {
}
}
+
+ /**
+ * Returns true if the file is a special file.
+ * @param file File path to check.
+ * @return true if the file is a special file.
+ */
+ public static boolean isSpecialFile(File file) {
+ return file != null && (file.getAbsolutePath().startsWith("/dev/") || file.equals(DEV_DIR));
+ }
}
diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java
index 586b86490..1fa7101ca 100644
--- a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java
+++ b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java
@@ -40,7 +40,7 @@ import java.util.*;
* @author mhanna
* @version 0.1
*/
-public abstract class AbstractReadBackedPileup,PE extends PileupElement> implements ReadBackedPileup {
+public abstract class AbstractReadBackedPileup, PE extends PileupElement> implements ReadBackedPileup {
protected final GenomeLoc loc;
protected final PileupElementTracker pileupElementTracker;
@@ -55,23 +55,18 @@ public abstract class AbstractReadBackedPileup reads, List offsets ) {
+ public AbstractReadBackedPileup(GenomeLoc loc, List reads, List offsets) {
this.loc = loc;
- this.pileupElementTracker = readsOffsets2Pileup(reads,offsets);
+ this.pileupElementTracker = readsOffsets2Pileup(reads, offsets);
}
- public AbstractReadBackedPileup(GenomeLoc loc, List reads, int offset ) {
- this.loc = loc;
- this.pileupElementTracker = readsOffsets2Pileup(reads,offset);
- }
/**
* Create a new version of a read backed pileup at loc without any aligned reads
- *
*/
public AbstractReadBackedPileup(GenomeLoc loc) {
this(loc, new UnifiedPileupElementTracker());
@@ -81,11 +76,10 @@ public abstract class AbstractReadBackedPileup pileup) {
- if ( loc == null ) throw new ReviewedStingException("Illegal null genomeloc in ReadBackedPileup");
- if ( pileup == null ) throw new ReviewedStingException("Illegal null pileup in ReadBackedPileup");
+ if (loc == null) throw new ReviewedStingException("Illegal null genomeloc in ReadBackedPileup");
+ if (pileup == null) throw new ReviewedStingException("Illegal null pileup in ReadBackedPileup");
this.loc = loc;
this.pileupElementTracker = new UnifiedPileupElementTracker(pileup);
@@ -94,12 +88,13 @@ public abstract class AbstractReadBackedPileup pileup, int size, int nDeletions, int nMQ0Reads) {
- if ( loc == null ) throw new ReviewedStingException("Illegal null genomeloc in UnifiedReadBackedPileup");
- if ( pileup == null ) throw new ReviewedStingException("Illegal null pileup in UnifiedReadBackedPileup");
+ if (loc == null) throw new ReviewedStingException("Illegal null genomeloc in UnifiedReadBackedPileup");
+ if (pileup == null) throw new ReviewedStingException("Illegal null pileup in UnifiedReadBackedPileup");
this.loc = loc;
this.pileupElementTracker = new UnifiedPileupElementTracker(pileup);
@@ -115,16 +110,21 @@ public abstract class AbstractReadBackedPileup> pileupsBySample) {
+ protected AbstractReadBackedPileup(GenomeLoc loc, Map> pileupsBySample) {
this.loc = loc;
PerSamplePileupElementTracker tracker = new PerSamplePileupElementTracker();
- for(Map.Entry> pileupEntry: pileupsBySample.entrySet()) {
- tracker.addElements(pileupEntry.getKey(),pileupEntry.getValue().pileupElementTracker);
+ for (Map.Entry> pileupEntry : pileupsBySample.entrySet()) {
+ tracker.addElements(pileupEntry.getKey(), pileupEntry.getValue().pileupElementTracker);
addPileupToCumulativeStats(pileupEntry.getValue());
}
this.pileupElementTracker = tracker;
}
+ public AbstractReadBackedPileup(GenomeLoc loc, List reads, int offset) {
+ this.loc = loc;
+ this.pileupElementTracker = readsOffsets2Pileup(reads, offset);
+ }
+
/**
* Calculate cached sizes, nDeletion, and base counts for the pileup. This calculation is done upfront,
* so you pay the cost at the start, but it's more efficient to do this rather than pay the cost of calling
@@ -135,12 +135,12 @@ public abstract class AbstractReadBackedPileup pileup) {
+ protected void addPileupToCumulativeStats(AbstractReadBackedPileup pileup) {
size += pileup.getNumberOfElements();
abstractSize += pileup.depthOfCoverage();
nDeletions += pileup.getNumberOfDeletions();
@@ -167,14 +167,17 @@ public abstract class AbstractReadBackedPileup readsOffsets2Pileup(List reads, List offsets ) {
- if ( reads == null ) throw new ReviewedStingException("Illegal null read list in UnifiedReadBackedPileup");
- if ( offsets == null ) throw new ReviewedStingException("Illegal null offsets list in UnifiedReadBackedPileup");
- if ( reads.size() != offsets.size() ) throw new ReviewedStingException("Reads and offset lists have different sizes!");
+ private PileupElementTracker readsOffsets2Pileup(List reads, List offsets) {
+ if (reads == null) throw new ReviewedStingException("Illegal null read list in UnifiedReadBackedPileup");
+ if (offsets == null) throw new ReviewedStingException("Illegal null offsets list in UnifiedReadBackedPileup");
+ if (reads.size() != offsets.size())
+ throw new ReviewedStingException("Reads and offset lists have different sizes!");
UnifiedPileupElementTracker pileup = new UnifiedPileupElementTracker();
- for ( int i = 0; i < reads.size(); i++ ) {
- pileup.add(createNewPileupElement(reads.get(i),offsets.get(i)));
+ for (int i = 0; i < reads.size(); i++) {
+ GATKSAMRecord read = reads.get(i);
+ int offset = offsets.get(i);
+ pileup.add(createNewPileupElement(read, offset, BaseUtils.simpleBaseToBaseIndex(read.getReadBases()[offset]) == BaseUtils.D));
}
return pileup;
@@ -187,20 +190,21 @@ public abstract class AbstractReadBackedPileup readsOffsets2Pileup(List reads, int offset ) {
- if ( reads == null ) throw new ReviewedStingException("Illegal null read list in UnifiedReadBackedPileup");
- if ( offset < 0 ) throw new ReviewedStingException("Illegal offset < 0 UnifiedReadBackedPileup");
+ private PileupElementTracker readsOffsets2Pileup(List reads, int offset) {
+ if (reads == null) throw new ReviewedStingException("Illegal null read list in UnifiedReadBackedPileup");
+ if (offset < 0) throw new ReviewedStingException("Illegal offset < 0 UnifiedReadBackedPileup");
UnifiedPileupElementTracker pileup = new UnifiedPileupElementTracker();
- for ( int i = 0; i < reads.size(); i++ ) {
- pileup.add(createNewPileupElement( reads.get(i), offset ));
+ for (GATKSAMRecord read : reads) {
+ pileup.add(createNewPileupElement(read, offset, BaseUtils.simpleBaseToBaseIndex(read.getReadBases()[offset]) == BaseUtils.D));
}
return pileup;
}
- protected abstract AbstractReadBackedPileup createNewPileup(GenomeLoc loc, PileupElementTracker pileupElementTracker);
- protected abstract PE createNewPileupElement(GATKSAMRecord read, int offset);
+ protected abstract AbstractReadBackedPileup createNewPileup(GenomeLoc loc, PileupElementTracker pileupElementTracker);
+
+ protected abstract PE createNewPileupElement(GATKSAMRecord read, int offset, boolean isDeletion);
// --------------------------------------------------------
//
@@ -217,32 +221,31 @@ public abstract class AbstractReadBackedPileup 0 ) {
- if(pileupElementTracker instanceof PerSamplePileupElementTracker) {
- PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker)pileupElementTracker;
+ if (getNumberOfDeletions() > 0) {
+ if (pileupElementTracker instanceof PerSamplePileupElementTracker) {
+ PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker) pileupElementTracker;
PerSamplePileupElementTracker filteredTracker = new PerSamplePileupElementTracker();
- for(final String sample: tracker.getSamples()) {
+ for (final String sample : tracker.getSamples()) {
PileupElementTracker perSampleElements = tracker.getElements(sample);
- AbstractReadBackedPileup pileup = createNewPileup(loc,perSampleElements).getPileupWithoutDeletions();
- filteredTracker.addElements(sample,pileup.pileupElementTracker);
+ AbstractReadBackedPileup pileup = createNewPileup(loc, perSampleElements).getPileupWithoutDeletions();
+ filteredTracker.addElements(sample, pileup.pileupElementTracker);
}
- return (RBP)createNewPileup(loc,filteredTracker);
+ return (RBP) createNewPileup(loc, filteredTracker);
- }
- else {
- UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker)pileupElementTracker;
+ } else {
+ UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker) pileupElementTracker;
UnifiedPileupElementTracker filteredTracker = new UnifiedPileupElementTracker();
- for ( PE p : tracker ) {
- if ( !p.isDeletion() ) {
+ for (PE p : tracker) {
+ if (!p.isDeletion()) {
filteredTracker.add(p);
}
}
- return (RBP)createNewPileup(loc, filteredTracker);
+ return (RBP) createNewPileup(loc, filteredTracker);
}
} else {
- return (RBP)this;
+ return (RBP) this;
}
}
@@ -256,21 +259,20 @@ public abstract class AbstractReadBackedPileup tracker = (PerSamplePileupElementTracker)pileupElementTracker;
+ if (pileupElementTracker instanceof PerSamplePileupElementTracker) {
+ PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker) pileupElementTracker;
PerSamplePileupElementTracker filteredTracker = new PerSamplePileupElementTracker();
- for(final String sample: tracker.getSamples()) {
+ for (final String sample : tracker.getSamples()) {
PileupElementTracker perSampleElements = tracker.getElements(sample);
- AbstractReadBackedPileup pileup = createNewPileup(loc,perSampleElements).getOverlappingFragmentFilteredPileup();
- filteredTracker.addElements(sample,pileup.pileupElementTracker);
+ AbstractReadBackedPileup pileup = createNewPileup(loc, perSampleElements).getOverlappingFragmentFilteredPileup();
+ filteredTracker.addElements(sample, pileup.pileupElementTracker);
}
- return (RBP)createNewPileup(loc,filteredTracker);
- }
- else {
- Map filteredPileup = new HashMap();
+ return (RBP) createNewPileup(loc, filteredTracker);
+ } else {
+ Map filteredPileup = new HashMap();
- for ( PE p : pileupElementTracker ) {
+ for (PE p : pileupElementTracker) {
String readName = p.getRead().getReadName();
// if we've never seen this read before, life is good
@@ -292,10 +294,10 @@ public abstract class AbstractReadBackedPileup filteredTracker = new UnifiedPileupElementTracker();
- for(PE filteredElement: filteredPileup.values())
+ for (PE filteredElement : filteredPileup.values())
filteredTracker.add(filteredElement);
- return (RBP)createNewPileup(loc,filteredTracker);
+ return (RBP) createNewPileup(loc, filteredTracker);
}
}
@@ -309,300 +311,299 @@ public abstract class AbstractReadBackedPileup 0 ) {
- if(pileupElementTracker instanceof PerSamplePileupElementTracker) {
- PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker)pileupElementTracker;
+ if (getNumberOfMappingQualityZeroReads() > 0) {
+ if (pileupElementTracker instanceof PerSamplePileupElementTracker) {
+ PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker) pileupElementTracker;
PerSamplePileupElementTracker filteredTracker = new PerSamplePileupElementTracker();
- for(final String sample: tracker.getSamples()) {
+ for (final String sample : tracker.getSamples()) {
PileupElementTracker perSampleElements = tracker.getElements(sample);
- AbstractReadBackedPileup pileup = createNewPileup(loc,perSampleElements).getPileupWithoutMappingQualityZeroReads();
- filteredTracker.addElements(sample,pileup.pileupElementTracker);
+ AbstractReadBackedPileup pileup = createNewPileup(loc, perSampleElements).getPileupWithoutMappingQualityZeroReads();
+ filteredTracker.addElements(sample, pileup.pileupElementTracker);
}
- return (RBP)createNewPileup(loc,filteredTracker);
+ return (RBP) createNewPileup(loc, filteredTracker);
- }
- else {
- UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker)pileupElementTracker;
+ } else {
+ UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker) pileupElementTracker;
UnifiedPileupElementTracker filteredTracker = new UnifiedPileupElementTracker();
- for ( PE p : tracker ) {
- if ( p.getRead().getMappingQuality() > 0 ) {
+ for (PE p : tracker) {
+ if (p.getRead().getMappingQuality() > 0) {
filteredTracker.add(p);
}
}
- return (RBP)createNewPileup(loc, filteredTracker);
+ return (RBP) createNewPileup(loc, filteredTracker);
}
} else {
- return (RBP)this;
+ return (RBP) this;
}
}
public RBP getPositiveStrandPileup() {
- if(pileupElementTracker instanceof PerSamplePileupElementTracker) {
- PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker)pileupElementTracker;
+ if (pileupElementTracker instanceof PerSamplePileupElementTracker) {
+ PerSamplePileupElementTracker tracker = (PerSamplePileupElementTracker) pileupElementTracker;
PerSamplePileupElementTracker filteredTracker = new PerSamplePileupElementTracker();
- for(final String sample: tracker.getSamples()) {
+ for (final String sample : tracker.getSamples()) {
PileupElementTracker perSampleElements = tracker.getElements(sample);
- AbstractReadBackedPileup pileup = createNewPileup(loc,perSampleElements).getPositiveStrandPileup();
- filteredTracker.addElements(sample,pileup.pileupElementTracker);
+ AbstractReadBackedPileup pileup = createNewPileup(loc, perSampleElements).getPositiveStrandPileup();
+ filteredTracker.addElements(sample, pileup.pileupElementTracker);
}
- return (RBP)createNewPileup(loc,filteredTracker);
- }
- else {
- UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker)pileupElementTracker;
+ return (RBP) createNewPileup(loc, filteredTracker);
+ } else {
+ UnifiedPileupElementTracker tracker = (UnifiedPileupElementTracker