use of org.broadinstitute.hellbender.tools.walkers.validation.MixingFraction in project gatk-protected by broadinstitute.
the class MixingFractionUnitTest method testMixingfraction.
@Test
public void testMixingfraction() {
final String sample = "SAMPLE";
final double fraction = 0.15;
final MixingFraction mixingFraction = new MixingFraction(sample, fraction);
Assert.assertEquals(mixingFraction.getSample(), sample);
Assert.assertEquals(mixingFraction.getMixingFraction(), fraction);
}
use of org.broadinstitute.hellbender.tools.walkers.validation.MixingFraction in project gatk-protected by broadinstitute.
the class MixingFractionUnitTest method testIO.
@Test
public void testIO() throws IOException {
Utils.resetRandomGenerator();
final File file = File.createTempFile("mixing_fractions", ".table");
final String sample1 = "SAMPLE1";
final double fraction1 = 0.15;
final String sample2 = "SAMPLE2";
final double fraction2 = 0.17;
final List<MixingFraction> original = Arrays.asList(new MixingFraction(sample1, fraction1), new MixingFraction(sample2, fraction2));
MixingFraction.writeMixingFractions(original, file);
final List<MixingFraction> copy = MixingFraction.readMixingFractions(file);
Assert.assertEquals(original.size(), copy.size());
new IndexRange(0, original.size()).forEach(n -> {
Assert.assertEquals(original.get(n).getSample(), copy.get(n).getSample());
Assert.assertEquals(original.get(n).getMixingFraction(), copy.get(n).getMixingFraction());
});
}
use of org.broadinstitute.hellbender.tools.walkers.validation.MixingFraction in project gatk by broadinstitute.
the class CalculateMixingFractionsIntegrationTest method test.
/**
* The DREAM challenge 4th sample simulates a tumor with subclonal populations of 50% and 35%. We pretend
* here that it is actually a mixture of two samples, and we doctored the corresponding such that every variant with allele fraction
* of roughly 50%/2 = 25% is a het from one sample and every variant with allele fraction roughly 35%/2 is a het from the other
* sample. Therefore, the unnormalized mixing fractions should come out to about 0.5 and 0.35, and the normalized fractions
* should be roughly 0.59 and 0.41.
*
* However, when you actually check in IGV, variants cluster into allele fractions of roughly 10% and roughly 25%, which yields
* normalized mixing fractions of about 30% and 70%, as we in fact obtain.
*/
@Test
public void test() {
final File outputTable = createTempFile("mixing", ".table");
final String[] arguments = { "-" + StandardArgumentDefinitions.VARIANT_SHORT_NAME, INPUT_VCF.getAbsolutePath(), "-" + StandardArgumentDefinitions.INPUT_SHORT_NAME, INPUT_BAM.getAbsolutePath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputTable.getAbsolutePath() };
runCommandLine(arguments);
final List<MixingFraction> mixing = MixingFraction.readMixingFractions(outputTable);
final Map<String, Double> result = mixing.stream().collect(Collectors.toMap(MixingFraction::getSample, MixingFraction::getMixingFraction));
Assert.assertEquals(result.get("SAMPLE1"), 0.31, 0.02);
Assert.assertEquals(result.get("SAMPLE2"), 0.69, 0.02);
}
Aggregations