use of htsjdk.samtools.filter.IntervalFilter in project jvarkit by lindenb.
the class MultiBamLauncher method openSamIterator.
/**
* create input SAMRecord iterator for one sample
*/
protected CloseableIterator<SAMRecord> openSamIterator(final SamReader sr) {
if (this.regionFiles != null) {
this.regionFiles.dictionary(SequenceDictionaryUtils.extractRequired(sr.getFileHeader()));
if (!sr.hasIndex()) {
final List<Interval> L = this.regionFiles.stream().map(x -> new Interval(x)).collect(Collectors.toList());
final SAMRecordIterator st0 = sr.iterator();
return new FilteringSamIterator(st0, new IntervalFilter(L, sr.getFileHeader()));
} else {
final QueryInterval[] optimized = this.regionFiles.optimizedQueryIntervals();
return sr.query(optimized, false);
}
}
return sr.iterator();
}
use of htsjdk.samtools.filter.IntervalFilter in project jvarkit by lindenb.
the class SamReadLengthDistribution method openSamIterator.
/**
* create input SAMRecord iterator
*/
private CloseableIterator<SAMRecord> openSamIterator(final SamReader sr) {
if (this.regionFiles != null) {
this.regionFiles.dictionary(SequenceDictionaryUtils.extractRequired(sr.getFileHeader()));
if (!sr.hasIndex()) {
final List<Interval> L = this.regionFiles.stream().map(x -> new Interval(x)).collect(Collectors.toList());
final SAMRecordIterator st0 = sr.iterator();
return new FilteringSamIterator(st0, new IntervalFilter(L, sr.getFileHeader()));
} else {
return sr.query(this.regionFiles.optimizedQueryIntervals(), false);
}
}
return sr.iterator();
}
Aggregations