Search in sources :

Example 1 with SoftClipConfiguration

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

the class SAMEvidenceSource method shouldFilter.

public boolean shouldFilter(DirectedEvidence e) {
    BreakendSummary bs = e.getBreakendSummary();
    if (getBlacklistedRegions().overlaps(bs.referenceIndex, bs.start - 1, bs.end + 1)) {
        return true;
    }
    GridssConfiguration config = getContext().getConfig();
    if (e instanceof SingleReadEvidence) {
        if (((SingleReadEvidence) e).isReference()) {
            return true;
        }
    }
    if (e instanceof SoftClipEvidence) {
        SoftClipEvidence sce = (SoftClipEvidence) e;
        SoftClipConfiguration scc = config.getSoftClip();
        if (sce.getBreakendSequence().length < scc.minLength)
            return true;
        if (average(sce.getBreakendQuality()) < scc.minAverageQual)
            return true;
        if (config.adapters.isAdapterSoftClip(sce))
            return true;
        if (!AssemblyAttributes.isAssembly(sce.getSAMRecord())) {
            // TODO: symmetrical identity and entropy filters on both sides
            if (SAMRecordUtil.getAlignedIdentity(sce.getSAMRecord()) < scc.minAnchorIdentity)
                return true;
            if (SAMRecordUtil.alignedEntropy(sce.getSAMRecord()) < config.minAnchorShannonEntropy)
                return true;
        }
    }
    if (e instanceof IndelEvidence) {
    // Currently filtering small indels in evidence iterator itself
    }
    if (e instanceof DirectedBreakpoint) {
        BreakpointSummary bp = (BreakpointSummary) e.getBreakendSummary();
        if (getBlacklistedRegions().overlaps(bp.referenceIndex2, bp.start2 - 1, bp.end2 + 1)) {
            return true;
        }
    // Still do assembly - leave the filtering to the variant calling
    // if (bp.getEventSize() != null && bp.getEventSize() < config.getVariantCalling().minSize) {
    // return true;
    // }
    }
    return false;
}
Also used : GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration) SoftClipConfiguration(au.edu.wehi.idsv.configuration.SoftClipConfiguration)

Aggregations

GridssConfiguration (au.edu.wehi.idsv.configuration.GridssConfiguration)1 SoftClipConfiguration (au.edu.wehi.idsv.configuration.SoftClipConfiguration)1