Package org.broadinstitute.gatk.utils

Examples of org.broadinstitute.gatk.utils.GenomeLoc


        Assert.assertEquals(profile.getBandSize(), expectedBandSize, "Wrong expected band size");

        final String contig = genomeLocParser.getContigs().getSequences().get(0).getSequenceName();
        final double precedingProb = precedingIsActive ? 1.0 : 0.0;
        for ( int i = 0; i < nPrecedingSites; i++ ) {
            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, i + start);
            final ActivityProfileState state = new ActivityProfileState(loc, precedingProb);
            profile.add(state);
        }

        final GenomeLoc nextLoc = genomeLocParser.createGenomeLoc(contig, nPrecedingSites + start);
        profile.add(new ActivityProfileState(nextLoc, 1.0));

        if ( precedingIsActive == false && nPrecedingSites >= bandPassSize && bandPassSize < start ) {
            // we have enough space that all probs fall on the genome
            final double[] probs = profile.getProbabilitiesAsArray();
View Full Code Here


        // add a buffer so that we can get all of the band pass values
        final String contig = genomeLocParser.getContigs().getSequences().get(0).getSequenceName();
        int pos = start;
        int rawProbsOffset = 0;
        for ( int i = 0; i < bandPassSize; i++ ) {
            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, pos++);
            final ActivityProfileState state = new ActivityProfileState(loc, 0.0);
            profile.add(state);
            rawActiveProbs[rawProbsOffset++] = 0.0;
            rawActiveProbs[rawActiveProbs.length - rawProbsOffset] = 0.0;
        }

        for ( int i = 0; i < integrationLength; i++ ) {
            final GenomeLoc nextLoc = genomeLocParser.createGenomeLoc(contig, pos++);
            profile.add(new ActivityProfileState(nextLoc, 1.0));
            rawActiveProbs[rawProbsOffset++] = 1.0;

            for ( int j = 0; j < profile.size(); j++ ) {
                Assert.assertTrue(profile.getStateList().get(j).isActiveProb >= 0.0, "State probability < 0 at " + j);
View Full Code Here

        final BandPassActivityProfile fullProfile = new BandPassActivityProfile(genomeLocParser, null, MAX_PROB_PROPAGATION_DISTANCE, ACTIVE_PROB_THRESHOLD);
        int pos = start;
        for ( final VariantContext vc : reader.getSecond() ) {
            if ( vc == null ) continue;
            while ( pos < vc.getStart() ) {
                final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, pos);
                //logger.warn("Adding 0.0 at " + loc + " because vc.getStart is " + vc.getStart());
                incProfile.add(new ActivityProfileState(loc, 0.0));
                fullProfile.add(new ActivityProfileState(loc, 0.0));
                pos++;
            }
            if ( vc.getStart() >= start && vc.getEnd() <= end ) {
                final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, pos);
                //logger.warn("Adding 1.0 at " + loc);
                ActivityProfileState.Type type = ActivityProfileState.Type.NONE;
                Number value = null;
                if ( vc.isBiallelic() && vc.isIndel() ) {
                    type = ActivityProfileState.Type.HIGH_QUALITY_SOFT_CLIPS;
View Full Code Here

        Assert.assertEquals(profile.parser, genomeLocParser);

        for ( int i = 0; i < cfg.probs.size(); i++ ) {
            double p = cfg.probs.get(i);
            GenomeLoc loc = genomeLocParser.createGenomeLoc(cfg.regionStart.getContig(), cfg.regionStart.getStart() + i, cfg.regionStart.getStart() + i);
            profile.add(new ActivityProfileState(loc, p));
            Assert.assertFalse(profile.isEmpty(), "Profile shouldn't be empty after adding a state");
        }
        Assert.assertEquals(profile.regionStartLoc, genomeLocParser.createGenomeLoc(cfg.regionStart.getContig(), cfg.regionStart.getStart(), cfg.regionStart.getStart() ), "Start loc should be the start of the region");
View Full Code Here

        final String contig = genomeLocParser.getContigs().getSequences().get(0).getSequenceName();
        final List<Boolean> seenSites = new ArrayList<Boolean>(Collections.nCopies(probs.size(), false));
        ActiveRegion lastRegion = null;
        for ( int i = 0; i < probs.size(); i++ ) {
            final boolean isActive = probs.get(i);
            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, i + start);
            final ActivityProfileState state = new ActivityProfileState(loc, isActive ? 1.0 : 0.0);
            profile.add(state);
            Assert.assertNotNull(profile.toString());

            if ( ! waitUntilEnd ) {
View Full Code Here

        final ActivityProfile profile = new ActivityProfile(genomeLocParser, MAX_PROB_PROPAGATION_DISTANCE, ACTIVE_PROB_THRESHOLD);

        final int contigLength = genomeLocParser.getContigs().getSequences().get(0).getSequenceLength();
        final String contig = genomeLocParser.getContigs().getSequences().get(0).getSequenceName();
        for ( int i = 0; i < nPrecedingSites; i++ ) {
            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, i + start);
            final ActivityProfileState state = new ActivityProfileState(loc, 0.0);
            profile.add(state);
        }

        final GenomeLoc softClipLoc = genomeLocParser.createGenomeLoc(contig, nPrecedingSites + start);
        profile.add(new ActivityProfileState(softClipLoc, 1.0, ActivityProfileState.Type.HIGH_QUALITY_SOFT_CLIPS, softClipSize));

        final int actualNumOfSoftClips = Math.min(softClipSize, profile.getMaxProbPropagationDistance());
        if ( nPrecedingSites == 0 ) {
            final int profileSize = Math.min(start + actualNumOfSoftClips, contigLength) - start + 1;
View Full Code Here

    public void testActiveRegionCutTests(final int minRegionSize, final int maxRegionSize, final int expectedRegionSize, final List<Double> probs) {
        final ActivityProfile profile = new ActivityProfile(genomeLocParser, MAX_PROB_PROPAGATION_DISTANCE, ACTIVE_PROB_THRESHOLD);

        final String contig = genomeLocParser.getContigs().getSequences().get(0).getSequenceName();
        for ( int i = 0; i <= maxRegionSize + profile.getMaxProbPropagationDistance(); i++ ) {
            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, i + 1);
            final double prob = i < probs.size() ? probs.get(i) : 0.0;
            final ActivityProfileState state = new ActivityProfileState(loc, prob);
            profile.add(state);
        }
View Full Code Here

        private List<ActiveRegion> toRegions(boolean isActive, int[] startsAndStops) {
            List<ActiveRegion> l = new ArrayList<ActiveRegion>();
            for ( int i = 0; i < startsAndStops.length - 1; i++) {
                int start = regionStart.getStart() + startsAndStops[i];
                int end = regionStart.getStart() + startsAndStops[i+1] - 1;
                GenomeLoc activeLoc = genomeLocParser.createGenomeLoc(regionStart.getContig(), start, end);
                ActiveRegion r = new ActiveRegion(activeLoc, Collections.<ActivityProfileState>emptyList(), isActive, genomeLocParser, extension);
                l.add(r);
                isActive = ! isActive;
            }
            return l;
View Full Code Here

                                states = new LinkedList<ActivityProfileState>();
                                for ( int i = start; i < start + size; i++ ) {
                                    states.add(new ActivityProfileState(genomeLocParser.createGenomeLoc(contig, i + start), isActive ? 1.0 : 0.0));
                                }
                            }
                            final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, start, start + size - 1);
                            tests.add(new Object[]{loc, states, isActive, ext});
                        }
                    }
                }
            }
View Full Code Here

        List<Object[]> tests = new ArrayList<Object[]>();
        final SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(seq.getSequenceDictionary());
        for ( final int start : Arrays.asList(1, 10, 100, contigLength - 10, contigLength - 1) ) {
            for ( final int readStartOffset : Arrays.asList(-100, -10, 0, 10, 100) ) {
                for ( final int readSize : Arrays.asList(10, 100, 1000) ) {
                    final GenomeLoc loc = genomeLocParser.createGenomeLocOnContig(contig, start, start + 10);

                    final int readStart = Math.max(start + readStartOffset, 1);
                    final int readStop = Math.min(readStart + readSize, contigLength);
                    final int readLength = readStop - readStart + 1;
                    if ( readLength > 0 ) {
                        GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "read", 0, readStart, readLength);
                        final GenomeLoc readLoc = genomeLocParser.createGenomeLoc(read);
                        if ( readLoc.overlapsP(loc) )
                            tests.add(new Object[]{loc, read});
                    }
                }
            }
        }
View Full Code Here

TOP

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

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.