Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of sequence dictionaries from multiple BAMs now throws warning instead of exception in CNV workflows. #4758

Merged
merged 1 commit into from
May 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ private void writeSamplesByCoveragePerContig(final File samplesByCoveragePerCont
logger.info(String.format("Aggregating read-count file %s (%d / %d)",
inputReadCountFile, sampleIndex + 1, numSamples));
final SimpleCountCollection readCounts = SimpleCountCollection.read(inputReadCountFile);
Utils.validateArg(CopyNumberArgumentValidationUtils.isSameDictionary(
readCounts.getMetadata().getSequenceDictionary(),
metadata.getSequenceDictionary()),
String.format("Sequence dictionary for read-count file %s does not match those " +
"in other read-count files.", inputReadCountFile));
if (!CopyNumberArgumentValidationUtils.isSameDictionary(
readCounts.getMetadata().getSequenceDictionary(), metadata.getSequenceDictionary())) {
logger.warn("Sequence dictionary for read-count file %s does not match that " +
"in other read-count files.", inputReadCountFile);
}
Utils.validateArg(readCounts.getIntervals().equals(intervals),
String.format("Intervals for read-count file %s do not match those in other " +
"read-count files.", inputReadCountFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,11 @@ private List<File> writeIntervalSubsetReadCountFiles() {
logger.info(String.format("Aggregating read-count file %s (%d / %d)",
inputReadCountFile, sampleIndex + 1, numSamples));
final SimpleCountCollection readCounts = SimpleCountCollection.read(inputReadCountFile);
Utils.validateArg(CopyNumberArgumentValidationUtils.isSameDictionary(
readCounts.getMetadata().getSequenceDictionary(),
specifiedIntervals.getMetadata().getSequenceDictionary()),
String.format("Sequence dictionary for read-count file %s does not match those in " +
"other read-count files.", inputReadCountFile));
if (!CopyNumberArgumentValidationUtils.isSameDictionary(
readCounts.getMetadata().getSequenceDictionary(), specifiedIntervals.getMetadata().getSequenceDictionary())) {
logger.warn("Sequence dictionary for read-count file %s does not match that " +
"in other read-count files.", inputReadCountFile);
}
Utils.validateArg(new HashSet<>(readCounts.getIntervals()).containsAll(intervalSubset),
String.format("Intervals for read-count file %s do not contain all specified intervals.",
inputReadCountFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,11 @@ private AllelicCountCollection genotypeHets(final SampleLocatableMetadata metada
"Run CollectAllelicCounts using the same interval list of sites for both samples.");
}
final SampleLocatableMetadata normalMetadata = normalAllelicCounts.getMetadata();
Utils.validateArg(CopyNumberArgumentValidationUtils.isSameDictionary(
if (!CopyNumberArgumentValidationUtils.isSameDictionary(
normalMetadata.getSequenceDictionary(),
metadata.getSequenceDictionary()),
"Sequence dictionaries in allelic-count files do not match.");
metadata.getSequenceDictionary())) {
logger.warn("Sequence dictionaries in allelic-count files do not match.");
}

//filter on total count in matched normal
logger.info(String.format("Filtering allelic counts in matched normal with total count less than %d...", minTotalAlleleCount));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ public static AnnotatedIntervalCollection validateAnnotatedIntervals(final File
logger.info("Reading and validating GC-content annotations for intervals...");
final AnnotatedIntervalCollection annotatedIntervals = new AnnotatedIntervalCollection(annotatedIntervalsFile);
final SAMSequenceDictionary sequenceDictionary = locatableCollection.getMetadata().getSequenceDictionary();
Utils.validateArg(annotatedIntervals.getMetadata().getSequenceDictionary().isSameDictionary(sequenceDictionary),
"Annotated-intervals file contains incorrect sequence dictionary.");
if (!CopyNumberArgumentValidationUtils.isSameDictionary(annotatedIntervals.getMetadata().getSequenceDictionary(), sequenceDictionary)) {
logger.warn("Sequence dictionary in annotated-intervals file does not match the master sequence dictionary.");
}
Utils.validateArg(annotatedIntervals.getIntervals().equals(locatableCollection.getIntervals()),
"Annotated intervals do not match provided intervals.");
return annotatedIntervals;
Expand All @@ -140,8 +141,9 @@ public static AnnotatedIntervalCollection validateAnnotatedIntervalsSubset(final
IOUtils.canReadFile(annotatedIntervalsFile);
final AnnotatedIntervalCollection annotatedIntervals = new AnnotatedIntervalCollection(annotatedIntervalsFile);
final SAMSequenceDictionary sequenceDictionary = locatableCollection.getMetadata().getSequenceDictionary();
Utils.validateArg(annotatedIntervals.getMetadata().getSequenceDictionary().isSameDictionary(sequenceDictionary),
"Annotated-intervals file contains incorrect sequence dictionary.");
if (!CopyNumberArgumentValidationUtils.isSameDictionary(annotatedIntervals.getMetadata().getSequenceDictionary(), sequenceDictionary)) {
logger.warn("Sequence dictionary in annotated-intervals file does not match the master sequence dictionary.");
}
final Set<SimpleInterval> intervalsSubset = new HashSet<>(locatableCollection.getIntervals());
Utils.validateArg(annotatedIntervals.getIntervals().containsAll(intervalsSubset),
"Annotated intervals do not contain all specified intervals.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,6 @@ public void testMissingSites() {
runCommandLine(argsBuilder);
}

@Test(expectedExceptions = IllegalArgumentException.class)
public void testSequenceDictionaryMismatch() {
final File outputDir = createTempDir("testDir");
final String outputPrefix = "test";
final ArgumentsBuilder argsBuilder = new ArgumentsBuilder()
.addArgument(CopyNumberStandardArgument.ALLELIC_COUNTS_FILE_LONG_NAME, TUMOR_ALLELIC_COUNTS_FILE.getAbsolutePath())
.addArgument(CopyNumberStandardArgument.NORMAL_ALLELIC_COUNTS_FILE_LONG_NAME, NORMAL_ALLELIC_COUNTS_FILE_WITH_SEQUENCE_DICTIONARY_MISMATCH.getAbsolutePath())
.addOutput(outputDir)
.addArgument(CopyNumberStandardArgument.OUTPUT_PREFIX_LONG_NAME, outputPrefix);
runCommandLine(argsBuilder);
}

@Test(expectedExceptions = UserException.class)
public void testOutputDirExists() {
final String outputPrefix = "test";
Expand Down