use of org.broadinstitute.hellbender.engine.FeatureDataSource in project gatk-protected by broadinstitute.
the class OrientationBiasFiltererUnitTest method testAnnotateVariantContextWithFilterValuesMultiArtifact.
@Test
public void testAnnotateVariantContextWithFilterValuesMultiArtifact() {
final FeatureDataSource<VariantContext> featureDataSource = new FeatureDataSource<>(new File(smallM2VcfMore));
SortedSet<Transition> relevantTransitions = new TreeSet<>();
relevantTransitions.add(Transition.transitionOf('G', 'T'));
relevantTransitions.add(Transition.transitionOf('C', 'T'));
final Map<Transition, Double> preAdapterQFakeScoreMap = new HashMap<>();
final double amGTPreAdapterQ = 20.0;
final double amCTPreAdapterQ = 25.0;
// preAdapterQ suppression will do nothing.
preAdapterQFakeScoreMap.put(relevantTransitions.first(), amGTPreAdapterQ);
// preAdapterQ suppression will do nothing.
preAdapterQFakeScoreMap.put(relevantTransitions.last(), amCTPreAdapterQ);
final List<VariantContext> updatedVariants = new ArrayList<>();
for (final VariantContext vc : featureDataSource) {
final VariantContext updatedVariantContext = OrientationBiasFilterer.annotateVariantContextWithPreprocessingValues(vc, relevantTransitions, preAdapterQFakeScoreMap);
updatedVariants.add(updatedVariantContext);
}
final List<String> sampleNames = updatedVariants.get(0).getSampleNamesOrderedByName();
// Create a mapping from sample name to a genotype->variant context map
final Map<String, SortedMap<Genotype, VariantContext>> sampleNameToVariants = OrientationBiasFilterer.createSampleToGenotypeVariantContextSortedMap(sampleNames, updatedVariants);
}
use of org.broadinstitute.hellbender.engine.FeatureDataSource in project gatk-protected by broadinstitute.
the class OrientationBiasUtilsUnitTest method testCountNumUnfiltered.
@Test
public void testCountNumUnfiltered() {
// Setup the test
final FeatureDataSource<VariantContext> featureDataSource = new FeatureDataSource<>(new File(smallM2VcfMore));
final List<VariantContext> variantContexts = getVariantContexts(featureDataSource);
Assert.assertEquals(OrientationBiasUtils.calculateUnfilteredNonRefGenotypeCount(variantContexts, "TUMOR"), 9);
Assert.assertEquals(OrientationBiasUtils.calculateUnfilteredNonRefGenotypeCount(variantContexts, "NORMAL"), 0);
}
use of org.broadinstitute.hellbender.engine.FeatureDataSource in project gatk-protected by broadinstitute.
the class OrientationBiasUtilsUnitTest method testCountNumTransition.
@Test
public void testCountNumTransition() {
// Setup the test
final FeatureDataSource<VariantContext> featureDataSource = new FeatureDataSource<>(new File(smallM2VcfMore));
SortedSet<Transition> relevantTransitions = new TreeSet<>();
relevantTransitions.add(Transition.transitionOf('T', 'A'));
final List<VariantContext> variantContexts = getVariantContexts(featureDataSource);
// Should be one, since one of the variants was filtered.
Assert.assertEquals(OrientationBiasUtils.calculateNumTransition("TUMOR", variantContexts, relevantTransitions.first()), 1);
Assert.assertEquals(OrientationBiasUtils.calculateNumTransition("NORMAL", variantContexts, relevantTransitions.first()), 0);
}
use of org.broadinstitute.hellbender.engine.FeatureDataSource in project gatk by broadinstitute.
the class FilterByOrientationBiasIntegrationTest method testNoVariantsNoSamplesRun.
@Test
public void testNoVariantsNoSamplesRun() throws IOException {
final File outputFile = File.createTempFile("ob_no_variants_no_sample", ".vcf");
final List<String> arguments = new ArrayList<>();
arguments.add("-" + FilterByOrientationBias.PRE_ADAPTER_METRICS_DETAIL_FILE_SHORT_NAME);
arguments.add(preAdapterQFile);
arguments.add("-" + StandardArgumentDefinitions.VARIANT_SHORT_NAME);
arguments.add(emptyVcfNoSamples);
arguments.add("-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME);
arguments.add(outputFile.getAbsolutePath());
runCommandLine(arguments);
Assert.assertTrue(outputFile.exists());
final List<VariantContext> variantContexts = new ArrayList<>();
final FeatureDataSource<VariantContext> featureDataSource = new FeatureDataSource<>(outputFile);
for (final VariantContext vc : featureDataSource) {
variantContexts.add(vc);
}
Assert.assertEquals(variantContexts.size(), 0);
Assert.assertTrue(FileUtils.sizeOf(outputFile) > 0);
final File summaryFile = new File(outputFile.getAbsolutePath() + FilterByOrientationBias.SUMMARY_FILE_SUFFIX);
Assert.assertTrue(summaryFile.exists());
Assert.assertTrue(FileUtils.sizeOf(summaryFile) > 0);
final List<OrientationSampleTransitionSummary> summaries = OrientationBiasUtils.readOrientationBiasSummaryTable(summaryFile);
Assert.assertEquals(summaries.size(), 0);
}
use of org.broadinstitute.hellbender.engine.FeatureDataSource in project gatk by broadinstitute.
the class FilterByOrientationBiasIntegrationTest method testNoVariantsRun.
@Test
public void testNoVariantsRun() throws IOException {
final File outputFile = File.createTempFile("ob_no_variants", ".vcf");
final List<String> arguments = new ArrayList<>();
arguments.add("-" + FilterByOrientationBias.PRE_ADAPTER_METRICS_DETAIL_FILE_SHORT_NAME);
arguments.add(preAdapterQFile);
arguments.add("-" + StandardArgumentDefinitions.VARIANT_SHORT_NAME);
arguments.add(emptyVcf);
arguments.add("-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME);
arguments.add(outputFile.getAbsolutePath());
runCommandLine(arguments);
Assert.assertTrue(outputFile.exists());
final List<VariantContext> variantContexts = new ArrayList<>();
final FeatureDataSource<VariantContext> featureDataSource = new FeatureDataSource<>(outputFile);
for (final VariantContext vc : featureDataSource) {
variantContexts.add(vc);
}
Assert.assertEquals(variantContexts.size(), 0);
final File summaryFile = new File(outputFile.getAbsolutePath() + FilterByOrientationBias.SUMMARY_FILE_SUFFIX);
Assert.assertTrue(summaryFile.exists());
Assert.assertTrue(FileUtils.sizeOf(outputFile) > 0);
Assert.assertTrue(FileUtils.sizeOf(summaryFile) > 0);
final List<OrientationSampleTransitionSummary> summaries = OrientationBiasUtils.readOrientationBiasSummaryTable(summaryFile);
Assert.assertEquals(summaries.size(), 0);
}
Aggregations