Package org.broadinstitute.gatk.utils

Examples of org.broadinstitute.gatk.utils.GenomeLocSortedSet


        }
    }

    @Test(enabled = true && !DEBUG, dataProvider = "TraversalEngineProvider")
    public void testPrimaryReadMapping(TraverseActiveRegions t) {
        DummyActiveRegionWalker walker = new DummyActiveRegionWalker(new GenomeLocSortedSet(genomeLocParser, intervals),
                EnumSet.of(ActiveRegionReadState.PRIMARY),
                true);

        // Contract: Each read has the Primary state in a single region (or none)
        // This is the region of maximum overlap for the read (earlier if tied)
View Full Code Here


        verifyReadMapping(region, "simple20");
    }

    @Test(enabled = true && ! DEBUG, dataProvider = "TraversalEngineProvider")
    public void testNonPrimaryReadMapping(TraverseActiveRegions t) {
        DummyActiveRegionWalker walker = new DummyActiveRegionWalker(new GenomeLocSortedSet(genomeLocParser, intervals),
                EnumSet.of(ActiveRegionReadState.PRIMARY, ActiveRegionReadState.NONPRIMARY),
                true);

        // Contract: Each read has the Primary state in a single region (or none)
        // This is the region of maximum overlap for the read (earlier if tied)
View Full Code Here

        verifyReadMapping(region, "simple20");
    }

    @Test(enabled = true && ! DEBUG, dataProvider = "TraversalEngineProvider")
    public void testExtendedReadMapping(TraverseActiveRegions t) {
        DummyActiveRegionWalker walker = new DummyActiveRegionWalker(new GenomeLocSortedSet(genomeLocParser, intervals),
                EnumSet.of(ActiveRegionReadState.PRIMARY, ActiveRegionReadState.NONPRIMARY, ActiveRegionReadState.EXTENDED),
                true);

        // Contract: Each read has the Primary state in a single region (or none)
        // This is the region of maximum overlap for the read (earlier if tied)
View Full Code Here

        engine.setReadsDataSource(dataSource);
        final Set<String> samples = SampleUtils.getSAMFileSamples(dataSource.getHeader());

        traverseActiveRegions.initialize(engine, walker);
        List<LocusShardDataProvider> providers = new ArrayList<LocusShardDataProvider>();
        for (Shard shard : dataSource.createShardIteratorOverIntervals(new GenomeLocSortedSet(genomeLocParser, intervals), new ActiveRegionShardBalancer())) {
            for (WindowMaker.WindowMakerIterator window : new WindowMaker(shard, genomeLocParser, dataSource.seek(shard), shard.getGenomeLocs(), samples)) {
                providers.add(new LocusShardDataProvider(shard, shard.getReadProperties(), genomeLocParser, window.getLocus(), window, reference, new ArrayList<ReferenceOrderedDataSource>()));
            }
        }
View Full Code Here

                activeRegions.add(makeActiveRegionMask(start, stop, stepSize,  startWithActive));
            }
        }

        // active region is the whole interval
        activeRegions.add(new GenomeLocSortedSet(genomeLocParser, genomeLocParser.createGenomeLoc("1", start, stop)));

        // active region extends up to the end of the data, but doesn't include start
        activeRegions.add(new GenomeLocSortedSet(genomeLocParser, genomeLocParser.createGenomeLoc("1", start+10, stop)));

        return activeRegions;
    }
View Full Code Here

        return activeRegions;
    }

    private GenomeLocSortedSet makeActiveRegionMask(final int start, final int stop, final int stepSize, final boolean startWithActive) {
        final GenomeLocSortedSet active = new GenomeLocSortedSet(genomeLocParser);

        boolean includeRegion = startWithActive;
        for ( int left = start; left < stop; left += stepSize) {
            final int right = left + stepSize;
            final GenomeLoc region = genomeLocParser.createGenomeLoc("1", left, right);
            if ( includeRegion )
                active.add(region);
            includeRegion = ! includeRegion;
        }

        return active;
    }
