use of org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList in project gatk by broadinstitute.
the class HeterogeneousPloidyModelUnitTest method testPloidyAndSampleList.
@Test(dataProvider = "ploidyAndSampleListData")
public void testPloidyAndSampleList(final int[] ploidies) {
final int sampleCount = ploidies.length;
final List<String> sampleNames = new ArrayList<>(sampleCount);
for (int i = 0; i < sampleCount; i++) sampleNames.add("SAMPLE_" + i);
final IndexedSampleList sampleList = new IndexedSampleList(sampleNames);
final PloidyModel ploidyModel = new HeterogeneousPloidyModel(sampleList, ploidies);
final boolean expectedHom = allSame(ploidies);
Assert.assertEquals(ploidyModel.isHomogeneous(), expectedHom);
Assert.assertEquals(ploidyModel.totalPloidy(), MathUtils.sum(ploidies));
for (int i = 0; i < sampleCount; i++) {
Assert.assertEquals(ploidyModel.samplePloidy(i), ploidies[i]);
}
SampleListUnitTester.assertSampleList(ploidyModel, sampleNames);
}
use of org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList in project gatk by broadinstitute.
the class HeterogeneousPloidyModelUnitTest method testBadLength.
@Test(expectedExceptions = IllegalArgumentException.class)
public void testBadLength() throws Exception {
final int sampleCount = 2;
final List<String> sampleNames = new ArrayList<>(sampleCount);
for (int i = 0; i < sampleCount; i++) sampleNames.add("SAMPLE_" + i);
final IndexedSampleList sampleList = new IndexedSampleList(sampleNames);
//count mismatch
new HeterogeneousPloidyModel(sampleList, new int[] { 1, 2, 3 });
}
use of org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList in project gatk by broadinstitute.
the class HomogeneousPloidyModelUnitTest method testPloidyAndSampleList.
@Test(dataProvider = "ploidyAndSampleListData")
public void testPloidyAndSampleList(final int ploidy, final int sampleCount) {
final List<String> sampleNames = new ArrayList<>(sampleCount);
for (int i = 0; i < sampleCount; i++) sampleNames.add("SAMPLE_" + i);
final IndexedSampleList sampleList = new IndexedSampleList(sampleNames);
final HomogeneousPloidyModel ploidyModel = new HomogeneousPloidyModel(sampleList, ploidy);
Assert.assertTrue(ploidyModel.isHomogeneous());
Assert.assertEquals(ploidyModel.totalPloidy(), sampleCount * ploidy);
for (int i = 0; i < sampleCount; i++) Assert.assertEquals(ploidyModel.samplePloidy(i), ploidy);
SampleListUnitTester.assertSampleList(ploidyModel, sampleNames);
}
use of org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList in project gatk-protected by broadinstitute.
the class HaplotypeCallerEngine method initializeSamples.
private void initializeSamples() {
sampleSet = ReadUtils.getSamplesFromHeader(readsHeader);
samplesList = new IndexedSampleList(sampleSet);
if (hcArgs.sampleNameToUse != null) {
if (!sampleSet.contains(hcArgs.sampleNameToUse)) {
throw new CommandLineException.BadArgumentValue("--sample_name", "Specified name does not exist in input bam files");
}
if (sampleSet.size() == 1) {
//No reason to incur performance penalty associated with filtering if they specified the name of the only sample
hcArgs.sampleNameToUse = null;
} else {
samplesList = new IndexedSampleList(hcArgs.sampleNameToUse);
sampleSet.clear();
sampleSet.add(hcArgs.sampleNameToUse);
}
}
}
use of org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList in project gatk by broadinstitute.
the class Mutect2Engine method initialize.
private void initialize() {
samplesList = new IndexedSampleList(new ArrayList<>(ReadUtils.getSamplesFromHeader(header)));
if (!samplesList.asListOfSamples().contains(MTAC.tumorSampleName)) {
throw new UserException.BadInput("BAM header sample names " + samplesList.asListOfSamples() + "does not contain given tumor" + " sample name " + MTAC.tumorSampleName);
} else if (MTAC.normalSampleName != null && !samplesList.asListOfSamples().contains(MTAC.normalSampleName)) {
throw new UserException.BadInput("BAM header sample names " + samplesList.asListOfSamples() + "does not contain given normal" + " sample name " + MTAC.normalSampleName);
}
annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(MTAC.annotationGroupsToUse, MTAC.annotationsToUse, MTAC.annotationsToExclude, MTAC.dbsnp.dbsnp, MTAC.comps);
assemblyEngine = AssemblyBasedCallerUtils.createReadThreadingAssembler(MTAC);
likelihoodCalculationEngine = AssemblyBasedCallerUtils.createLikelihoodCalculationEngine(MTAC.likelihoodArgs);
genotypingEngine = new SomaticGenotypingEngine(samplesList, MTAC, MTAC.tumorSampleName, MTAC.normalSampleName);
genotypingEngine.setAnnotationEngine(annotationEngine);
haplotypeBAMWriter = AssemblyBasedCallerUtils.createBamWriter(MTAC, header);
trimmer.initialize(MTAC.assemblyRegionTrimmerArgs, header.getSequenceDictionary(), MTAC.debug, MTAC.genotypingOutputMode == GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES, false);
if (MTAC.CONTAMINATION_FRACTION_FILE != null) {
MTAC.setSampleContamination(AlleleBiasedDownsamplingUtils.loadContaminationFile(MTAC.CONTAMINATION_FRACTION_FILE, MTAC.CONTAMINATION_FRACTION, samplesList.asSetOfSamples(), logger));
}
}
Aggregations