当前位置: 首页>>代码示例>>Java>>正文


Java IntervalList类代码示例

本文整理汇总了Java中htsjdk.samtools.util.IntervalList的典型用法代码示例。如果您正苦于以下问题:Java IntervalList类的具体用法?Java IntervalList怎么用?Java IntervalList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntervalList类属于htsjdk.samtools.util包,在下文中一共展示了IntervalList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SamLocusIterator

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
/**
 * Prepare to iterate through the given SAM records, skipping non-primary alignments
 *
 * @param samReader    must be coordinate sorted
 * @param intervalList Either the list of desired intervals, or null.  Note that if an intervalList is
 *                     passed in that is not coordinate sorted, it will eventually be coordinated sorted by this class.
 * @param useIndex     If true, do indexed lookup to improve performance.  Not relevant if intervalList == null.
 *                     It is no longer the case the useIndex==true can make performance worse.  It should always perform at least
 *                     as well as useIndex==false, and generally will be much faster.
 */
public SamLocusIterator(final SamReader samReader, final IntervalList intervalList, final boolean useIndex) {
    //if (samReader.getFileHeader().getSortOrder() == null || samReader.getFileHeader().getSortOrder() == SAMFileHeader.SortOrder.unsorted) {
    //   LOG.warn("SamLocusIterator constructed with samReader that has SortOrder == unsorted.  ", "" +
    //            "Assuming SAM is coordinate sorted, but exceptions may occur if it is not.");
    //} else if (samReader.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) {
    //    throw new SAMException("SamLocusIterator cannot operate on a SAM file that is not coordinate sorted.");
    //}
    this.samReader = samReader;
    this.useIndex = useIndex;
    if (intervalList != null) {
        intervals = intervalList.uniqued().getIntervals();
        this.referenceSequenceMask = new IntervalListReferenceSequenceMask(intervalList);
    } else {
        intervals = null;
        this.referenceSequenceMask = new WholeGenomeReferenceSequenceMask(samReader.getFileHeader());
    }
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:28,代码来源:SamLocusIterator.java

示例2: runNormalOnly

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
/**
 * The normal-only workflow
 */
private void runNormalOnly() {
    final BayesianHetPulldownCalculator normalHetPulldownCalculator;
    final Pulldown normalHetPulldown;

    normalHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(),
            IntervalList.fromFile(snpFile), minimumMappingQuality, minimumBaseQuality, readDepthThreshold,
            VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor,
            new BalancedHeterozygousPileupPriorModel());

    logger.info("Calculating the Het pulldown from the normal BAM file using the BALANCED prior...");
    normalHetPulldown = normalHetPulldownCalculator.getHetPulldown(normalBamFile, hetCallingStringency);

    logger.info("Writing Het pulldown from normal reads to " + normalHetOutputFile.toString());
    normalHetPulldown.write(normalHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.FULL);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:19,代码来源:GetBayesianHetCoverage.java

示例3: runTumorOnly

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
/**
 * The tumor-only workflow
 */
private void runTumorOnly() {
    final BayesianHetPulldownCalculator tumorHetPulldownCalculator;
    final Pulldown tumorHetPulldown;

    tumorHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(),
            IntervalList.fromFile(snpFile), minimumMappingQuality, minimumBaseQuality, readDepthThreshold,
            VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor,
            new HeterogeneousHeterozygousPileupPriorModel(minimumAbnormalFraction, maximumAbnormalFraction,
                    maximumCopyNumber, quadratureOrder));

    logger.info("Calculating the Het pulldown from the tumor BAM file using the HETEROGENEOUS prior...");
    tumorHetPulldown = tumorHetPulldownCalculator.getHetPulldown(tumorBamFile, hetCallingStringency);

    logger.info("Writing Het pulldown from tumor reads to " + tumorHetOutputFile.toString());
    tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.FULL);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:20,代码来源:GetBayesianHetCoverage.java

示例4: BayesianHetPulldownCalculator

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
/**
 * Constructor of {@link BayesianHetPulldownCalculator} object
 *
 * @param refFile the reference genome file
 * @param snpIntervals {@link IntervalList} of common SNPs
 * @param minMappingQuality minimum phred mapping quality
 * @param minBaseQuality minimum phred base quality
 * @param readDepthThreshold minimum read depth
 * @param validationStringency validation stringency
 * @param errorProbabilityAdjustmentFactor (experimental) multiplicative factor for read and mapping error
 *                                         probabilities
 * @param hetPrior the prior model for heterzygous pileups
 */
