use of au.edu.wehi.idsv.sam.ChimericAlignment in project gridss by PapenfussLab.
the class TestHelper method Read.
public static SAMRecord Read(String chimericAlignment) {
ChimericAlignment ca = new ChimericAlignment(chimericAlignment);
SAMRecord record = new SAMRecord(getHeader());
record.setReferenceIndex(record.getHeader().getSequenceIndex(ca.rname));
record.setAlignmentStart(ca.pos);
record.setReadUnmappedFlag(false);
record.setReadPairedFlag(false);
record.setReadNegativeStrandFlag(ca.isNegativeStrand);
record.setCigar(ca.cigar);
record.setMappingQuality(ca.mapq);
record.setReadName(chimericAlignment);
clean(record);
return record;
}
use of au.edu.wehi.idsv.sam.ChimericAlignment in project gridss by PapenfussLab.
the class SplitReadEvidenceTest method should_handle_multiple_overlapping_fragments.
@Test
public void should_handle_multiple_overlapping_fragments() {
SAMRecord r1 = Read(0, 100, "48M52S");
SAMRecord r2 = Read(0, 100, "32S48M20S");
SAMRecord r3 = Read(0, 100, "64S36M");
r1.setReadName("R");
r2.setReadName("R");
r3.setReadName("R");
r1.setAttribute("SA", new ChimericAlignment(r2).toString() + ";" + new ChimericAlignment(r3).toString());
r2.setAttribute("SA", new ChimericAlignment(r1).toString() + ";" + new ChimericAlignment(r3).toString());
r3.setAttribute("SA", new ChimericAlignment(r1).toString() + ";" + new ChimericAlignment(r2).toString());
List<SplitReadEvidence> e1 = SplitReadEvidence.create(SES(), r1);
List<SplitReadEvidence> e2 = SplitReadEvidence.create(SES(), r2);
List<SplitReadEvidence> e3 = SplitReadEvidence.create(SES(), r3);
Assert.assertEquals(1, e1.size());
Assert.assertEquals(2, e2.size());
Assert.assertEquals(1, e3.size());
Assert.assertEquals(e1.get(0).getEvidenceID(), e2.get(0).getRemoteEvidenceID());
Assert.assertEquals(e2.get(0).getEvidenceID(), e1.get(0).getRemoteEvidenceID());
Assert.assertEquals(e2.get(1).getEvidenceID(), e3.get(0).getRemoteEvidenceID());
Assert.assertEquals(e3.get(0).getEvidenceID(), e2.get(1).getRemoteEvidenceID());
}
use of au.edu.wehi.idsv.sam.ChimericAlignment in project gridss by PapenfussLab.
the class SplitReadEvidenceTest method overaligned_breakpoints_should_be_symmetrical.
@Test
public void overaligned_breakpoints_should_be_symmetrical() {
// 12345
// MMMM
// MMM
// overlap = 2
SAMRecord r1 = withSequence("NNNNN", Read(0, 100, "4M1S"))[0];
SAMRecord r2 = withSequence("NNNNN", Read(0, 200, "2S3M"))[0];
r1.setAttribute("SA", new ChimericAlignment(r2).toString());
r2.setAttribute("SA", new ChimericAlignment(r1).toString());
SplitReadEvidence e1 = (SplitReadEvidence) SingleReadEvidence.createEvidence(SES(), 0, r1).get(0);
SplitReadEvidence e2 = (SplitReadEvidence) SingleReadEvidence.createEvidence(SES(), 0, r2).get(0);
Assert.assertEquals(2, e2.getBreakendSummary().end - e2.getBreakendSummary().start);
Assert.assertEquals(2, e1.getBreakendSummary().end - e1.getBreakendSummary().start);
Assert.assertEquals(e1.getBreakendSummary(), e2.getBreakendSummary().remoteBreakpoint());
Assert.assertEquals(e2.getBreakendSummary(), e1.getBreakendSummary().remoteBreakpoint());
}
use of au.edu.wehi.idsv.sam.ChimericAlignment in project gridss by PapenfussLab.
the class SplitReadEvidenceTest method isReference_should_require_entire_aligned_region_to_match.
@Test
public void isReference_should_require_entire_aligned_region_to_match() {
SAMRecord r1 = withSequence("TAAATAAA", Read(0, 10, "3M5S"))[0];
SAMRecord r2 = withSequence("TAAATAAA", Read(0, 20, "3S2M3S"))[0];
r1.setAttribute("SA", new ChimericAlignment(r2).toString());
r2.setAttribute("SA", new ChimericAlignment(r1).toString());
SplitReadEvidence e1 = SplitReadEvidence.create(SES(), r1).get(0);
SplitReadEvidence e2 = SplitReadEvidence.create(SES(), r2).get(0);
Assert.assertFalse(e2.isReference());
Assert.assertFalse(e1.isReference());
}
use of au.edu.wehi.idsv.sam.ChimericAlignment in project gridss by PapenfussLab.
the class SplitReadEvidenceTest method score_should_be_symmetrical_even_if_anchors_overlap.
@Test
public void score_should_be_symmetrical_even_if_anchors_overlap() {
SAMRecord primary = Read(0, 100, "6M4S");
primary.setReadBases(B("NNNNNNNNNN"));
primary.setBaseQualities(B("1234567890"));
primary.setMappingQuality(40);
SAMRecord supp = Read(0, 200, "3S7M");
supp.setSupplementaryAlignmentFlag(true);
supp.setReadBases(B("NNNNNNNNNN"));
supp.setBaseQualities(B("1234567890"));
supp.setMappingQuality(20);
primary.setAttribute("SA", new ChimericAlignment(supp).toString());
supp.setAttribute("SA", new ChimericAlignment(primary).toString());
StubSAMEvidenceSource ses = new StubSAMEvidenceSource(getContext(), null, 0, 0, 100);
SplitReadEvidence ep = SplitReadEvidence.create(ses, primary).get(0);
SplitReadEvidence es = SplitReadEvidence.create(ses, supp).get(0);
assertEquals(ep.getBreakpointQual(), es.getBreakpointQual(), 0);
}
Aggregations