Search in sources :

Example 26 with GATKRead

use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.

the class ReadFilterLibraryUnitTest method failsNOT_DUPLICATE.

@Test
public void failsNOT_DUPLICATE() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead read = simpleGoodRead(header);
    read.setIsDuplicate(true);
    Assert.assertFalse(NOT_DUPLICATE.test(read), read.toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 27 with GATKRead

use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.

the class ReadFilterLibraryUnitTest method testGoodCigars.

@Test(dataProvider = "goodCigars")
public void testGoodCigars(String cigarString) {
    GATKRead read = ReadClipperTestUtils.makeReadFromCigar(cigarString);
    Assert.assertTrue(GOOD_CIGAR.test(read), read.getCigar().toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 28 with GATKRead

use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.

the class ReadFilterLibraryUnitTest method simpleGoodRead.

private GATKRead simpleGoodRead(final SAMFileHeader header) {
    final String cigarString = "101M";
    final Cigar cigar = TextCigarCodec.decode(cigarString);
    GATKRead read = createRead(header, cigar, 1, 0, 10);
    read.setMappingQuality(50);
    return read;
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead)

Example 29 with GATKRead

use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.

the class ReadFilterLibraryUnitTest method createRead.

/**
     * Creates a read record.
     *
     * @param header header for the new record
     * @param cigar the new record CIGAR.
     * @param group the new record group index that must be in the range \
     *              [0,{@link #GROUP_COUNT})
     * @param reference the reference sequence index (0-based)
     * @param start the start position of the read alignment in the reference
     *              (1-based)
     * @return never <code>null</code>
     */
private GATKRead createRead(final SAMFileHeader header, final Cigar cigar, final int group, final int reference, final int start) {
    final GATKRead record = ArtificialReadUtils.createArtificialRead(header, cigar);
    record.setPosition(header.getSequence(reference).getSequenceName(), start);
    record.setReadGroup(header.getReadGroups().get(group).getReadGroupId());
    return record;
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead)

Example 30 with GATKRead

use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.

the class ReadFilterLibraryUnitTest method testProperlyPairedReadFilter.

@Test
public void testProperlyPairedReadFilter() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead read = simpleGoodRead(header);
    Assert.assertFalse(PROPERLY_PAIRED.test(read), "PROPERLY_PAIRED " + read.toString());
    read.setIsPaired(true);
    read.setIsProperlyPaired(true);
    Assert.assertTrue(PROPERLY_PAIRED.test(read), "PROPERLY_PAIRED " + read.toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Aggregations

GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)457 Test (org.testng.annotations.Test)286 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)163 SAMFileHeader (htsjdk.samtools.SAMFileHeader)87 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)59 JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)40 ArrayList (java.util.ArrayList)34 Collectors (java.util.stream.Collectors)34 List (java.util.List)30 Cigar (htsjdk.samtools.Cigar)29 File (java.io.File)28 java.util (java.util)28 DataProvider (org.testng.annotations.DataProvider)28 JavaRDD (org.apache.spark.api.java.JavaRDD)26 Haplotype (org.broadinstitute.hellbender.utils.haplotype.Haplotype)26 Assert (org.testng.Assert)25 ReadPileup (org.broadinstitute.hellbender.utils.pileup.ReadPileup)24 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)22 Argument (org.broadinstitute.barclay.argparser.Argument)18 UserException (org.broadinstitute.hellbender.exceptions.UserException)18