Package org.broadinstitute.gatk.engine.iterators

Examples of org.broadinstitute.gatk.engine.iterators.GATKSAMIterator


            mergedReadStream = new ArtificialMultiSampleReadStream(perSampleArtificialReadStreams.values());
        }

        public void run() {
            GATKSAMIterator downsamplingIter = new PerSampleDownsamplingReadsIterator(mergedReadStream.getGATKSAMIterator(), downsamplerFactory);

            if ( verifySortedness ) {
                downsamplingIter = new VerifyingSamIterator(downsamplingIter);
            }

            while ( downsamplingIter.hasNext() ) {
                SAMRecord read = downsamplingIter.next();
                String sampleName = read.getReadGroup() != null ? read.getReadGroup().getSample() : null;

                ArtificialSingleSampleReadStreamAnalyzer analyzer = perSampleStreamAnalyzers.get(sampleName);
                if ( analyzer != null ) {
                    analyzer.update(read);
View Full Code Here


                count++;

                GenomeLoc firstLocus = sh.getGenomeLocs().get(0), lastLocus = sh.getGenomeLocs().get(sh.getGenomeLocs().size()-1);
                logger.debug("Start : " + firstLocus.getStart() + " stop : " + lastLocus.getStop() + " contig " + firstLocus.getContig());
                logger.debug("count = " + count);
                GATKSAMIterator datum = data.seek(sh);

                // for the first couple of shards make sure we can see the reads
                if (count < 5) {
                    for (SAMRecord r : datum) {
                    }
                    readCount++;
                }
                datum.close();

                // if we're over 100 shards, break out
                if (count > 100) {
                    break;
                }
View Full Code Here

public class ArtificialSAMUtilsUnitTest extends BaseTest {


    @Test
    public void basicReadIteratorTest() {
        GATKSAMIterator iter = ArtificialSAMUtils.mappedReadIterator(1, 100, 100);
        int count = 0;
        while (iter.hasNext()) {
            SAMRecord rec = iter.next();
            count++;
        }
        assertEquals(count, 100 * 100);
    }
View Full Code Here

        assertEquals(count, 100 * 100);
    }

    @Test
    public void tenPerChromosome() {
        GATKSAMIterator iter = ArtificialSAMUtils.mappedReadIterator(1, 100, 10);
        int count = 0;
        while (iter.hasNext()) {
            SAMRecord rec = iter.next();

            assertEquals(Integer.valueOf(Math.round(count / 10)), rec.getReferenceIndex());
            count++;
        }
        assertEquals(count, 100 * 10);
 
View Full Code Here

        assertEquals(count, 100 * 10);
    }

    @Test
    public void onePerChromosome() {
        GATKSAMIterator iter = ArtificialSAMUtils.mappedReadIterator(1, 100, 1);
        int count = 0;
        while (iter.hasNext()) {
            SAMRecord rec = iter.next();

            assertEquals(Integer.valueOf(count), rec.getReferenceIndex());
            count++;
        }
        assertEquals(count, 100 * 1);
 
View Full Code Here

        assertEquals(count, 100 * 1);
    }

    @Test
    public void basicUnmappedIteratorTest() {
        GATKSAMIterator iter = ArtificialSAMUtils.mappedAndUnmappedReadIterator(1, 100, 100, 1000);
        int count = 0;
        for (int x = 0; x < (100* 100); x++ ) {
            if (!iter.hasNext()) {
                fail ("we didn't get the expected number of reads");
            }
            SAMRecord rec = iter.next();
            assertTrue(rec.getReferenceIndex() >= 0);
            count++;
        }
        assertEquals(100 * 100, count);

        // now we should have 1000 unmapped reads
        count = 0;
        while (iter.hasNext()) {
            SAMRecord rec = iter.next();
            assertTrue(rec.getReferenceIndex() < 0);
            count++;
        }
        assertEquals(count, 1000);
    }
View Full Code Here

     * @param reads the reads
     * @return iterator for the reads
     */
    public static GATKSAMIterator createReadIterator(List<SAMRecord> reads) {
        final Iterator<SAMRecord> iter = reads.iterator();
        return new GATKSAMIterator() {
            @Override public void close() {}
            @Override public Iterator<SAMRecord> iterator() { return iter; }
            @Override public boolean hasNext() { return iter.hasNext(); }
            @Override public SAMRecord next() { return iter.next(); }
            @Override public void remove() { iter.remove(); }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.engine.iterators.GATKSAMIterator

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.