use of au.edu.wehi.idsv.VariantContextDirectedBreakpoint in project gridss by PapenfussLab.
the class VariantCallingConfigurationTest method V.
public VariantContextDirectedBreakpoint V(BreakpointSummary bs, String untemplated) {
IdsvVariantContextBuilder builder = new IdsvVariantContextBuilder(getContext());
builder.breakpoint(bs, untemplated);
return (VariantContextDirectedBreakpoint) builder.make();
}
use of au.edu.wehi.idsv.VariantContextDirectedBreakpoint in project gridss by PapenfussLab.
the class AllocateEvidenceTest method should_annotate_reads.
@Test
public void should_annotate_reads() throws IOException {
final ProcessingContext pc = getCommandlineContext();
pc.getVariantCallingParameters().minScore = 0;
pc.getVariantCallingParameters().minSize = 0;
createInput(RP(0, 1, 10), DP(0, 1, "5M5S", true, 1, 10, "5M", true), DP(0, 2, "5M5S", true, 1, 10, "5M", true));
SAMEvidenceSource ses = new SAMEvidenceSource(getContext(), input, null, 0);
ses.ensureMetrics();
File assemblyFile = new File(testFolder.getRoot(), "assembly.bam");
AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(ses), assemblyFile);
aes.assembleBreakends(null);
aes.ensureExtracted();
VariantCaller caller = new VariantCaller(pc, ImmutableList.of(ses), aes);
caller.callBreakends(output, MoreExecutors.newDirectExecutorService());
AllocateEvidence cmd = new AllocateEvidence();
cmd.INPUT_VCF = output;
cmd.setContext(pc);
cmd.setAssemblySource(aes);
cmd.setSamEvidenceSources(ImmutableList.of(ses));
cmd.OUTPUT_VCF = new File(testFolder.getRoot(), "annotated.vcf");
List<VariantContextDirectedBreakpoint> vcfs = Lists.newArrayList(Iterables.filter(getVcf(output, null), VariantContextDirectedBreakpoint.class));
// both breakends
assertEquals(2 * 1, vcfs.size());
assertSymmetrical(vcfs);
List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
assertSymmetrical(results);
assertEquals(vcfs.size(), results.size());
VariantContextDirectedBreakpoint e = results.get(0);
assertEquals(2, e.getBreakpointEvidenceCount());
assertEquals(2, e.getBreakendEvidenceCountSoftClip());
}
use of au.edu.wehi.idsv.VariantContextDirectedBreakpoint in project gridss by PapenfussLab.
the class AllocateEvidenceTest method should_apply_filters.
@Test
public void should_apply_filters() throws IOException {
final ProcessingContext pc = getCommandlineContext();
pc.getVariantCallingParameters().minScore = 0;
pc.getVariantCallingParameters().minSize = 0;
createInput(RP(0, 1, 10), DP(0, 1, "5M5S", true, 1, 10, "5M", true));
SAMEvidenceSource ses = new SAMEvidenceSource(getContext(), input, null, 0);
ses.ensureMetrics();
File assemblyFile = new File(testFolder.getRoot(), "assembly.bam");
AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(ses), assemblyFile);
aes.assembleBreakends(null);
aes.ensureExtracted();
VariantCaller caller = new VariantCaller(pc, ImmutableList.of(ses), aes);
caller.callBreakends(output, MoreExecutors.newDirectExecutorService());
AllocateEvidence cmd = new AllocateEvidence();
cmd.INPUT_VCF = output;
cmd.setContext(pc);
cmd.setAssemblySource(aes);
cmd.setSamEvidenceSources(ImmutableList.of(ses));
cmd.OUTPUT_VCF = new File(testFolder.getRoot(), "annotated.vcf");
List<VariantContextDirectedBreakpoint> vcfs = Lists.newArrayList(Iterables.filter(getVcf(output, null), VariantContextDirectedBreakpoint.class));
// both breakends
assertEquals(2 * 1, vcfs.size());
assertSymmetrical(vcfs);
List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
assertSymmetrical(results);
// single read support
assertEquals(0, results.size());
}
use of au.edu.wehi.idsv.VariantContextDirectedBreakpoint in project gridss by PapenfussLab.
the class BreakpointHomology method annotate.
public static VariantContextDirectedBreakpoint annotate(ProcessingContext context, VariantContextDirectedBreakpoint bp) {
if (!bp.isBreakendExact())
return bp;
IdsvVariantContextBuilder builder = new IdsvVariantContextBuilder(context, bp);
BreakpointHomology bh = BreakpointHomology.calculate(context.getReference(), bp.getBreakendSummary().getNominalPosition(), bp.getUntemplatedSequence(), context.getVariantCallingParameters().maxBreakendHomologyLength, context.getVariantCallingParameters().breakendHomologyAlignmentMargin);
int[] bounds;
if (bp.getBreakendSummary().direction == BreakendDirection.Forward) {
bounds = new int[] { -bh.getLocalHomologyLength(), bh.getRemoteHomologyLength() };
} else {
bounds = new int[] { -bh.getRemoteHomologyLength(), bh.getLocalHomologyLength() };
}
builder.attribute(VcfInfoAttributes.INEXACT_HOMPOS, bounds);
return (VariantContextDirectedBreakpoint) builder.make();
}
use of au.edu.wehi.idsv.VariantContextDirectedBreakpoint in project gridss by PapenfussLab.
the class BreakpointFilterTracker method isValidBreakpoint.
private boolean isValidBreakpoint(T be1, T be2) {
String be1value = "";
String be2value = "";
if (!be1.getFilters().equals(be2.getFilters())) {
be1value += " {" + be1.getFilters().toString() + "}";
be2value += " {" + be2.getFilters().toString() + "}";
}
if (!breakendsMatchs(be1, be2)) {
be1value += be1.getBreakendSummary().toString();
be2value += be2.getBreakendSummary().toString();
}
if (Math.abs(be1.getPhredScaledQual() - be2.getPhredScaledQual()) > 0.01) {
be1value += " Q:" + be1.getPhredScaledQual();
be2value += " Q:" + be2.getPhredScaledQual();
}
if (be1 instanceof VariantContextDirectedBreakpoint && be2 instanceof VariantContextDirectedBreakpoint) {
VariantContextDirectedBreakpoint bp1 = (VariantContextDirectedBreakpoint) be1;
VariantContextDirectedBreakpoint bp2 = (VariantContextDirectedBreakpoint) be2;
if (bp1.getBreakpointEvidenceCountAssembly() != bp2.getBreakpointEvidenceCountAssembly()) {
be1value += " AS:" + bp1.getBreakpointEvidenceCountLocalAssembly() + " RAS:" + bp1.getBreakpointEvidenceCountRemoteAssembly();
be2value += " AS:" + bp2.getBreakpointEvidenceCountLocalAssembly() + " RAS:" + bp2.getBreakpointEvidenceCountRemoteAssembly();
}
if (bp1.getBreakpointEvidenceCountSoftClip() != bp2.getBreakpointEvidenceCountSoftClip()) {
be1value += " SC:" + bp1.getBreakpointEvidenceCountSoftClip();
be2value += " SC:" + bp2.getBreakpointEvidenceCountSoftClip();
}
if (bp1.getBreakpointEvidenceCountReadPair() != bp2.getBreakpointEvidenceCountReadPair()) {
be1value += " RP:" + bp1.getBreakpointEvidenceCountReadPair();
be2value += " RP:" + bp2.getBreakpointEvidenceCountReadPair();
}
if (bp1.getHomologySequence().length() != bp2.getHomologySequence().length()) {
be1value += " HOMSEQ:" + bp1.getHomologySequence();
be2value += " HOMSEQ:" + bp2.getHomologySequence();
}
}
if (be1value.length() > 0) {
String msg = String.format("Breakend mismatch between %s %s and %s %s", be1.getID(), be1value, be2.getID(), be2value);
log.error(msg);
return !doAssert;
}
return true;
}
Aggregations