View Full Code Here

        allI.setCigarString(readLength + "I");
        allI.setReadGroup(new GATKSAMReadGroupRecord(bamBuilder.getHeader().getReadGroups().get(0)));

        bamBuilder.addReads(allI);

        final GenomeLocSortedSet activeRegions = new GenomeLocSortedSet(bamBuilder.getGenomeLocParser());
        activeRegions.add(bamBuilder.getGenomeLocParser().createGenomeLoc("1", 10, 30));
        final List<GenomeLoc> intervals = Arrays.asList(
                genomeLocParser.createGenomeLoc("1", bamBuilder.getAlignmentStart(), bamBuilder.getAlignmentEnd())
        );

        final DummyActiveRegionWalker walker = new DummyActiveRegionWalker(activeRegions, false);
View Full Code Here

            final List<IntervalBinding<Feature>> excludeIntervals) {

        Pair<GenomeLocSortedSet, GenomeLocSortedSet> includeExcludePair = parseIntervalBindingsPair(
                referenceDataSource, intervals, intervalSetRule, intervalMergingRule, intervalPadding, excludeIntervals);

        GenomeLocSortedSet includeSortedSet = includeExcludePair.getFirst();
        GenomeLocSortedSet excludeSortedSet = includeExcludePair.getSecond();

        if (excludeSortedSet != null) {
            return includeSortedSet.subtractRegions(excludeSortedSet);
        } else {
            return includeSortedSet;
View Full Code Here

            return includeSortedSet;
        }
    }

    public static GenomeLocSortedSet parseIntervalArguments(final ReferenceDataSource referenceDataSource, IntervalArgumentCollection argCollection) {
        GenomeLocSortedSet intervals = null;

        // return if no interval arguments at all
        if ( argCollection.intervals == null && argCollection.excludeIntervals == null )
            return intervals;

        // Note that the use of '-L all' is no longer supported.

        // if include argument isn't given, create new set of all possible intervals

        final Pair<GenomeLocSortedSet, GenomeLocSortedSet> includeExcludePair = IntervalUtils.parseIntervalBindingsPair(
                referenceDataSource,
                argCollection.intervals,
                argCollection.intervalSetRule, argCollection.intervalMerging, argCollection.intervalPadding,
                argCollection.excludeIntervals);

        final GenomeLocSortedSet includeSortedSet = includeExcludePair.getFirst();
        final GenomeLocSortedSet excludeSortedSet = includeExcludePair.getSecond();

        // if no exclude arguments, can return parseIntervalArguments directly
        if ( excludeSortedSet == null )
            intervals = includeSortedSet;

            // otherwise there are exclude arguments => must merge include and exclude GenomeLocSortedSets
        else {
            intervals = includeSortedSet.subtractRegions(excludeSortedSet);

            // logging messages only printed when exclude (-XL) arguments are given
            final long toPruneSize = includeSortedSet.coveredSize();
            final long toExcludeSize = excludeSortedSet.coveredSize();
            final long intervalSize = intervals.coveredSize();
            logger.info(String.format("Initial include intervals span %d loci; exclude intervals span %d loci", toPruneSize, toExcludeSize));
            logger.info(String.format("Excluding %d loci from original intervals (%.2f%% reduction)",
                    toPruneSize - intervalSize, (toPruneSize - intervalSize) / (0.01 * toPruneSize)));
        }
View Full Code Here

            final IntervalSetRule intervalSetRule, final IntervalMergingRule intervalMergingRule, final int intervalPadding,
            final List<IntervalBinding<Feature>> excludeIntervals) {
        GenomeLocParser genomeLocParser = new GenomeLocParser(referenceDataSource.getReference());

        // if include argument isn't given, create new set of all possible intervals
        GenomeLocSortedSet includeSortedSet = ((intervals == null || intervals.size() == 0) ?
                GenomeLocSortedSet.createSetFromSequenceDictionary(referenceDataSource.getReference().getSequenceDictionary()) :
                loadIntervals(intervals, intervalSetRule, intervalMergingRule, intervalPadding, genomeLocParser));

        GenomeLocSortedSet excludeSortedSet = null;
        if (excludeIntervals != null && excludeIntervals.size() > 0) {
            excludeSortedSet = loadIntervals(excludeIntervals, IntervalSetRule.UNION, intervalMergingRule, 0, genomeLocParser);
        }
        return new Pair<GenomeLocSortedSet, GenomeLocSortedSet>(includeSortedSet, excludeSortedSet);
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.GenomeLocSortedSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.