Search in sources :

Example 1 with IntervalBed

use of au.edu.wehi.idsv.bed.IntervalBed in project gridss by PapenfussLab.

the class SAMEvidenceSourceTest method should_filter_breakpoints_touching_blacklist.

@Test
public void should_filter_breakpoints_touching_blacklist() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(pc);
    IntervalBed blacklist = new IntervalBed(pc.getDictionary(), pc.getLinear());
    blacklist.addInterval(0, 10, 12);
    ses.setBlacklistedRegions(blacklist);
    assertTrue(ses.shouldFilter(NRRP(ses, DP(0, 1, "1M", true, 1, 100, "1M", false))));
    assertTrue(ses.shouldFilter(NRRP(ses, DP(1, 100, "1M", false, 0, 1, "1M", true))));
}
Also used : IntervalBed(au.edu.wehi.idsv.bed.IntervalBed) Test(org.junit.Test)

Example 2 with IntervalBed

use of au.edu.wehi.idsv.bed.IntervalBed in project gridss by PapenfussLab.

the class SAMEvidenceSourceTest method blacklist_chimeric_alignment_should_be_treated_as_unmapped.

@Test
public void blacklist_chimeric_alignment_should_be_treated_as_unmapped() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(pc);
    IntervalBed blacklist = new IntervalBed(pc.getDictionary(), pc.getLinear());
    blacklist.addInterval(0, 10, 12);
    ses.setBlacklistedRegions(blacklist);
    SAMRecord read = Read(0, 1, "1M1S");
    read.setAttribute("SA", "polyA,10,+,1S1M,10,10");
    assertEquals("", ses.transform(read).getAttribute("SA"));
}
Also used : IntervalBed(au.edu.wehi.idsv.bed.IntervalBed) SAMRecord(htsjdk.samtools.SAMRecord) Test(org.junit.Test)

Example 3 with IntervalBed

use of au.edu.wehi.idsv.bed.IntervalBed in project gridss by PapenfussLab.

the class SequentialCoverageThresholdTest method should_calculate_aligned_coverage.

@Test
public void should_calculate_aligned_coverage() {
    SequentialCoverageThreshold sct = new SequentialCoverageThreshold(getSequenceDictionary(), getContext().getLinear(), 2);
    // 1-10
    sct.acceptRecord(Read(0, 1, "10M"));
    // 2-11
    sct.acceptRecord(Read(0, 2, "1S10M5S"));
    sct.acceptRecord(Read(1, 1, "3M"));
    sct.acceptRecord(Read(1, 1, "3M"));
    sct.acceptRecord(Read(1, 1, "3M"));
    IntervalBed bed = sct.finish();
    for (int i = 0; i < 100; i++) {
        assertEquals(i >= 2 && i <= 10, bed.overlaps(0, i, i));
        assertEquals(i >= 1 && i <= 3, bed.overlaps(1, i, i));
    }
}
Also used : IntervalBed(au.edu.wehi.idsv.bed.IntervalBed) Test(org.junit.Test)

Example 4 with IntervalBed

use of au.edu.wehi.idsv.bed.IntervalBed in project gridss by PapenfussLab.

the class SAMEvidenceSourceTest method blacklisted_alignment_should_be_unmapped.

@Test
public void blacklisted_alignment_should_be_unmapped() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(pc);
    IntervalBed blacklist = new IntervalBed(pc.getDictionary(), pc.getLinear());
    blacklist.addInterval(0, 10, 12);
    ses.setBlacklistedRegions(blacklist);
    assertFalse(ses.transform(Read(1, 10, "1M")).getReadUnmappedFlag());
    assertFalse(ses.transform(Read(0, 9, "1M")).getReadUnmappedFlag());
    assertTrue(ses.transform(Read(0, 10, "1M")).getReadUnmappedFlag());
    assertTrue(ses.transform(Read(0, 11, "1M")).getReadUnmappedFlag());
    assertTrue(ses.transform(Read(0, 12, "1M")).getReadUnmappedFlag());
    assertFalse(ses.transform(Read(0, 13, "1M")).getReadUnmappedFlag());
}
Also used : IntervalBed(au.edu.wehi.idsv.bed.IntervalBed) Test(org.junit.Test)

Example 5 with IntervalBed

use of au.edu.wehi.idsv.bed.IntervalBed in project gridss by PapenfussLab.

the class SAMEvidenceSourceTest method blacklist_mate_should_be_treated_as_unmapped.

@Test
public void blacklist_mate_should_be_treated_as_unmapped() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(pc);
    IntervalBed blacklist = new IntervalBed(pc.getDictionary(), pc.getLinear());
    blacklist.addInterval(0, 10, 12);
    ses.setBlacklistedRegions(blacklist);
    assertFalse(ses.transform(DP(0, 1, "1M", true, 1, 10, "1M", false)[0]).getMateUnmappedFlag());
    assertFalse(ses.transform(DP(0, 1, "1M", true, 0, 9, "1M", false)[0]).getMateUnmappedFlag());
    assertTrue(ses.transform(DP(0, 1, "1M", true, 0, 10, "1M", false)[0]).getMateUnmappedFlag());
    assertTrue(ses.transform(DP(0, 1, "1M", true, 0, 11, "1M", false)[0]).getMateUnmappedFlag());
    assertTrue(ses.transform(DP(0, 1, "1M", true, 0, 12, "1M", false)[0]).getMateUnmappedFlag());
    assertFalse(ses.transform(DP(0, 1, "1M", true, 0, 13, "1M", false)[0]).getMateUnmappedFlag());
}
Also used : IntervalBed(au.edu.wehi.idsv.bed.IntervalBed) Test(org.junit.Test)

Aggregations

IntervalBed (au.edu.wehi.idsv.bed.IntervalBed)6 Test (org.junit.Test)5 SAMRecord (htsjdk.samtools.SAMRecord)1