Provide close methods to clean up resources used while creating AlignmentContexts from BAM file regions. Allows utilization of CoveredLocusView via the API
Signed-off-by: David Roazen <droazen@broadinstitute.org>
This commit is contained in:
parent
5e539bb11b
commit
2f5064dd1d
|
|
@ -246,6 +246,14 @@ public class BAMScheduler implements Iterator<FilePointer> {
|
||||||
*/
|
*/
|
||||||
private PeekableIterator<BAMScheduleEntry> bamScheduleIterator = null;
|
private PeekableIterator<BAMScheduleEntry> bamScheduleIterator = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up underlying BAMSchedule file handles.
|
||||||
|
*/
|
||||||
|
public void close() {
|
||||||
|
if(bamScheduleIterator != null)
|
||||||
|
bamScheduleIterator.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next overlapping tree of bins associated with the given BAM file.
|
* Get the next overlapping tree of bins associated with the given BAM file.
|
||||||
* @param currentLocus The actual locus for which to check overlap.
|
* @param currentLocus The actual locus for which to check overlap.
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ public class IntervalSharder implements Iterator<FilePointer> {
|
||||||
wrappedIterator = new PeekableIterator<FilePointer>(scheduler);
|
wrappedIterator = new PeekableIterator<FilePointer>(scheduler);
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
}
|
}
|
||||||
|
public void close() {
|
||||||
|
wrappedIterator.close();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return wrappedIterator.hasNext();
|
return wrappedIterator.hasNext();
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,14 @@ public class SAMDataSource {
|
||||||
resourcePool.releaseReaders(readers);
|
resourcePool.releaseReaders(readers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
SAMReaders readers = resourcePool.getAvailableReaders();
|
||||||
|
for(SAMReaderID readerID: readerIDs) {
|
||||||
|
SAMFileReader reader = readers.getReader(readerID);
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Reads data structure containing information about the reads data sources placed in this pool as well as
|
* Returns Reads data structure containing information about the reads data sources placed in this pool as well as
|
||||||
* information about how they are downsampled, sorted, and filtered
|
* information about how they are downsampled, sorted, and filtered
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,7 @@ public abstract class ShardBalancer implements Iterable<Shard> {
|
||||||
this.filePointers = new PeekableIterator<FilePointer>(filePointers);
|
this.filePointers = new PeekableIterator<FilePointer>(filePointers);
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
}
|
}
|
||||||
|
public void close() {
|
||||||
|
this.filePointers.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue