Package htsjdk.tribble.bed
Class BEDCodec
- All Implemented Interfaces:
FeatureCodec<BEDFeature,
LineIterator>
Codec for parsing BED file, as described by UCSC
See https://genome.ucsc.edu/FAQ/FAQformat.html#format1
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Indicate whether co-ordinates or 0-based or 1-based. -
Field Summary
-
Constructor Summary
ConstructorDescriptionBEDCodec()
CallsBEDCodec(StartOffset)
with an argument ofStartOffset.ONE
BEDCodec
(BEDCodec.StartOffset startOffset) BED format is 0-based, but Tribble is 1-based. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This function returns true iff the File potentialInput can be parsed by this codec.int
Define the tabix format for the feature, used for indexing.readActualHeader
(LineIterator lineIterator) The BED codec doesn't retain the actual header, but we need to parse through it and advance to the beginning of the first feature.protected boolean
readHeaderLine
(String line) Methods inherited from class htsjdk.tribble.AsciiFeatureCodec
close, decode, isDone, makeIndexableSourceFromStream, makeSourceFromStream, readHeader
Methods inherited from class htsjdk.tribble.AbstractFeatureCodec
decodeLoc, getFeatureType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface htsjdk.tribble.FeatureCodec
getPathToDataFile
-
Field Details
-
BED_EXTENSION
Deprecated.since June 2019 UseFileExtensions.BED
instead.- See Also:
-
-
Constructor Details
-
BEDCodec
public BEDCodec()CallsBEDCodec(StartOffset)
with an argument ofStartOffset.ONE
-
BEDCodec
BED format is 0-based, but Tribble is 1-based. Set desired start position at either ZERO or ONE
-
-
Method Details
-
decodeLoc
-
decode
- Specified by:
decode
in classAsciiFeatureCodec<BEDFeature>
- See Also:
-
readActualHeader
The BED codec doesn't retain the actual header, but we need to parse through it and advance to the beginning of the first feature. This is especially true if we're indexing, since we want to underlying stream offset to be established correctly, but is also the case for when we're simply iterating to satisfy a feature query (otherwise the feature reader can terminate prematurely if the header is large).- Specified by:
readActualHeader
in classAsciiFeatureCodec<BEDFeature>
- Parameters:
lineIterator
-- Returns:
- Always null. The BEDCodec currently doesn't model or preserve the BED header.
-
decode
-
readHeaderLine
-
canDecode
Description copied from interface: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.- Parameters:
path
- the file to test for parsability with this codec- Returns:
- true if potentialInput can be parsed, false otherwise
-
getStartOffset
public int getStartOffset() -
getTabixFormat
Description copied from interface:FeatureCodec
Define the tabix format for the feature, used for indexing. Default implementation throws an exception. Note that onlyAsciiFeatureCodec
could read tabix files as defined inAbstractFeatureReader.getFeatureReader(String, String, FeatureCodec, boolean, java.util.function.Function, java.util.function.Function)
- Returns:
- the format to use with tabix
-
FileExtensions.BED
instead.