public class BCF2Codec extends BinaryFeatureCodec<VariantContext>
Modifier and Type | Class and Description |
---|---|
static class |
BCF2Codec.LazyData |
protected static class |
BCF2Codec.SitesInfoForDecoding |
Modifier and Type | Field and Description |
---|---|
static BCFVersion |
ALLOWED_BCF_VERSION |
protected static int |
ALLOWED_MAJOR_VERSION |
protected static int |
ALLOWED_MINOR_VERSION |
static int |
SIZEOF_BCF_HEADER
sizeof a BCF header (+ min/max version).
|
Constructor and Description |
---|
BCF2Codec() |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecode(java.lang.String path)
This function returns true iff the File potentialInput can be parsed by this
codec.
|
VariantContext |
decode(PositionalBufferedStream inputStream)
Decode a single
Feature from the SOURCE , reading no further in the underlying source than beyond that feature. |
Feature |
decodeLoc(PositionalBufferedStream inputStream)
Decode a line to obtain just its FeatureLoc for indexing -- contig, start, and stop.
|
protected void |
error(java.lang.String message) |
protected java.lang.String |
getDictionaryString(int offset) |
java.lang.Class<VariantContext> |
getFeatureType()
This function returns the object the codec generates.
|
protected BCF2GenotypeFieldDecoders.Decoder |
getGenotypeFieldDecoder(java.lang.String field) |
protected VCFHeader |
getHeader() |
FeatureCodecHeader |
readHeader(PositionalBufferedStream inputStream)
Read and return the header, or null if there is no header.
|
static BCFVersion |
tryReadBCFVersion(java.io.BufferedInputStream uncompressedBufferedInput)
try to read a BCFVersion from an uncompressed BufferedInputStream.
|
protected void |
validateVersionCompatibility(BCFVersion supportedVersion,
BCFVersion actualVersion)
Validate the actual version against the supported version to determine compatibility.
|
close, getTabixFormat, isDone, makeIndexableSourceFromStream, makeSourceFromStream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPathToDataFile
protected static final int ALLOWED_MAJOR_VERSION
protected static final int ALLOWED_MINOR_VERSION
public static final BCFVersion ALLOWED_BCF_VERSION
public static final int SIZEOF_BCF_HEADER
public Feature decodeLoc(PositionalBufferedStream inputStream)
FeatureCodec
inputStream
- the input stream from which to decode the next recordpublic VariantContext decode(PositionalBufferedStream inputStream)
FeatureCodec
Feature
from the SOURCE
, reading no further in the underlying source than beyond that feature.inputStream
- the input stream from which to decode the next recordpublic java.lang.Class<VariantContext> getFeatureType()
FeatureCodec
This function returns the object the codec generates. This is allowed to be Feature in the case where conditionally different types are generated. Be as specific as you can though.
This function is used by reflections based tools, so we can know the underlying type
protected void validateVersionCompatibility(BCFVersion supportedVersion, BCFVersion actualVersion)
supportedVersion
- the current BCF implementation versionactualVersion
- the actual versionpublic FeatureCodecHeader readHeader(PositionalBufferedStream inputStream)
FeatureCodec
SOURCE
as needed to parse the header, and no
more. Otherwise, data that might otherwise be fed into parsing a Feature
may be lost.inputStream
- the source from which to decode the headerpublic boolean canDecode(java.lang.String path)
FeatureCodec
This function returns true iff the File potentialInput can be parsed by this codec. Note that checking the file's extension is a perfectly acceptable implementation of this method and file contents only rarely need to be checked.
There is an assumption that there's never a situation where two different Codecs return true for the same file. If this occurs, the recommendation would be to error out.
Note this function must never throw an error. All errors should be trapped and false returned.path
- the file to test for parsability with this codecprotected final java.lang.String getDictionaryString(int offset)
protected VCFHeader getHeader()
protected BCF2GenotypeFieldDecoders.Decoder getGenotypeFieldDecoder(java.lang.String field)
protected void error(java.lang.String message) throws java.lang.RuntimeException
java.lang.RuntimeException
public static BCFVersion tryReadBCFVersion(java.io.BufferedInputStream uncompressedBufferedInput) throws java.io.IOException
SIZEOF_BCF_HEADER
uncompressedBufferedInput
- the uncompressed input streamjava.io.IOException