Support for --assume-single-sample in UG, better malformated bam exceptions, and ignoring out of order contigs in seqdictutils. All for the CG bam file

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4323 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-09-21 20:33:34 +00:00
parent 3938d53738
commit 522830fb01
4 changed files with 16 additions and 9 deletions

View File

@ -113,7 +113,7 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> {
contexts.put(sampleName,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
else {
if(assumedSingleSample == null) {
throw new UserException.MalformedBam(pileupBySample.iterator().next().getRead(), "Missing read group for read");
throw new UserException.ReadMissingReadGroup(pileupBySample.iterator().next().getRead());
}
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
}

View File

@ -187,7 +187,7 @@ public class UnifiedGenotyperEngine {
// annotate the call, if possible
if ( call != null && call.vc != null && annotationEngine != null ) {
// first off, we want to use the *unfiltered* context for the annotations
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(rawContext.getBasePileup());
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(rawContext.getBasePileup(), UAC.ASSUME_SINGLE_SAMPLE);
Collection<VariantContext> variantContexts = annotationEngine.annotateContext(tracker, refContext, stratifiedContexts, call.vc);
call.vc = variantContexts.iterator().next(); //We know the collection will always have exactly 1 element.

View File

@ -79,7 +79,8 @@ public class SequenceDictionaryUtils {
* @param dict2 the sequence dictionary dict2
*/
public static void validateDictionaries(Logger logger, String name1, SAMSequenceDictionary dict1, String name2, SAMSequenceDictionary dict2) {
switch ( compareDictionaries(dict1, dict2) ) {
SequenceDictionaryCompatability type = compareDictionaries(dict1, dict2);
switch ( type ) {
case IDENTICAL:
return;
case COMMON_SUBSET:
@ -104,7 +105,7 @@ public class SequenceDictionaryUtils {
break;
}
case NON_CANONICAL_HUMAN_ORDER:
case NON_CANONICAL_HUMAN_ORDER: {
UserException ex = new UserException.IncompatibleSequenceDictionaries("Human genome sequence provided in non-canonical ordering. For safety's sake the GATK requires contigs in karyotypic order: 1, 2, ..., 10, 11, ..., 20, 21, 22, X, Y with M either leading or trailing these contigs",
name1, dict1, name2, dict2);
@ -112,11 +113,17 @@ public class SequenceDictionaryUtils {
logger.warn(ex.getMessage());
else
throw ex;
}
case OUT_OF_ORDER:
throw new UserException.IncompatibleSequenceDictionaries("Order of contigs differences, which is unsafe", name1, dict1, name2, dict2);
case OUT_OF_ORDER: {
UserException ex = new UserException.IncompatibleSequenceDictionaries("Order of contigs differences, which is unsafe", name1, dict1, name2, dict2);
if ( allowNonFatalIncompabilities() )
logger.warn(ex.getMessage());
else
throw ex;
} break;
default:
throw new ReviewedStingException("Unexpected SequenceDictionaryComparison type");
throw new ReviewedStingException("Unexpected SequenceDictionaryComparison type: " + type);
}
}

View File

@ -112,7 +112,7 @@ public class UserException extends ReviewedStingException {
public static class MalformedBam extends UserException {
public MalformedBam(SAMRecord read, String message) {
super(String.format("SAM/BAM file %s is malformed: %s", read.getFileSource(), message));
super(String.format("SAM/BAM file %s is malformed: %s", read.getFileSource().getReader(), message));
}
}
@ -133,7 +133,7 @@ public class UserException extends ReviewedStingException {
public MissortedBAM(SAMFileHeader.SortOrder order, SAMRecord read, String message) {
super(String.format("Missorted Input SAM/BAM file %s: file sorted in %s order but %s is required; %s",
read.getFileSource(), read.getHeader().getSortOrder(), order, message));
read.getFileSource().getReader(), read.getHeader().getSortOrder(), order, message));
}
public MissortedBAM(String message) {