Search in sources :

Example 1 with DirectedBreakpoint

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

the class PairedEvidenceTracker method allMatched.

private boolean allMatched() {
    List<DirectedBreakpoint> list = new ArrayList<>(unpaired.values());
    list.sort(DirectedBreakpoint.ByStartEnd);
    for (DirectedBreakpoint e : list) {
        ProcessingContext context = e.getEvidenceSource().getContext();
        if (!MessageThrottler.Current.shouldSupress(log, "unpaired evidence")) {
            log.error(String.format("%s (%s, %f) unpaired", e.getEvidenceID(), e.getBreakendSummary().toString(context), e.getBreakpointQual()));
        }
    }
    return unpaired.isEmpty();
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) ArrayList(java.util.ArrayList) DirectedBreakpoint(au.edu.wehi.idsv.DirectedBreakpoint)

Example 2 with DirectedBreakpoint

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

the class PairedEvidenceTracker method isValidNext.

private boolean isValidNext(T evidence) {
    if (evidence instanceof DirectedBreakpoint) {
        DirectedBreakpoint e = (DirectedBreakpoint) evidence;
        ProcessingContext context = e.getEvidenceSource().getContext();
        String evidenceId = evidence.getEvidenceID();
        String partnerId = e.getRemoteEvidenceID();
        if (unpaired.containsKey(evidenceId)) {
            String msg = String.format("%s: encountered %s multiple times.", name, evidenceId);
            if (!MessageThrottler.Current.shouldSupress(log, "duplicate evidence")) {
                log.error(msg);
            }
            return false;
        }
        if (unpaired.containsKey(partnerId)) {
            DirectedBreakpoint partner = unpaired.remove(partnerId);
            // Breakpoints must be the same
            if (!partner.getBreakendSummary().remoteBreakpoint().equals(e.getBreakendSummary())) {
                String msg = String.format("%s: breakpoints %s and %s differ for evidence pair %s %s", name, e.getBreakendSummary().toString(context), partner.getBreakendSummary().toString(context), e.getEvidenceID(), partner.getEvidenceID());
                if (!MessageThrottler.Current.shouldSupress(log, "asymetric evidence breakpoint positions")) {
                    log.error(msg);
                }
                return false;
            }
            // Scores must be the same
            if (partner.getBreakpointQual() != e.getBreakpointQual()) {
                String msg = String.format("%s: scores %f and %f differ for evidence pair %s %s", name, e.getBreakpointQual(), partner.getBreakpointQual(), e.getEvidenceID(), partner.getEvidenceID());
                if (!MessageThrottler.Current.shouldSupress(log, "asymetric evidence backpoint quality")) {
                    log.error(msg);
                }
                return false;
            }
        } else {
            unpaired.put(evidenceId, e);
        }
    }
    return true;
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) DirectedBreakpoint(au.edu.wehi.idsv.DirectedBreakpoint)

Aggregations

DirectedBreakpoint (au.edu.wehi.idsv.DirectedBreakpoint)2 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)2 ArrayList (java.util.ArrayList)1