public final class CachingIndexedFastaSequenceFile
extends java.lang.Object
implements htsjdk.samtools.reference.ReferenceSequenceFile
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_CACHE_SIZE
The default cache size in bp
|
protected static org.apache.logging.log4j.Logger |
logger |
Constructor and Description |
---|
CachingIndexedFastaSequenceFile(java.nio.file.Path fasta)
Open the given indexed fasta sequence file.
|
CachingIndexedFastaSequenceFile(java.nio.file.Path fasta,
boolean preserveAmbiguityCodesAndCapitalization)
Open the given indexed fasta sequence file.
|
CachingIndexedFastaSequenceFile(java.nio.file.Path fasta,
long cacheSize,
boolean preserveCase,
boolean preserveIUPAC)
Open the given indexed fasta sequence file.
|
Modifier and Type | Method and Description |
---|---|
double |
calcEfficiency()
Returns the efficiency (% of hits of all queries) of this object
|
void |
close()
Close the backing
ReferenceSequenceFile |
long |
getCacheHits() |
long |
getCacheMisses() |
long |
getCacheSize() |
htsjdk.samtools.reference.ReferenceSequence |
getSequence(java.lang.String contig)
Retrieves the complete sequence described by this contig.
|
htsjdk.samtools.SAMSequenceDictionary |
getSequenceDictionary()
Returns the sequence dictionary associated with this reference file
|
htsjdk.samtools.reference.ReferenceSequence |
getSubsequenceAt(java.lang.String contig,
long start,
long stop)
Gets the subsequence of the contig in the range [start,stop]
Uses the sequence cache if possible, or updates the cache to handle the request.
|
boolean |
isIndexed()
A
CachingIndexedFastaSequenceFile is always indexed. |
boolean |
isPreservingCase()
Is this CachingIndexedFastaReader keeping the original case of bases in the fasta, or is
everything being made upper case?
|
htsjdk.samtools.reference.ReferenceSequence |
nextSequence()
Retrieves the next whole sequence from the file.
|
void |
printEfficiency(org.apache.logging.log4j.Level priority)
Print the efficiency (hits / queries) to logger with priority
|
void |
reset()
Resets the ReferenceSequenceFile so that the next call to nextSequence() will return
the first sequence in the file.
|
protected static final org.apache.logging.log4j.Logger logger
public static final long DEFAULT_CACHE_SIZE
public CachingIndexedFastaSequenceFile(java.nio.file.Path fasta)
fasta
- The file to open.public CachingIndexedFastaSequenceFile(java.nio.file.Path fasta, boolean preserveAmbiguityCodesAndCapitalization)
preserveAmbiguityCodesAndCapitalization
is true
, will NOT convert IUPAC bases in the file to `N` and will NOT capitalize lower-case bases.
NOTE: Most GATK tools do not support data created by setting preserveAmbiguityCodesAndCapitalization
to true
.
Looks for index files for the fasta on disk.fasta
- Fasta file to be used as referencepreserveAmbiguityCodesAndCapitalization
- Whether to preserve the original bases in the given reference file path or normalize them.public CachingIndexedFastaSequenceFile(java.nio.file.Path fasta, long cacheSize, boolean preserveCase, boolean preserveIUPAC)
preserveCase
or preserveIUPAC
to true
.fasta
- The file to open.cacheSize
- the size of the cache to use in this CachingIndexedFastaReader, must be > 0preserveCase
- If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper casepreserveIUPAC
- If true, we will keep the IUPAC bases in the FASTA, otherwise they are converted to Nspublic void printEfficiency(org.apache.logging.log4j.Level priority)
public double calcEfficiency()
public long getCacheHits()
public long getCacheMisses()
public long getCacheSize()
public boolean isPreservingCase()
public htsjdk.samtools.SAMSequenceDictionary getSequenceDictionary()
getSequenceDictionary
in interface htsjdk.samtools.reference.ReferenceSequenceFile
public htsjdk.samtools.reference.ReferenceSequence nextSequence()
nextSequence
in interface htsjdk.samtools.reference.ReferenceSequenceFile
public void reset()
reset
in interface htsjdk.samtools.reference.ReferenceSequenceFile
public boolean isIndexed()
CachingIndexedFastaSequenceFile
is always indexed.isIndexed
in interface htsjdk.samtools.reference.ReferenceSequenceFile
public htsjdk.samtools.reference.ReferenceSequence getSequence(java.lang.String contig)
getSequence
in interface htsjdk.samtools.reference.ReferenceSequenceFile
contig
- contig whose data should be returned.public htsjdk.samtools.reference.ReferenceSequence getSubsequenceAt(java.lang.String contig, long start, long stop)
getSubsequenceAt
in interface htsjdk.samtools.reference.ReferenceSequenceFile
contig
- Contig whose subsequence to retrieve.start
- inclusive, 1-based start of region.stop
- inclusive, 1-based stop of region.public void close()
ReferenceSequenceFile
close
in interface htsjdk.samtools.reference.ReferenceSequenceFile
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable