Search in sources :

Example 1 with InMemoryReferenceSequenceFile

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

the class SingleReadEvidenceTest method microhomology_match_ff.

public void microhomology_match_ff() {
    // 1         2         3         4
    // 1234567890123456789012345678901234567890123456789
    // CATTAATCGCAATAAAAATGTTCTTTTTCGACGCCAAGTCAGCTGAAGCACCATTACCCGATCAAA
    // >>>>      >>>>>
    String contig = "CATTAATCGCAATAAAAATGTTCTTTTTCGACGCCAAGTCAGCTGAAGCACCATTACCCGATCAAA";
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "Contig" }, new byte[][] { B(contig) });
    SAMRecord r = new SAMRecord(new SAMFileHeader());
    r.getHeader().setSequenceDictionary(getSequenceDictionary());
    r.setReferenceIndex(0);
    r.setCigarString("4M5S");
    r.setAlignmentStart(1);
    r.setReadBases(B("ATAA" + SequenceUtil.reverseComplement("TCTTT")));
    r.setAttribute("SA", "Contig,22,-,5M4S,0,0");
    SplitReadEvidence e = (SplitReadEvidence) asAssemblyEvidence(new MockSAMEvidenceSource(getContext(ref)), r);
    assertEquals("AAAAA", e.getHomologySequence());
    assertEquals(2, e.getHomologyAnchoredBaseCount());
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) SAMRecord(htsjdk.samtools.SAMRecord) SAMFileHeader(htsjdk.samtools.SAMFileHeader)

Example 2 with InMemoryReferenceSequenceFile

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

the class SplitReadEvidenceTest method should_remove_split_reads_that_fully_align_to_either_side.

@Test
public void should_remove_split_reads_that_fully_align_to_either_side() {
    String refStr = "TAAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTCAGATGTTTCAGACATGTCTTATATACACAAGAGAATTTCATTTCTCTTT";
    String readStr = "AAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTC";
    // 1234567890123456
    // MMMMMSSSSSSSSSS
    // sssssMMMMMMMMMM
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "Contig" }, new byte[][] { B(refStr) });
    SAMRecord r = new SAMRecord(new SAMFileHeader());
    r.getHeader().setSequenceDictionary(ref.getSequenceDictionary());
    r.setReferenceIndex(0);
    r.setCigarString("97M34S");
    r.setAlignmentStart(1);
    r.setReadNegativeStrandFlag(false);
    r.setReadBases(B(readStr));
    r.setBaseQualities(B(refStr));
    SAMRecord r2 = SAMRecordUtil.realign(ref, r, 10, true);
    assertEquals(2, r2.getAlignmentStart());
    assertEquals("131M", r2.getCigarString());
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) SAMRecord(htsjdk.samtools.SAMRecord) SAMFileHeader(htsjdk.samtools.SAMFileHeader) Test(org.junit.Test)

Example 3 with InMemoryReferenceSequenceFile

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

the class BreakpointHomologyTest method no_homology.

@Test
public void no_homology() {
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCCCCCCCCCC"), B("TTTTTTTTTTTTTTTTTTTTTTTT") });
    // >
    // <
    BreakpointHomology bh = BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 6, 1, BWD, 7), "", 100, 10);
    assertEquals(0, bh.getLocalHomologyLength());
    assertEquals(0, bh.getRemoteHomologyLength());
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 4 with InMemoryReferenceSequenceFile

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

the class BreakpointHomologyTest method should_report_homology_up_to_max_distance_away.

@Test
public void should_report_homology_up_to_max_distance_away() {
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCAATGGGCCCTTTTTTTTTTTTTTTTTTT"), B("TTTAATGGGAAAGGGGGGGGGGGGGGGGGGG") });
    // >
    // <
    BreakpointHomology bh = BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 6, 1, BWD, 7), "", 1, 5);
    assertEquals(1, bh.getLocalHomologyLength());
    assertEquals(1, bh.getRemoteHomologyLength());
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 5 with InMemoryReferenceSequenceFile

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

the class BreakpointHomologyTest method should_require_exact_remote_breakpoint.

@Test(expected = IllegalArgumentException.class)
public void should_require_exact_remote_breakpoint() {
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCAATGGGCCC"), B("TTTAATGGGAAA") });
    // >
    // <
    BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 6, 6, 6, 1, BWD, 7, 7, 8), "", 100, 0);
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Aggregations

InMemoryReferenceSequenceFile (au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile)13 Test (org.junit.Test)11 BreakpointSummary (au.edu.wehi.idsv.BreakpointSummary)7 SAMFileHeader (htsjdk.samtools.SAMFileHeader)5 SAMRecord (htsjdk.samtools.SAMRecord)5 BreakendDirection (au.edu.wehi.idsv.BreakendDirection)1 TwoBitBufferedReferenceSequenceFile (au.edu.wehi.idsv.picard.TwoBitBufferedReferenceSequenceFile)1 Header (htsjdk.samtools.metrics.Header)1 Ignore (org.junit.Ignore)1