Search in sources :

Example 36 with GATKRead

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

the class ReadFilterLibraryUnitTest method VALID_ALIGNMENT_START_allows_unmapped_case1.

@Test
public void VALID_ALIGNMENT_START_allows_unmapped_case1() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead read = simpleGoodRead(header);
    read.setIsUnmapped();
    Assert.assertTrue(VALID_ALIGNMENT_START.test(read), "VALID_ALIGNMENT_START failed on an unmapped read");
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 37 with GATKRead

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

the class ReadFilterLibraryUnitTest method testReadCigarLengthMismatch.

@Test
public void testReadCigarLengthMismatch() {
    GATKRead read = ReadClipperTestUtils.makeReadFromCigar("4M", 1);
    Assert.assertFalse(READLENGTH_EQUALS_CIGARLENGTH.test(read), read.getCigar().toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 38 with GATKRead

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

the class ReadFilterLibraryUnitTest method testLibraryReadFilter.

@Test
public void testLibraryReadFilter() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead read = simpleGoodRead(header);
    final LibraryReadFilter f = new LibraryReadFilter(header);
    final String foo = "Foo";
    header.getReadGroup(read.getReadGroup()).setLibrary(foo);
    //fail
    Assert.assertFalse(f.test(read), read.toString());
    f.libraryToKeep = foo;
    //pass
    Assert.assertTrue(f.test(read), read.toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 39 with GATKRead

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

the class ReadFilterLibraryUnitTest method testReadStrandFilter.

@Test
public void testReadStrandFilter() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead read = simpleGoodRead(header);
    ReadStrandFilter f = new ReadStrandFilter();
    f.keepOnlyReverse = false;
    read.setIsReverseStrand(false);
    //pass
    Assert.assertTrue(f.test(read), read.toString());
    read.setIsReverseStrand(true);
    //fail
    Assert.assertFalse(f.test(read), read.toString());
    f.keepOnlyReverse = true;
    read.setIsReverseStrand(false);
    //fail
    Assert.assertFalse(f.test(read), read.toString());
    read.setIsReverseStrand(true);
    //pass
    Assert.assertTrue(f.test(read), read.toString());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Test(org.testng.annotations.Test)

Example 40 with GATKRead

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

the class ReadFilterLibraryUnitTest method testMaxInsertSizeFilter.

@Test
public void testMaxInsertSizeFilter() {
    final SAMFileHeader header = createHeaderWithReadGroups();
    final GATKRead pairedRead = simpleGoodRead(header);
    final GATKRead unpairedRead = simpleGoodRead(header);
    pairedRead.setIsPaired(true);
    final FragmentLengthReadFilter f = new FragmentLengthReadFilter();
    pairedRead.setFragmentLength(150);
    unpairedRead.setFragmentLength(150);
    f.maxFragmentLength = 180;
    //pass
    Assert.assertTrue(f.test(pairedRead), pairedRead.toString());
    //pass
    Assert.assertTrue(f.test(unpairedRead), pairedRead.toString());
    f.maxFragmentLength = 90;
    //fail
    Assert.assertFalse(f.test(pairedRead), pairedRead.toString());
    //pass
    Assert.assertTrue(f.test(unpairedRead), pairedRead.toString());
    pairedRead.setFragmentLength(-150);
    f.maxFragmentLength = 180;
    //pass
    Assert.assertTrue(f.test(pairedRead), pairedRead.toString());
    //pass
    Assert.assertTrue(f.test(unpairedRead), pairedRead.toString());
    f.maxFragmentLength = 90;
    //fail
    Assert.assertFalse(f.test(pairedRead), pairedRead.toString());
    //pass
    Assert.assertTrue(f.test(unpairedRead), pairedRead.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