use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class PositionalAssemblerTest method should_assemble_simple_forward_soft_clips.
@Test
public void should_assemble_simple_forward_soft_clips() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().anchorLength = 1;
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
// 12345678901234567890
// ACGTTGGTTA
// MMMMMSSSSS
// GCAACGTTGGTTAA
// MMMMMMMMSSSSSS
input.add(SCE(FWD, withSequence("ACGTTGGTTA", Read(0, 10, "5M5S"))[0]));
input.add(SCE(FWD, withSequence("TTTTTGCAACGTTGGTTAA", Read(0, 2, "13M6S"))[0]));
input.sort(DirectedEvidenceOrder.ByStartEnd);
List<SingleReadEvidence> r = asAssemblyEvidence(aes, Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator())));
assertEquals(1, r.size());
assertEquals(new BreakendSummary(0, FWD, 14), r.get(0).getBreakendSummary());
// anchor length to match breakend length
assertEquals("AACGTT", S(r.get(0).getAnchorSequence()));
assertEquals("GGTTAA", S(r.get(0).getBreakendSequence()));
assertEquals("AACGTTGGTTAA", S(r.get(0).getSAMRecord().getReadBases()));
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class PositionalAssemblerTest method should_assemble_simple_input.
@Test
public void should_assemble_simple_input() {
ProcessingContext pc = getContext();
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
input.add(SCE(BWD, Read(0, 10, "5S5M")));
input.add(SCE(FWD, Read(0, 10, "5M5S")));
input.add(SCE(BWD, Read(0, 100, "5S5M")));
input.add(SCE(FWD, Read(0, 100, "5M5S")));
input.sort(DirectedEvidenceOrder.ByStartEnd);
ArrayList<SAMRecord> r = Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator()));
assertEquals(4, r.size());
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class PositionalAssemblerTest method rp_anchor_should_set_non_reference_bases_as_anchoring.
@Test
public void rp_anchor_should_set_non_reference_bases_as_anchoring() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().anchorLength = 1;
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
// 12345678901234567890
// ACGTTGGTTA
// MMMMMSSSSS
// GCAACGTTGGTTAA
// MMMMMMMMSSSSSS
// TTTTTGCAACGTTGGTTAA
input.add(SCE(FWD, withSequence("ACGTTGGTTA", Read(0, 10, "5M5S"))[0]));
input.add(SCE(FWD, withSequence("TTTTTGCAACGTTGGTTAA", Read(0, 2, "13M6S"))[0]));
input.add(NRRP(withSequence("TTTTTGCAACGTTGGTTAA", DP(0, 2, "13M6S", true, 1, 1, "19M", false))));
input.sort(DirectedEvidenceOrder.ByStartEnd);
List<SingleReadEvidence> r = asAssemblyEvidence(aes, Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator())));
assertEquals(2, r.size());
// race condition w.r.t which assembly returns first
assertEquals(new BreakendSummary(0, FWD, 14), r.get(0).getBreakendSummary());
// anchor length to match breakend length
assertEquals("AACGTT", S(r.get(0).getAnchorSequence()));
assertEquals("GGTTAA", S(r.get(0).getBreakendSequence()));
assertEquals("AACGTTGGTTAA", S(r.get(0).getSAMRecord().getReadBases()));
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class AnnotateVariants method writeAssemblyBreakends.
public static void writeAssemblyBreakends(File file, AssemblyEvidenceSource assemblyEvidence) throws IOException {
log.info("Writing breakend assembly support.");
File tmp = gridss.Defaults.OUTPUT_TO_TEMP_FILE ? FileSystemContext.getWorkingFileFor(file) : file;
try (BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream(tmp))) {
try (CloseableIterator<DirectedEvidence> it = assemblyEvidence.iterator()) {
while (it.hasNext()) {
SingleReadEvidence ass = (SingleReadEvidence) it.next();
if (!ass.getSAMRecord().isSecondaryOrSupplementary()) {
writer.write('>');
writer.write(ass.getEvidenceID().getBytes(StandardCharsets.US_ASCII));
writer.write('\n');
if (ass.getBreakendSummary().direction == BreakendDirection.Forward) {
writer.write(ass.getAnchorSequence(), 0, ass.getAnchorSequence().length);
writer.write(ass.getBreakendSequence(), 0, ass.getBreakendSequence().length);
} else {
writer.write(ass.getBreakendSequence(), 0, ass.getBreakendSequence().length);
writer.write(ass.getAnchorSequence(), 0, ass.getAnchorSequence().length);
}
writer.write('\n');
}
}
}
}
if (tmp != file) {
Files.move(tmp, file);
}
log.info("Writing breakend assembly support complete.");
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class AllocateEvidence method annotate.
private VariantContextDirectedBreakpoint annotate(VariantEvidenceSupport ves) {
VariantCallingConfiguration vc = getContext().getConfig().getVariantCalling();
StructuralVariationCallBuilder builder = new StructuralVariationCallBuilder(getContext(), ves.variant);
for (DirectedEvidence e : ves.support) {
boolean shouldExclude = false;
if (!shouldExclude) {
builder.addEvidence(e);
}
}
VariantContextDirectedBreakpoint bp = (VariantContextDirectedBreakpoint) builder.make();
if (!vc.writeFiltered) {
if (bp.getBreakpointQual() < vc.minScore)
return null;
if (bp.getBreakpointEvidenceCount() < vc.minReads)
return null;
if (bp.isFiltered())
return null;
}
bp = (VariantContextDirectedBreakpoint) vc.applyConfidenceFilter(getContext(), bp);
return bp;
}
Aggregations