Search in sources :

Example 6 with SoftClipEvidence

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

the class PathNodeIteratorTest method should_overlapping_adjacent_sc_rp.

@Test
public void should_overlapping_adjacent_sc_rp() {
    SoftClipEvidence sc = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
    DiscordantReadPair rp = (DiscordantReadPair) NRRP(SES(13, 200), withSequence("TCGACCTCCGGAA", DP(0, 25, "13M", true, 1, 1, "13M", false)));
    List<KmerPathNode> result = asCheckedKPN(5, 1000, sc, rp);
    assertCompleteGraph(result, 5);
    assertEquals(5, result.size());
    assertEquals(4, result.stream().mapToInt(n -> n.next().size()).sum());
    assertEquals(4, result.stream().mapToInt(n -> n.prev().size()).sum());
}
Also used : SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) Test(org.junit.Test)

Example 7 with SoftClipEvidence

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

the class ContigCallerTest method should_assemble_overlapping_sc_rp.

@Test
public void should_assemble_overlapping_sc_rp() {
    SoftClipEvidence sc = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
    DiscordantReadPair rp = (DiscordantReadPair) NRRP(SES(10, 200), withSequence("GACCTCCGGAA", DP(0, 25, "11M", true, 1, 1, "11M", false)));
    ArrayList<KmerPathNode> in = Lists.newArrayList(asKPN(4, 1000, sc, rp));
    String result = S(getCaller(in, 1000).bestContig(Integer.MAX_VALUE), 4);
    // assertEquals(3, result.size()); // SC+RP, RP starting before SC, RP starting after SC
    assertEquals("TGGTCGACCTCCGGAA", result);
// assertEquals("GACCTCCGGAA", result.get(1));
// assertEquals("GACCTCCGGAA", result.get(2));
}
Also used : SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) Test(org.junit.Test)

Example 8 with SoftClipEvidence

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

the class ContigCallerTest method should_preference_anchored_paths.

@Test
public void should_preference_anchored_paths() {
    // both sides anchored
    SoftClipEvidence spanf = SCE(FWD, withSequence("TGTTAATTGT", Read(0, 1, "4M6S")));
    SoftClipEvidence spanb = SCE(BWD, withSequence("TGTTAATTGT", Read(0, 7, "6S4M")));
    // start anchored
    SoftClipEvidence scf = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 5, "6M6S")));
    // end anchored (but less support)
    SoftClipEvidence scb = SCE(BWD, withSequence("GTCAGTC", Read(0, 5, "3S4M")));
    // unanchored
    DiscordantReadPair e = (DiscordantReadPair) NRRP(SES(20, 30), withSequence("GACCTCTACT", DP(0, 25, "10M", true, 1, 1, "10M", false)));
    String result = S(getCaller(Lists.newArrayList(asKPN(4, 100, spanf, spanb, scf, scb, e)), 100).bestContig(Integer.MAX_VALUE), 4);
    // assertEquals(4, result.size());
    // only returns the unanchored kmers
    assertEquals("GTTAATTG", result);
// assertEquals("TGGTCGACC", result.get(1));
// assertEquals("GTCAGT", result.get(2));
// assertEquals("GACCTCTACT", result.get(3));
}
Also used : SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) Test(org.junit.Test)

Example 9 with SoftClipEvidence

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

the class KmerEvidenceTest method fwd_softclip.

@Test
public void fwd_softclip() {
    SoftClipEvidence sce = SCE(FWD, withQual(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, withSequence("ACGTTATACCG", Read(0, 2, "1S4M6S"))));
    KmerEvidence e = KmerEvidence.create(4, sce);
    // int startsclength = 1;
    assertEquals(2, e.startPosition());
    assertEquals(2, e.endPosition());
    assertEquals(11 - 1 - (4 - 1), e.length());
    assertEquals(2, e.weight(0));
    assertEquals(3, e.weight(1));
    assertEquals(4, e.weight(2));
    assertEquals(5, e.weight(3));
    assertEquals(6, e.weight(4));
    assertEquals(7, e.weight(5));
    assertEquals(8, e.weight(6));
    assertEquals("CGTT", K(4, e.kmer(0)));
    assertEquals("GTTA", K(4, e.kmer(1)));
    assertEquals("TTAT", K(4, e.kmer(2)));
    assertEquals("TATA", K(4, e.kmer(3)));
    assertEquals("ATAC", K(4, e.kmer(4)));
    assertEquals("TACC", K(4, e.kmer(5)));
    assertEquals("ACCG", K(4, e.kmer(6)));
    assertTrue(e.isAnchored(0));
    assertFalse(e.isAnchored(1));
    assertFalse(e.isAnchored(2));
    assertFalse(e.isAnchored(3));
    assertFalse(e.isAnchored(4));
    assertFalse(e.isAnchored(5));
    assertFalse(e.isAnchored(6));
    assertEquals(sce.getEvidenceID(), e.evidence().getEvidenceID());
    for (int i = 0; i < e.length(); i++) {
        assertEquals(2 + i, e.node(i).lastStart());
        assertEquals(2 + i, e.node(i).lastEnd());
        assertEquals(e.isAnchored(i), e.node(i).isReference());
        assertEquals(e.kmer(i), e.node(i).lastKmer());
        assertEquals(e.weight(i), e.node(i).weight());
        assertEquals(e, e.node(i).evidence());
    }
}
Also used : SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) Test(org.junit.Test)

Example 10 with SoftClipEvidence

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

the class KmerEvidenceTest method bwd_softclip.

@Test
public void bwd_softclip() {
    SoftClipEvidence sce = SCE(BWD, withQual(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, withSequence("ACGTTATACCG", Read(0, 2, "1S4M6S"))));
    KmerEvidence e = KmerEvidence.create(4, sce);
    assertEquals(1, e.startPosition());
    assertEquals(1, e.endPosition());
    assertEquals(11 - 6 - (4 - 1), e.length());
    assertEquals(1, e.weight(0));
    assertEquals(2, e.weight(1));
    assertEquals("ACGT", K(4, e.kmer(0)));
    assertEquals("CGTT", K(4, e.kmer(1)));
    assertFalse(e.isAnchored(0));
    assertTrue(e.isAnchored(1));
    assertEquals(sce.getEvidenceID(), e.evidence().getEvidenceID());
    for (int i = 0; i < e.length(); i++) {
        assertEquals(1 + i, e.node(i).lastStart());
        assertEquals(1 + i, e.node(i).lastEnd());
        assertEquals(e.isAnchored(i), e.node(i).isReference());
        assertEquals(e.kmer(i), e.node(i).lastKmer());
        assertEquals(e.weight(i), e.node(i).weight());
        assertEquals(e, e.node(i).evidence());
    }
}
Also used : SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) Test(org.junit.Test)

Aggregations

SoftClipEvidence (au.edu.wehi.idsv.SoftClipEvidence)22 Test (org.junit.Test)22 SAMRecord (htsjdk.samtools.SAMRecord)14 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)12 DiscordantReadPair (au.edu.wehi.idsv.DiscordantReadPair)10 DirectedEvidence (au.edu.wehi.idsv.DirectedEvidence)3 IntermediateFilesTest (au.edu.wehi.idsv.IntermediateFilesTest)2 NonReferenceReadPair (au.edu.wehi.idsv.NonReferenceReadPair)2 ImmutableList (com.google.common.collect.ImmutableList)2 Lists (com.google.common.collect.Lists)2 SortOrder (htsjdk.samtools.SAMFileHeader.SortOrder)2 BufferedWriter (java.io.BufferedWriter)2 File (java.io.File)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertTrue (org.junit.Assert.assertTrue)2