/** * Determines whether a SAMRecord matches this filter. Takes record, finds * the location of its mate using the MC tag. Checks if either record * overlaps the current interval using overlap detector. If yes, return * false -> don't filter it out. * * If a read is secondary, supplementary, or single ended, filter read out. * Use {@link IntervalFilter} if you want to keep these reads, but NOTE: the * resulting bam may not be valid. * * @param record the SAMRecord to evaluate * @return true if the SAMRecord matches the filter, otherwise false */ @Override public boolean filterOut(final SAMRecord record) { if (record.isSecondaryOrSupplementary() || !record.getReadPairedFlag()) { return true; } if (!record.getReadUnmappedFlag() && hasOverlaps(record.getReferenceName(), record.getStart(), record.getEnd())) { return false; } return record.getMateUnmappedFlag() || !hasOverlaps(record.getMateReferenceName(), record.getMateAlignmentStart(), SAMUtils.getMateAlignmentEnd(record)); }
/** * Determines whether a SAMRecord matches this filter. Takes record, finds * the location of its mate using the MC tag. Checks if either record * overlaps the current interval using overlap detector. If yes, return * false -> don't filter it out. * * If a read is secondary, supplementary, or single ended, filter read out. * Use {@link IntervalFilter} if you want to keep these reads, but NOTE: the * resulting bam may not be valid. * * @param record the SAMRecord to evaluate * @return true if the SAMRecord matches the filter, otherwise false */ @Override public boolean filterOut(final SAMRecord record) { if (record.isSecondaryOrSupplementary() || !record.getReadPairedFlag()) { return true; } if (!record.getReadUnmappedFlag() && hasOverlaps(record.getReferenceName(), record.getStart(), record.getEnd())) { return false; } return record.getMateUnmappedFlag() || !hasOverlaps(record.getMateReferenceName(), record.getMateAlignmentStart(), SAMUtils.getMateAlignmentEnd(record)); }