public BayesianHetPulldownCalculator(final File refFile, final IntervalList snpIntervals,
                                     final int minMappingQuality, final int minBaseQuality,
                                     final int readDepthThreshold, final ValidationStringency validationStringency,
                                     final double errorProbabilityAdjustmentFactor,
                                     final HeterozygousPileupPriorModel hetPrior) {
    ParamUtils.isPositiveOrZero(minMappingQuality, "Minimum mapping quality must be nonnegative.");
    ParamUtils.isPositiveOrZero(minBaseQuality, "Minimum base quality must be nonnegative.");

    this.refFile = Utils.nonNull(refFile);
    this.snpIntervals = Utils.nonNull(snpIntervals);
    this.minMappingQuality = ParamUtils.isPositive(minMappingQuality, "Minimum mapping quality must be a positive integer");
    this.minBaseQuality = ParamUtils.isPositive(minBaseQuality, "Minimum base quality must be a positive integer");
    this.readDepthThreshold = ParamUtils.isPositive(readDepthThreshold, "Read depth threshold must be a positive integer");
    this.validationStringency = Utils.nonNull(validationStringency);
    this.errorProbabilityAdjustmentFactor = ParamUtils.isPositive(errorProbabilityAdjustmentFactor,
            "Error adjustment factor must be positive.");
    this.hetPrior = Utils.nonNull(hetPrior);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:32,代码来源:BayesianHetPulldownCalculator.java

示例5: doWork

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
@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";
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:17,代码来源:CollectAllelicCounts.java

示例6: onTraversalStart

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
@Override
public void onTraversalStart() {
    ParamUtils.isPositive(scatterCount, "scatter count must be > 0.");

    if (!outputDir.exists() && !outputDir.mkdir()) {
        throw new RuntimeIOException("Unable to create directory: " + outputDir.getAbsolutePath());
    }

    // in general dictionary will be from the reference, but using -I reads.bam or -F variants.vcf
    // to use the sequence dict from a bam or vcf is also supported
    final SAMSequenceDictionary sequenceDictionary = getBestAvailableSequenceDictionary();

    final List<SimpleInterval> intervals = hasIntervals() ? intervalArgumentCollection.getIntervals(sequenceDictionary)
            : IntervalUtils.getAllIntervalsForReference(sequenceDictionary);

    final IntervalList intervalList = new IntervalList(sequenceDictionary);
    intervals.stream().map(si -> new Interval(si.getContig(), si.getStart(), si.getEnd())).forEach(intervalList::add);
    final IntervalListScatterer scatterer = new IntervalListScatterer(subdivisionMode);
    final List<IntervalList> scattered = scatterer.scatter(intervalList, scatterCount, false);

    final DecimalFormat formatter = new DecimalFormat("0000");
    IntStream.range(0, scattered.size()).forEach(n -> scattered.get(n).write(new File(outputDir, formatter.format(n) + "-scattered.intervals")));
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:24,代码来源:SplitIntervals.java

示例7: inputGetTumorHetPulldown

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
@DataProvider(name = "inputGetTumorHetPulldown")
public Object[][] inputGetTumorHetPulldown() {
    final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));

    final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
    normalHetIntervals.add(new Interval("1", 11522, 11522));
    normalHetIntervals.add(new Interval("1", 12098, 12098));
    normalHetIntervals.add(new Interval("1", 14630, 14630));
    normalHetIntervals.add(new Interval("2", 14689, 14689));
    normalHetIntervals.add(new Interval("2", 14982, 14982));

    return new Object[][]{
            {normalHetIntervals, tumorHetPulldown}
    };
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:21,代码来源:HetPulldownCalculatorUnitTest.java

示例8: RawWgsMetrics

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public RawWgsMetrics(final IntervalList intervals,
                     final Histogram<Integer> highQualityDepthHistogram,
                     final Histogram<Integer> unfilteredDepthHistogram,
                     final double pctExcludedByMapq,
                     final double pctExcludedByDupes,
                     final double pctExcludedByPairing,
                     final double pctExcludedByBaseq,
                     final double pctExcludedByOverlap,
                     final double pctExcludedByCapping,
                     final double pctTotal,
                     final int coverageCap,
                     final Histogram<Integer> unfilteredBaseQHistogram,
                     final int sampleSize) {
    super(intervals, highQualityDepthHistogram, unfilteredDepthHistogram, pctExcludedByMapq, pctExcludedByDupes, pctExcludedByPairing, pctExcludedByBaseq,
            pctExcludedByOverlap, pctExcludedByCapping, pctTotal, coverageCap, unfilteredBaseQHistogram, sampleSize);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:CollectRawWgsMetrics.java

示例9: HsMetricCollector

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public HsMetricCollector(final Set<MetricAccumulationLevel> accumulationLevels,
                         final List<SAMReadGroupRecord> samRgRecords,
                         final ReferenceSequenceFile refFile,
                         final File perTargetCoverage,
                         final File perBaseCoverage,
                         final IntervalList targetIntervals,
                         final IntervalList probeIntervals,
                         final String probeSetName,
                         final int nearProbeDistance,
                         final int minimumMappingQuality,
                         final int minimumBaseQuality,
                         final boolean clipOverlappingReads,
                         final int coverageCap,
                         final int sampleSize) {
    super(accumulationLevels, samRgRecords, refFile, perTargetCoverage, perBaseCoverage, targetIntervals, probeIntervals, probeSetName, nearProbeDistance, minimumMappingQuality, minimumBaseQuality, clipOverlappingReads, coverageCap, sampleSize);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:HsMetricCollector.java

示例10: makeOverlapDetector

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public static OverlapDetector<Interval> makeOverlapDetector(final File samFile, final SAMFileHeader header, final File ribosomalIntervalsFile, final Log log) {

        final OverlapDetector<Interval> ribosomalSequenceOverlapDetector = new OverlapDetector<Interval>(0, 0);
        if (ribosomalIntervalsFile != null) {

            final IntervalList ribosomalIntervals = IntervalList.fromFile(ribosomalIntervalsFile);
            if (ribosomalIntervals.size() == 0) {
                log.warn("The RIBOSOMAL_INTERVALS file, " + ribosomalIntervalsFile.getAbsolutePath() + " does not contain intervals");
            }
            try {
                SequenceUtil.assertSequenceDictionariesEqual(header.getSequenceDictionary(), ribosomalIntervals.getHeader().getSequenceDictionary());
            } catch (SequenceUtil.SequenceListsDifferException e) {
                throw new PicardException("Sequence dictionaries differ in " + samFile.getAbsolutePath() + " and " + ribosomalIntervalsFile.getAbsolutePath(),
                        e);
            }
            final IntervalList uniquedRibosomalIntervals = ribosomalIntervals.uniqued();
            final List<Interval> intervals = uniquedRibosomalIntervals.getIntervals();
            ribosomalSequenceOverlapDetector.addAll(intervals, intervals);
        }
        return ribosomalSequenceOverlapDetector;
    }
 
开发者ID:broadinstitute,项目名称:picard,代码行数:22,代码来源:RnaSeqMetricsCollector.java

示例11: TargetMetricsCollector

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public TargetMetricsCollector(final Set<MetricAccumulationLevel> accumulationLevels,
                              final List<SAMReadGroupRecord> samRgRecords,
                              final ReferenceSequenceFile refFile,
                              final File perTargetCoverage,
                              final File perBaseCoverage,
                              final IntervalList targetIntervals,
                              final IntervalList probeIntervals,
                              final String probeSetName,
                              final int nearProbeDistance,
                              final int minimumMappingQuality,
                              final int minimumBaseQuality,
                              final boolean clipOverlappingReads,
                              final int coverageCap,
                              final int sampleSize) {
    this(accumulationLevels, samRgRecords, refFile, perTargetCoverage, perBaseCoverage, targetIntervals, probeIntervals, probeSetName, nearProbeDistance, minimumMappingQuality, minimumBaseQuality, clipOverlappingReads, false, coverageCap, sampleSize);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:TargetMetricsCollector.java

示例12: TargetedPcrMetricsCollector

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public TargetedPcrMetricsCollector(final Set<MetricAccumulationLevel> accumulationLevels,
                                   final List<SAMReadGroupRecord> samRgRecords,
                                   final ReferenceSequenceFile refFile,
                                   final File perTargetCoverage,
                                   final File perBaseCoverage,
                                   final IntervalList targetIntervals,
                                   final IntervalList probeIntervals,
                                   final String probeSetName,
                                   final int nearProbeDistance,
                                   final int minimumMappingQuality,
                                   final int minimumBaseQuality,
                                   final boolean clipOverlappingReads,
                                   final int coverageCap,
                                   final int sampleSize) {
    super(accumulationLevels, samRgRecords, refFile, perTargetCoverage, perBaseCoverage, targetIntervals, probeIntervals, probeSetName, nearProbeDistance, minimumMappingQuality, minimumBaseQuality, clipOverlappingReads, coverageCap, sampleSize);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:TargetedPcrMetricsCollector.java

示例13: WgsMetricsWithNonZeroCoverage

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
public WgsMetricsWithNonZeroCoverage(final IntervalList intervals,
                                     final Histogram<Integer> highQualityDepthHistogram,
                                     final Histogram<Integer> unfilteredDepthHistogram,
                                     final double pctExcludedByMapq,
                                     final double pctExcludedByDupes,
                                     final double pctExcludedByPairing,
                                     final double pctExcludedByBaseq,
                                     final double pctExcludedByOverlap,
                                     final double pctExcludedByCapping,
                                     final double pctTotal,
                                     final int coverageCap,
                                     final Histogram<Integer> unfilteredBaseQHistogram,
                                     final int sampleSize) {
    super(intervals, highQualityDepthHistogram, unfilteredDepthHistogram, pctExcludedByMapq, pctExcludedByDupes, pctExcludedByPairing, pctExcludedByBaseq,
            pctExcludedByOverlap, pctExcludedByCapping, pctTotal, coverageCap, unfilteredBaseQHistogram, sampleSize);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:CollectWgsMetricsWithNonZeroCoverage.java

示例14: createSnpAndIndelBitSets

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
/** Factory method to create both a SNP bitmask and an indel bitmask in a single pass of the VCF.
 * If intervals are given, consider only SNP and indel sites that overlap the intervals.  If log is given,
 * progress loading the variants will be written to the log. */
public static DbSnpBitSets createSnpAndIndelBitSets(final File dbSnpFile,
                                                    final SAMSequenceDictionary sequenceDictionary,
                                                    final IntervalList intervals,
                                                    final Optional<Log> log) {

    final DbSnpBitSets sets = new DbSnpBitSets();
    sets.snps   = new DbSnpBitSetUtil();
    sets.indels = new DbSnpBitSetUtil();

    final Map<DbSnpBitSetUtil, Set<VariantType>> map = new HashMap<>();
    map.put(sets.snps,   EnumSet.of(VariantType.SNP));
    map.put(sets.indels, EnumSet.of(VariantType.insertion, VariantType.deletion));
    loadVcf(dbSnpFile, sequenceDictionary, map, intervals, log);
    return sets;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:19,代码来源:DbSnpBitSetUtil.java

示例15: doWork

import htsjdk.samtools.util.IntervalList; //导入依赖的package包/类
@Override
protected int doWork() {
    IOUtil.assertFileIsReadable(INPUT);
    IOUtil.assertFileIsWritable(OUTPUT);

    IntervalList intervals = IntervalList.fromFile(INPUT);
    if (SORT) intervals = intervals.sorted();

    try {
        final BufferedWriter out = IOUtil.openFileForBufferedWriting(OUTPUT);
        for (final Interval i : intervals) {
            final String strand = i.isNegativeStrand() ? "-" : "+";
            final List<?> fields = CollectionUtil.makeList(i.getContig(), i.getStart()-1, i.getEnd(), i.getName(), SCORE, strand);
            out.append(fields.stream().map(String::valueOf).collect(Collectors.joining("\t")));
            out.newLine();
        }

        out.close();
    }
    catch (IOException ioe) {
        throw new RuntimeIOException(ioe);
    }

    return 0;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:26,代码来源:IntervalListToBed.java


注:本文中的htsjdk.samtools.util.IntervalList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。