public final class ReadsDataSource extends java.lang.Object implements GATKDataSource<GATKRead>, java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected static org.apache.logging.log4j.Logger |
logger |
Constructor and Description |
---|
ReadsDataSource(java.util.List<java.nio.file.Path> samFiles)
Initialize this data source with multiple SAM/BAM files and validation stringency SILENT.
|
ReadsDataSource(java.util.List<java.nio.file.Path> samPaths,
java.util.List<java.nio.file.Path> samIndices)
Initialize this data source with multiple SAM/BAM/CRAM files, and explicit indices for those files.
|
ReadsDataSource(java.util.List<java.nio.file.Path> samPaths,
java.util.List<java.nio.file.Path> samIndices,
htsjdk.samtools.SamReaderFactory customSamReaderFactory)
Initialize this data source with multiple SAM/BAM/CRAM files, explicit indices for those files,
and a custom SamReaderFactory.
|
ReadsDataSource(java.util.List<java.nio.file.Path> samPaths,
java.util.List<java.nio.file.Path> samIndices,
htsjdk.samtools.SamReaderFactory customSamReaderFactory,
java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> cloudWrapper,
java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> cloudIndexWrapper)
Initialize this data source with multiple SAM/BAM/CRAM files, explicit indices for those files,
and a custom SamReaderFactory.
|
ReadsDataSource(java.util.List<java.nio.file.Path> samPaths,
java.util.List<java.nio.file.Path> samIndices,
htsjdk.samtools.SamReaderFactory customSamReaderFactory,
int cloudPrefetchBuffer,
int cloudIndexPrefetchBuffer)
Initialize this data source with multiple SAM/BAM/CRAM files, explicit indices for those files,
and a custom SamReaderFactory.
|
ReadsDataSource(java.util.List<java.nio.file.Path> samPaths,
htsjdk.samtools.SamReaderFactory customSamReaderFactory)
Initialize this data source with multiple SAM/BAM files and a custom SamReaderFactory
|
ReadsDataSource(java.nio.file.Path samFile)
Initialize this data source with a single SAM/BAM file and validation stringency SILENT.
|
ReadsDataSource(java.nio.file.Path samPath,
htsjdk.samtools.SamReaderFactory customSamReaderFactory)
Initialize this data source with a single SAM/BAM file and a custom SamReaderFactory
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shut down this data source permanently, closing all iterations and readers.
|
htsjdk.samtools.SAMFileHeader |
getHeader()
Returns the SAM header for this data source.
|
htsjdk.samtools.SAMSequenceDictionary |
getSequenceDictionary()
Get the sequence dictionary for this ReadsDataSource
|
boolean |
indicesAvailable()
Are indices available for all files?
|
java.util.Iterator<GATKRead> |
iterator()
Iterate over all reads in this data source.
|
java.util.Iterator<GATKRead> |
query(SimpleInterval interval)
Query reads over a specific interval.
|
java.util.Iterator<GATKRead> |
queryUnmapped() |
void |
setTraversalBounds(java.util.List<SimpleInterval> intervals)
Restricts a traversal of this data source via
iterator() to only return reads which overlap the given intervals. |
void |
setTraversalBounds(java.util.List<SimpleInterval> intervals,
boolean traverseUnmapped)
Restricts a traversal of this data source via
iterator() to only return reads that overlap the given intervals,
and to unmapped reads if specified. |
void |
setTraversalBounds(TraversalParameters traversalParameters)
Restricts a traversal of this data source via
iterator() to only return reads that overlap the given intervals,
and to unmapped reads if specified. |
boolean |
traversalIsBounded() |
public ReadsDataSource(java.nio.file.Path samFile)
samFile
- SAM/BAM file, not null.public ReadsDataSource(java.util.List<java.nio.file.Path> samFiles)
samFiles
- SAM/BAM files, not null.public ReadsDataSource(java.nio.file.Path samPath, htsjdk.samtools.SamReaderFactory customSamReaderFactory)
samPath
- path to SAM/BAM file, not null.customSamReaderFactory
- SamReaderFactory to use, if null a default factory with no reference and validation
stringency SILENT is used.public ReadsDataSource(java.util.List<java.nio.file.Path> samPaths, htsjdk.samtools.SamReaderFactory customSamReaderFactory)
samPaths
- path to SAM/BAM file, not null.customSamReaderFactory
- SamReaderFactory to use, if null a default factory with no reference and validation
stringency SILENT is used.public ReadsDataSource(java.util.List<java.nio.file.Path> samPaths, java.util.List<java.nio.file.Path> samIndices)
samPaths
- paths to SAM/BAM/CRAM files, not nullsamIndices
- indices for all of the SAM/BAM/CRAM files, in the same order as samPaths. May be null,
in which case index paths are inferred automatically.public ReadsDataSource(java.util.List<java.nio.file.Path> samPaths, java.util.List<java.nio.file.Path> samIndices, htsjdk.samtools.SamReaderFactory customSamReaderFactory)
samPaths
- paths to SAM/BAM/CRAM files, not nullsamIndices
- indices for all of the SAM/BAM/CRAM files, in the same order as samPaths. May be null,
in which case index paths are inferred automatically.customSamReaderFactory
- SamReaderFactory to use, if null a default factory with no reference and validation
stringency SILENT is used.public ReadsDataSource(java.util.List<java.nio.file.Path> samPaths, java.util.List<java.nio.file.Path> samIndices, htsjdk.samtools.SamReaderFactory customSamReaderFactory, int cloudPrefetchBuffer, int cloudIndexPrefetchBuffer)
samPaths
- paths to SAM/BAM/CRAM files, not nullsamIndices
- indices for all of the SAM/BAM/CRAM files, in the same order as samPaths. May be null,
in which case index paths are inferred automatically.customSamReaderFactory
- SamReaderFactory to use, if null a default factory with no reference and validation
stringency SILENT is used.cloudPrefetchBuffer
- MB size of caching/prefetching wrapper for the data, if on Google Cloud (0 to disable).cloudIndexPrefetchBuffer
- MB size of caching/prefetching wrapper for the index, if on Google Cloud (0 to disable).public ReadsDataSource(java.util.List<java.nio.file.Path> samPaths, java.util.List<java.nio.file.Path> samIndices, htsjdk.samtools.SamReaderFactory customSamReaderFactory, java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> cloudWrapper, java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> cloudIndexWrapper)
samPaths
- paths to SAM/BAM/CRAM files, not nullsamIndices
- indices for all of the SAM/BAM/CRAM files, in the same order as samPaths. May be null,
in which case index paths are inferred automatically.customSamReaderFactory
- SamReaderFactory to use, if null a default factory with no reference and validation
stringency SILENT is used.cloudWrapper
- caching/prefetching wrapper for the data, if on Google Cloud.cloudIndexWrapper
- caching/prefetching wrapper for the index, if on Google Cloud.public boolean indicesAvailable()
public void setTraversalBounds(java.util.List<SimpleInterval> intervals)
iterator()
to only return reads which overlap the given intervals.
Calls to query(org.broadinstitute.hellbender.utils.SimpleInterval)
are not affected by setting these intervals.intervals
- Our next full traversal will return only reads overlapping these intervalspublic void setTraversalBounds(TraversalParameters traversalParameters)
iterator()
to only return reads that overlap the given intervals,
and to unmapped reads if specified.
Calls to query(org.broadinstitute.hellbender.utils.SimpleInterval)
are not affected by this method.traversalParameters
- set of traversal parameters to control which reads get returned by the next call
to iterator()
public void setTraversalBounds(java.util.List<SimpleInterval> intervals, boolean traverseUnmapped)
iterator()
to only return reads that overlap the given intervals,
and to unmapped reads if specified.
Calls to query(org.broadinstitute.hellbender.utils.SimpleInterval)
are not affected by this method.intervals
- Our next full traversal will return reads overlapping these intervalstraverseUnmapped
- Our next full traversal will return unmapped reads (this affects only unmapped reads that
have no position -- unmapped reads that have the position of their mapped mates will be
included if the interval overlapping that position is included).public boolean traversalIsBounded()
iterator()
will be restricted to reads that overlap intervals
as configured via setTraversalBounds(java.util.List<org.broadinstitute.hellbender.utils.SimpleInterval>)
, otherwise falsepublic java.util.Iterator<GATKRead> iterator()
setTraversalBounds(java.util.List<org.broadinstitute.hellbender.utils.SimpleInterval>)
,
iteration is limited to reads that overlap that set of intervals.iterator
in interface java.lang.Iterable<GATKRead>
setTraversalBounds(java.util.List<org.broadinstitute.hellbender.utils.SimpleInterval>)
(if intervals were provided)public java.util.Iterator<GATKRead> query(SimpleInterval interval)
setTraversalBounds(java.util.List<org.broadinstitute.hellbender.utils.SimpleInterval>)
query
in interface GATKDataSource<GATKRead>
interval
- The interval over which to querypublic java.util.Iterator<GATKRead> queryUnmapped()
setTraversalBounds(java.util.List<org.broadinstitute.hellbender.utils.SimpleInterval>)
. The underlying file must be indexed.public htsjdk.samtools.SAMFileHeader getHeader()
public void close()
close
in interface java.lang.AutoCloseable
public htsjdk.samtools.SAMSequenceDictionary getSequenceDictionary()