use of htsjdk.samtools.util.IntervalList in project gatk-protected by broadinstitute.
the class HetPulldownCalculatorUnitTest method inputGetTumorHetPulldown15.
@DataProvider(name = "inputGetTumorHetPulldownMin15")
public Object[][] inputGetTumorHetPulldown15() {
final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
normalHetIntervals.add(new Interval("1", 14630, 14630));
normalHetIntervals.add(new Interval("2", 14689, 14689));
return new Object[][] { { normalHetIntervals, tumorHetPulldown } };
}
use of htsjdk.samtools.util.IntervalList in project gatk by broadinstitute.
the class CollectAllelicCounts method doWork.
@Override
protected Object doWork() {
validateArguments();
final File referenceFile = referenceArguments.getReferenceFile();
final IntervalList siteIntervals = IntervalList.fromFile(inputSiteIntervalsFile);
final AllelicCountCollector allelicCountCollector = new AllelicCountCollector(referenceFile, readValidationStringency);
logger.info("Collecting allelic counts...");
final AllelicCountCollection allelicCounts = allelicCountCollector.collect(inputBAMFile, siteIntervals, minimumMappingQuality, minimumBaseQuality);
allelicCounts.write(outputAllelicCountsFile);
logger.info("Allelic counts written to " + outputAllelicCountsFile.toString());
return "SUCCESS";
}
use of htsjdk.samtools.util.IntervalList in project gatk by broadinstitute.
the class IntervalUtils method scatterFixedIntervals.
/**
* Splits an interval list into multiple files.
* @param fileHeader The sam file header.
* @param splits Pre-divided genome locs returned by splitFixedIntervals.
* @param scatterParts The output interval lists to write to.
*/
public static void scatterFixedIntervals(final SAMFileHeader fileHeader, final List<List<GenomeLoc>> splits, final List<File> scatterParts) {
Utils.nonNull(fileHeader, "fileHeader is null");
Utils.nonNull(splits, "splits is null");
Utils.nonNull(scatterParts, "scatterParts is null");
Utils.containsNoNull(splits, "null split loc");
if (splits.size() != scatterParts.size()) {
throw new CommandLineException.BadArgumentValue("splits", String.format("Split points %d does not equal the number of scatter parts %d.", splits.size(), scatterParts.size()));
}
int fileIndex = 0;
int locIndex = 1;
for (final List<GenomeLoc> split : splits) {
final IntervalList intervalList = new IntervalList(fileHeader);
for (final GenomeLoc loc : split) {
intervalList.add(toInterval(loc, locIndex++));
}
intervalList.write(scatterParts.get(fileIndex++));
}
}
use of htsjdk.samtools.util.IntervalList in project gatk by broadinstitute.
the class HetPulldownCalculatorUnitTest method inputGetTumorHetPulldown15.
@DataProvider(name = "inputGetTumorHetPulldownMin15")
public Object[][] inputGetTumorHetPulldown15() {
final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
normalHetIntervals.add(new Interval("1", 14630, 14630));
normalHetIntervals.add(new Interval("2", 14689, 14689));
return new Object[][] { { normalHetIntervals, tumorHetPulldown } };
}
use of htsjdk.samtools.util.IntervalList in project gatk-protected by broadinstitute.
the class HetPulldownCalculatorUnitTest method inputGetPileupBaseCount.
@DataProvider(name = "inputGetPileupBaseCount")
public Object[][] inputGetPileupBaseCount() throws IOException {
try (final SamReader bamReader = SamReaderFactory.makeDefault().open(NORMAL_BAM_FILE)) {
final IntervalList intervals = new IntervalList(bamReader.getFileHeader());
intervals.add(new Interval("1", 100, 100));
intervals.add(new Interval("1", 11000, 11000));
intervals.add(new Interval("1", 14000, 14000));
intervals.add(new Interval("1", 14630, 14630));
final SamLocusIterator locusIterator = new SamLocusIterator(bamReader, intervals);
final Nucleotide.Counter baseCounts1 = makeBaseCounts(0, 0, 0, 0);
final Nucleotide.Counter baseCounts2 = makeBaseCounts(0, 9, 0, 0);
final Nucleotide.Counter baseCounts3 = makeBaseCounts(12, 0, 0, 0);
final Nucleotide.Counter baseCounts4 = makeBaseCounts(0, 0, 8, 9);
if (!locusIterator.hasNext()) {
throw new SAMException("Can't get locus to start iteration. Check that " + NORMAL_BAM_FILE.toString() + " contains 1:0-16000.");
}
final SamLocusIterator.LocusInfo locus1 = locusIterator.next();
final SamLocusIterator.LocusInfo locus2 = locusIterator.next();
final SamLocusIterator.LocusInfo locus3 = locusIterator.next();
final SamLocusIterator.LocusInfo locus4 = locusIterator.next();
locusIterator.close();
return new Object[][] { { locus1, baseCounts1 }, { locus2, baseCounts2 }, { locus3, baseCounts3 }, { locus4, baseCounts4 } };
}
}
Aggregations