use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class HashedListTargetCollectionUnitTest method testRandomLookupTargetByLocation.
@Test
public void testRandomLookupTargetByLocation() {
final Object[][] lookups = targetLookUpData();
final Random rdn = new Random(11132331);
for (int i = 0; i < 1000; i++) {
final Object[] params = lookups[rdn.nextInt(lookups.length)];
@SuppressWarnings("unchecked") final SimpleInterval query = (SimpleInterval) params[0];
@SuppressWarnings("unchecked") final SimpleInterval expected = (SimpleInterval) params[1];
final SimpleInterval observed = targetDB.target(query);
Assert.assertEquals(observed, expected);
}
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class HashedListTargetCollectionUnitTest method trimmedIntervalData.
@DataProvider(name = "trimmedIntervalData")
public Object[][] trimmedIntervalData() {
//alias to reduce clutter
final List<SimpleInterval> intervals = nonOverlappingTargetIntervals;
final String contig = intervals.get(0).getContig();
//find the last index of the first contig
int j = 0;
while (j < intervals.size() && intervals.get(j).getContig().equals(contig)) {
j++;
}
j--;
//shift of untrimmed interval ends
final int offset = minimumTargetIntergapSize / 2;
// Each data row is {untrimmed interval, epected trimmed interval
final int firstTargetStart = intervals.get(0).getStart();
final int firstTargetEnd = intervals.get(0).getEnd();
final int lastTargetEnd = intervals.get(j).getEnd();
return new Object[][] { //bracket a single target
{ new SimpleInterval(contig, firstTargetStart - offset, firstTargetEnd + offset), new SimpleInterval(contig, firstTargetStart, firstTargetEnd) }, //within a single target
{ new SimpleInterval(contig, firstTargetEnd - 1, firstTargetEnd + offset), new SimpleInterval(contig, firstTargetStart, firstTargetEnd) }, //a lot of targets
{ new SimpleInterval(contig, firstTargetStart - offset, lastTargetEnd + offset), new SimpleInterval(contig, firstTargetStart, lastTargetEnd) }, //past the last target
{ new SimpleInterval(contig, lastTargetEnd + 1, lastTargetEnd + 2), new SimpleInterval(contig, lastTargetEnd + 1, lastTargetEnd + 1) }, //a non-existant contig
{ new SimpleInterval("non-existant contig", 1, 10), new SimpleInterval("non-existant contig", 1, 1) } };
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class HashedListTargetCollectionUnitTest method targetLookUpData.
@DataProvider(name = "targetLookUpData")
public Object[][] targetLookUpData() {
final List<Object[]> result = new ArrayList<>();
for (int i = 0; i < nonOverlappingTargetIntervals.size(); i++) {
result.add(new Object[] { nonOverlappingTargetIntervals.get(i), nonOverlappingTargetIntervals.get(i), i });
}
for (int i = 0; i < nonOverlappingTargetIntervals.size(); i++) {
final SimpleInterval interval = nonOverlappingTargetIntervals.get(i);
result.add(new Object[] { new SimpleInterval(interval.getContig(), interval.getStart(), interval.getStart()), interval, i });
}
for (int i = 0; i < nonOverlappingTargetIntervals.size(); i++) {
final SimpleInterval interval = nonOverlappingTargetIntervals.get(i);
result.add(new Object[] { new SimpleInterval(interval.getContig(), interval.getEnd(), interval.getEnd()), interval, i });
}
for (int i = 1; i < nonOverlappingTargetIntervals.size(); i++) {
final SimpleInterval previous = nonOverlappingTargetIntervals.get(i - 1);
final SimpleInterval next = nonOverlappingTargetIntervals.get(i);
final SimpleInterval query = previous.getContig().equals(next.getContig()) ? TargetsToolsTestUtils.createInterval(previous.getContig(), previous.getEnd() + 1, next.getStart() - 1) : TargetsToolsTestUtils.createInterval(next.getContig(), 1, next.getStart() - 1);
result.add(new Object[] { query, null, -i - 1 });
}
return result.toArray(new Object[result.size()][]);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class GetBayesianHetCoverageIntegrationTest method testMatchedNormalTumorJob.
@Test
public void testMatchedNormalTumorJob() {
final File normalOutputFile = createTempFile("normal-test", ".tsv");
final File tumorOutputFile = createTempFile("tumor-test", ".tsv");
Pulldown tumorHetPulldownExpected, tumorHetPulldownResult;
Pulldown normalHetPulldownExpected, normalHetPulldownResult;
final String[] arguments = { "-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME, REF_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SNP_FILE_SHORT_NAME, SNP_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_BAM_FILE_SHORT_NAME, NORMAL_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_ALLELIC_COUNTS_FILE_SHORT_NAME, normalOutputFile.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_BAM_FILE_SHORT_NAME, TUMOR_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_ALLELIC_COUNTS_FILE_SHORT_NAME, tumorOutputFile.getAbsolutePath(), "-" + GetBayesianHetCoverage.READ_DEPTH_THRESHOLD_SHORT_NAME, Integer.toString(10), "-" + GetBayesianHetCoverage.HET_CALLING_STRINGENCY_SHORT_NAME, Double.toString(10.0) };
runCommandLine(arguments);
normalHetPulldownResult = new Pulldown(normalOutputFile, normalHeader);
tumorHetPulldownResult = new Pulldown(tumorOutputFile, tumorHeader);
normalHetPulldownExpected = new Pulldown(normalHeader);
normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6, Nucleotide.G, Nucleotide.T, 14, 29.29));
normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17, 39.98));
normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9, Nucleotide.T, Nucleotide.G, 15, 28.60));
normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5, Nucleotide.G, Nucleotide.C, 11, 24.99));
tumorHetPulldownExpected = new Pulldown(tumorHeader);
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6, Nucleotide.G, Nucleotide.T, 14));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9, Nucleotide.T, Nucleotide.G, 15));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5, Nucleotide.G, Nucleotide.C, 11));
Assert.assertEquals(normalHetPulldownExpected, normalHetPulldownResult);
Assert.assertEquals(tumorHetPulldownExpected, tumorHetPulldownResult);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class GetBayesianHetCoverageIntegrationTest method testTumorJob.
@Test
public void testTumorJob() {
final File tumorOutputFile = createTempFile("tumor-test", ".tsv");
Pulldown tumorHetPulldownExpected, tumorHetPulldownResult;
/* test 1: tight calling stringency */
final String[] args_1 = { "-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME, REF_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SNP_FILE_SHORT_NAME, SNP_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_BAM_FILE_SHORT_NAME, TUMOR_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_ALLELIC_COUNTS_FILE_SHORT_NAME, tumorOutputFile.getAbsolutePath(), "-" + GetBayesianHetCoverage.READ_DEPTH_THRESHOLD_SHORT_NAME, Integer.toString(10), "-" + GetBayesianHetCoverage.HET_CALLING_STRINGENCY_SHORT_NAME, Double.toString(10.0) };
runCommandLine(args_1);
tumorHetPulldownExpected = new Pulldown(tumorHeader);
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6, Nucleotide.G, Nucleotide.T, 14, 24.85));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17, 34.03));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9, Nucleotide.T, Nucleotide.G, 15, 24.23));
tumorHetPulldownResult = new Pulldown(tumorOutputFile, tumorHeader);
Assert.assertEquals(tumorHetPulldownExpected, tumorHetPulldownResult);
/* test 2: tight calling stringency */
final String[] args_2 = { "-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME, REF_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SNP_FILE_SHORT_NAME, SNP_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_BAM_FILE_SHORT_NAME, TUMOR_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_ALLELIC_COUNTS_FILE_SHORT_NAME, tumorOutputFile.getAbsolutePath(), "-" + GetBayesianHetCoverage.READ_DEPTH_THRESHOLD_SHORT_NAME, Integer.toString(10), "-" + GetBayesianHetCoverage.HET_CALLING_STRINGENCY_SHORT_NAME, Double.toString(5.0) };
runCommandLine(args_2);
tumorHetPulldownExpected = new Pulldown(tumorHeader);
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4, Nucleotide.G, Nucleotide.A, 11, 15.72));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6, Nucleotide.G, Nucleotide.T, 14, 24.85));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17, 34.03));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9, Nucleotide.T, Nucleotide.G, 15, 24.23));
tumorHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5, Nucleotide.G, Nucleotide.C, 11, 21.23));
tumorHetPulldownResult = new Pulldown(tumorOutputFile, tumorHeader);
Assert.assertEquals(tumorHetPulldownExpected, tumorHetPulldownResult);
}
Aggregations