public class HtsgetBAMFileReader extends SamReader.ReaderImplementation
| Modifier and Type | Class and Description |
|---|---|
static class |
HtsgetBAMFileReader.BAMQueryMultipleIntervalsIteratorFilter
Filters out records that do not match any of the given intervals and query type.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HTSGET_SCHEME |
| Constructor and Description |
|---|
HtsgetBAMFileReader(java.net.URI source,
boolean eagerDecode,
ValidationStringency validationStringency,
SAMRecordFactory samRecordFactory,
boolean useAsynchronousIO)
Prepare to read BAM from an htsget source
|
HtsgetBAMFileReader(java.net.URI source,
boolean eagerDecode,
ValidationStringency validationStringency,
SAMRecordFactory samRecordFactory,
boolean useAsynchronousIO,
InflaterFactory inflaterFactory)
Prepare to read BAM from a htsget source
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static java.net.URI |
convertHtsgetUriToHttp(java.net.URI uri) |
static java.net.URI |
convertHtsgetUriToHttps(java.net.URI uri) |
void |
enableCrcChecking(boolean check)
Set whether to check CRC for subsequent iterator or query requests.
|
void |
enableFileSource(SamReader reader,
boolean enabled)
Set whether to write the source of every read into the source SAMRecords.
|
static HtsgetBAMFileReader |
fromHtsgetURI(htsjdk.samtools.HtsgetInputResource source,
boolean eagerDecode,
ValidationStringency validationStringency,
SAMRecordFactory samRecordFactory,
boolean useAsynchronousIO,
InflaterFactory inflaterFactory)
Instantiate an HtsgetBAMFileReader from an HtsgetInputResource,
attempting to convert it to an https resource then a http resource if the server does not support https
|
SAMFileHeader |
getFileHeader() |
SAMFileSpan |
getFilePointerSpanningReads()
Generally gets a pointer to the first read in the file.
|
BAMIndex |
getIndex()
Always null as htsget sources do not have indices
|
CloseableIterator<SAMRecord> |
getIterator()
Prepare to iterate through the SAMRecords in file order.
|
CloseableIterator<SAMRecord> |
getIterator(SAMFileSpan fileSpan)
Generally loads data at a given point in the file.
|
ValidationStringency |
getValidationStringency() |
boolean |
hasIndex()
Always false as htsget sources do not have indices
|
boolean |
isQueryable()
Note that this source is queryable by interval despite NOT having an index
|
boolean |
isUsingPOST()
Can be used to determine whether the specified source supports the POST api
|
CloseableIterator<SAMRecord> |
query(java.util.List<Locatable> intervals,
boolean contained)
Query intervals directly by contig name instead of index relative to reference,
to avoid repeated conversion between name and index representations
|
CloseableIterator<SAMRecord> |
query(QueryInterval[] intervals,
boolean contained)
Prepare to iterate through the SAMRecords that match the given interval.
|
CloseableIterator<SAMRecord> |
query(java.lang.String sequence,
int start,
int end,
boolean contained) |
CloseableIterator<SAMRecord> |
queryAlignmentStart(java.lang.String sequence,
int start)
Prepare to iterate through the SAMRecords with the given alignment start.
|
CloseableIterator<SAMRecord> |
queryUnmapped()
Prepare to iterate through the SAMRecords that are unmapped and do not have a reference name or alignment start.
|
void |
setEagerDecode(boolean eagerDecode)
Set whether to eagerly decode subsequent SAMRecord reads.
|
void |
setSAMRecordFactory(SAMRecordFactory samRecordFactory)
Set SAMRecordFactory for subsequent SAMRecord reads.
|
void |
setUsingPOST(boolean use)
Force the source to attempt to use the POST api when requesting multiple intervals.
|
void |
setValidationStringency(ValidationStringency validationStringency)
Set error-checking level for subsequent SAMRecord reads.
|
SamReader.Type |
type() |
public static final java.lang.String HTSGET_SCHEME
public HtsgetBAMFileReader(java.net.URI source,
boolean eagerDecode,
ValidationStringency validationStringency,
SAMRecordFactory samRecordFactory,
boolean useAsynchronousIO)
throws java.io.IOException
source - http(s) URI of htsget resource including IDeagerDecode - if true, decode all BAM fields as reading rather than lazily.validationStringency - Controls how to handle invalidate reads or header lines.samRecordFactory - SAM record factoryuseAsynchronousIO - if true, use asynchronous I/O and prefetchingjava.io.IOExceptionpublic HtsgetBAMFileReader(java.net.URI source,
boolean eagerDecode,
ValidationStringency validationStringency,
SAMRecordFactory samRecordFactory,
boolean useAsynchronousIO,
InflaterFactory inflaterFactory)
throws java.io.IOException
source - source of bytes.eagerDecode - if true, decode all BAM fields as reading rather than lazily.validationStringency - Controls how to handle invalidate reads or header lines.samRecordFactory - SAM record factoryuseAsynchronousIO - if true, use asynchronous I/O and prefetchinginflaterFactory - InflaterFactory used by BlockCompressedInputStreamjava.io.IOExceptionpublic static HtsgetBAMFileReader fromHtsgetURI(htsjdk.samtools.HtsgetInputResource source, boolean eagerDecode, ValidationStringency validationStringency, SAMRecordFactory samRecordFactory, boolean useAsynchronousIO, InflaterFactory inflaterFactory) throws java.io.IOException, java.net.URISyntaxException
source - source of bytes.eagerDecode - if true, decode all BAM fields as reading rather than lazily.validationStringency - Controls how to handle invalidate reads or header lines.samRecordFactory - SAM record factoryuseAsynchronousIO - if true, use asynchronous I/O and prefetchinginflaterFactory - InflaterFactory used by BlockCompressedInputStreamjava.io.IOExceptionjava.net.URISyntaxExceptionpublic void setValidationStringency(ValidationStringency validationStringency)
public void setSAMRecordFactory(SAMRecordFactory samRecordFactory)
public void setEagerDecode(boolean eagerDecode)
public void enableCrcChecking(boolean check)
public void enableFileSource(SamReader reader, boolean enabled)
public SamReader.Type type()
public boolean isQueryable()
public boolean hasIndex()
public BAMIndex getIndex()
public SAMFileHeader getFileHeader()
public boolean isUsingPOST()
public void setUsingPOST(boolean use)
use - whether to use the POST apipublic CloseableIterator<SAMRecord> getIterator()
public CloseableIterator<SAMRecord> getIterator(SAMFileSpan fileSpan)
fileSpan - The file span.public SAMFileSpan getFilePointerSpanningReads()
public CloseableIterator<SAMRecord> query(QueryInterval[] intervals, boolean contained)
Note that an unmapped SAMRecord may still have a reference name and an alignment start for sorting purposes (typically this is the coordinate of its mate), and will be found by this method if the coordinate matches the specified interval.
intervals - the intervals to includecontained - If true, the alignments for the SAMRecords must be completely contained in the interval
specified by start and end. If false, the SAMRecords need only overlap the interval.public CloseableIterator<SAMRecord> query(java.lang.String sequence, int start, int end, boolean contained)
public CloseableIterator<SAMRecord> query(java.util.List<Locatable> intervals, boolean contained)
Callers much ensure that the intervals are in increasing order and do not overlap or abut
intervals - intervals to query bycontained - only return reads that are fully contained and not just overlapping if this is truepublic CloseableIterator<SAMRecord> queryAlignmentStart(java.lang.String sequence, int start)
Note that an unmapped SAMRecord may still have a reference name and an alignment start for sorting purposes (typically this is the coordinate of its mate), and will be found by this method if the coordinate matches the specified interval.
sequence - Reference sequence sought.start - Alignment start sought.public CloseableIterator<SAMRecord> queryUnmapped()
public void close()
public ValidationStringency getValidationStringency()
public static java.net.URI convertHtsgetUriToHttps(java.net.URI uri)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionpublic static java.net.URI convertHtsgetUriToHttp(java.net.URI uri)
throws java.net.URISyntaxException
java.net.URISyntaxException