# Class IntervalKeepPairFilter

java.lang.Object
htsjdk.samtools.filter.IntervalKeepPairFilter

All Implemented Interfaces:
  `SamRecordFilter`

public class IntervalKeepPairFilter extends Object implements SamRecordFilter
Filter out SAMRecords where neither record of a pair overlaps a given set of intervals. If one record of a pair overlaps the interval list, than both are kept. It is required that the SAMRecords are passed in coordinate order, have non-null SAMFileHeaders, and that Mate Cigar (MC) is present.

## Constructor Summary

Constructors
Constructor
Description
`IntervalKeepPairFilter(List<Interval> intervals)`
Prepare to filter out SAMRecords that do not overlap the given list of intervals

## Method Summary

Modifier and Type
Method
Description
`boolean`
`filterOut(SAMRecord record)`
Determines whether a SAMRecord matches this filter.
`boolean`
`filterOut(SAMRecord first, SAMRecord second)`
Determines whether a pair of SAMRecord matches this filter

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### IntervalKeepPairFilter

public IntervalKeepPairFilter(List<Interval> intervals)
Prepare to filter out SAMRecords that do not overlap the given list of intervals

Parameters:
  `intervals` -

## Method Details

### filterOut

public boolean filterOut(SAMRecord 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 `IntervalFilter` if you want to keep these reads, but NOTE: the resulting bam may not be valid.

Specified by:
  `filterOut` in interface `SamRecordFilter`
Parameters:
  `record` - the SAMRecord to evaluate
Returns:
  true if the SAMRecord matches the filter, otherwise false

### filterOut

public boolean filterOut(SAMRecord first, SAMRecord second)
Determines whether a pair of SAMRecord matches this filter

Specified by:
  `filterOut` in interface `SamRecordFilter`
Parameters:
  `first` - the first SAMRecord to evaluate
  `second` - the second SAMRecord to evaluate
Returns:
  true if both SAMRecords do not overlap the interval list