Merged bug fix from Stable into Unstable

This commit is contained in:
Eric Banks 2012-03-21 12:44:43 -04:00
commit 8c09ff9459
4 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,5 @@
package org.broadinstitute.sting.gatk.iterators; package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.SAMFormatException;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import net.sf.samtools.util.CloseableIterator; import net.sf.samtools.util.CloseableIterator;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
@ -23,7 +22,7 @@ public class MalformedBAMErrorReformatingIterator implements CloseableIterator<S
public boolean hasNext() { public boolean hasNext() {
try { try {
return this.it.hasNext(); return this.it.hasNext();
} catch ( SAMFormatException e ) { } catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFormatExceptions) sometimes
throw new UserException.MalformedBAM(source, e.getMessage()); throw new UserException.MalformedBAM(source, e.getMessage());
} }
} }
@ -31,7 +30,7 @@ public class MalformedBAMErrorReformatingIterator implements CloseableIterator<S
public SAMRecord next() { public SAMRecord next() {
try { try {
return it.next(); return it.next();
} catch ( SAMFormatException e ) { } catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFormatExceptions) sometimes
throw new UserException.MalformedBAM(source, e.getMessage()); throw new UserException.MalformedBAM(source, e.getMessage());
} }
} }

View File

@ -31,8 +31,10 @@ public class LowMQ extends InfoFieldAnnotation {
double total = 0; double total = 0;
for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() )
{ {
ReadBackedPileup pileup = sample.getValue().getBasePileup(); if ( !sample.getValue().hasBasePileup() )
for (PileupElement p : pileup ) continue;
for ( PileupElement p : sample.getValue().getBasePileup() )
{ {
if ( p.getMappingQual() == 0 ) { mq0 += 1; } if ( p.getMappingQual() == 0 ) { mq0 += 1; }
if ( p.getMappingQual() <= 10 ) { mq10 += 1; } if ( p.getMappingQual() <= 10 ) { mq10 += 1; }

View File

@ -243,6 +243,19 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
if (multipleAllelesMergeType == VariantContextUtils.MultipleAllelesMergeType.BY_TYPE) { if (multipleAllelesMergeType == VariantContextUtils.MultipleAllelesMergeType.BY_TYPE) {
Map<VariantContext.Type, List<VariantContext>> VCsByType = VariantContextUtils.separateVariantContextsByType(vcs); Map<VariantContext.Type, List<VariantContext>> VCsByType = VariantContextUtils.separateVariantContextsByType(vcs);
// TODO -- clean this up in a refactoring
// merge NO_VARIATION into another type of variant (based on the ordering in VariantContext.Type)
if ( VCsByType.containsKey(VariantContext.Type.NO_VARIATION) && VCsByType.size() > 1 ) {
final List<VariantContext> refs = VCsByType.remove(VariantContext.Type.NO_VARIATION);
for ( VariantContext.Type type : VariantContext.Type.values() ) {
if ( VCsByType.containsKey(type) ) {
VCsByType.get(type).addAll(refs);
break;
}
}
}
// iterate over the types so that it's deterministic // iterate over the types so that it's deterministic
for (VariantContext.Type type : VariantContext.Type.values()) { for (VariantContext.Type type : VariantContext.Type.values()) {
if (VCsByType.containsKey(type)) if (VCsByType.containsKey(type))

View File

@ -110,7 +110,7 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
" -priority NA19240_BGI,NA19240_ILLUMINA,NA19240_WUGSC,denovoInfo" + " -priority NA19240_BGI,NA19240_ILLUMINA,NA19240_WUGSC,denovoInfo" +
" -genotypeMergeOptions UNIQUIFY -L 1"), " -genotypeMergeOptions UNIQUIFY -L 1"),
1, 1,
Arrays.asList("ab72f4bfb16d3894942149173a087647")); Arrays.asList("ee43a558fd3faeaa447acab89f0001d5"));
executeTest("threeWayWithRefs", spec); executeTest("threeWayWithRefs", spec);
} }