public class Gff3Codec extends AbstractFeatureCodec<Gff3Feature,LineIterator>
Gff3Feature.getParents(), Gff3Feature.getChildren(),
Gff3Feature.getAncestors(), Gff3Feature.getDescendents(), amd Gff3Feature.flatten(). This linking is not guaranteed to be comprehensive when the file is read for only features overlapping a particular
region, using a tribble index. In this case, a particular feature will only be linked to the subgroup of features it is linked to in the input file which overlap the given region.| Modifier and Type | Class and Description |
|---|---|
static class |
Gff3Codec.DecodeDepth |
static class |
Gff3Codec.Gff3Directive
Enum for parsing directive lines.
|
| Constructor and Description |
|---|
Gff3Codec() |
Gff3Codec(Gff3Codec.DecodeDepth decodeDepth) |
Gff3Codec(Gff3Codec.DecodeDepth decodeDepth,
java.util.function.Predicate<java.lang.String> filterOutAttribute) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecode(java.lang.String inputFilePath)
This function returns true iff the File potentialInput can be parsed by this
codec.
|
void |
close(LineIterator lineIterator)
Adapter method that closes the provided
SOURCE. |
Gff3Feature |
decode(LineIterator lineIterator)
Decode a single
Feature from the SOURCE, reading no further in the underlying source than beyond that feature. |
Feature |
decodeLoc(LineIterator lineIterator)
Decode a line to obtain just its FeatureLoc for indexing -- contig, start, and stop.
|
java.util.Map<java.lang.Integer,java.lang.String> |
getCommentsWithLineNumbers()
Gets map from line number to comment found on that line.
|
java.util.List<java.lang.String> |
getCommentTexts()
Gets list of comments parsed by the codec.
|
java.util.List<SequenceRegion> |
getSequenceRegions()
Get list of sequence regions parsed by the codec.
|
TabixFormat |
getTabixFormat()
Define the tabix format for the feature, used for indexing.
|
boolean |
isDone(LineIterator lineIterator)
Adapter method that assesses whether the provided
SOURCE has more data. |
LocationAware |
makeIndexableSourceFromStream(java.io.InputStream bufferedInputStream)
Return a
SOURCE for this FeatureCodec that implements LocationAware,
and is thus suitable for use during indexing. |
LineIterator |
makeSourceFromStream(java.io.InputStream bufferedInputStream)
Generates a reader of type
SOURCE appropriate for use by this codec from the generic input stream. |
FeatureCodecHeader |
readHeader(LineIterator lineIterator)
Read and return the header, or null if there is no header.
|
getFeatureTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPathToDataFilepublic Gff3Codec()
public Gff3Codec(Gff3Codec.DecodeDepth decodeDepth)
public Gff3Codec(Gff3Codec.DecodeDepth decodeDepth, java.util.function.Predicate<java.lang.String> filterOutAttribute)
decodeDepth - a value from DecodeDepthfilterOutAttribute - filter to remove keys from the EXTRA_FIELDS columnpublic Gff3Feature decode(LineIterator lineIterator) throws java.io.IOException
FeatureCodecFeature from the SOURCE, reading no further in the underlying source than beyond that feature.lineIterator - the input stream from which to decode the next recordjava.io.IOExceptionpublic java.util.List<SequenceRegion> getSequenceRegions()
public java.util.Map<java.lang.Integer,java.lang.String> getCommentsWithLineNumbers()
public java.util.List<java.lang.String> getCommentTexts()
public Feature decodeLoc(LineIterator lineIterator) throws java.io.IOException
FeatureCodecdecodeLoc in interface FeatureCodec<Gff3Feature,LineIterator>decodeLoc in class AbstractFeatureCodec<Gff3Feature,LineIterator>lineIterator - the input stream from which to decode the next recordjava.io.IOExceptionpublic boolean canDecode(java.lang.String inputFilePath)
FeatureCodecThis 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.inputFilePath - the file to test for parsability with this codecpublic FeatureCodecHeader readHeader(LineIterator lineIterator)
FeatureCodecSOURCE as needed to parse the header, and no
more. Otherwise, data that might otherwise be fed into parsing a Feature may be lost.lineIterator - the source from which to decode the headerpublic LineIterator makeSourceFromStream(java.io.InputStream bufferedInputStream)
FeatureCodecSOURCE appropriate for use by this codec from the generic input stream. Implementers should
assume the stream is buffered.public LocationAware makeIndexableSourceFromStream(java.io.InputStream bufferedInputStream)
FeatureCodecSOURCE for this FeatureCodec that implements LocationAware,
and is thus suitable for use during indexing. Like FeatureCodec.makeSourceFromStream(java.io.InputStream), except
the LocationAware compatibility is required for creating indexes.
Implementers of this method must return a type that is both LocationAware as well as SOURCE. Note that this
requirement cannot be enforced via the method signature due to limitations in Java's generic typing system. Instead, consumers
should cast the call result into a SOURCE when applicable.
NOTE: During the indexing process, the indexer passes the SOURCE to the codec
to consume Features from the underlying SOURCE, one at a time, recording the Feature location via the SOURCE's
LocationAware interface. Therefore, it is essential that the SOURCE implementation, the FeatureCodec.readHeader(SOURCE)
method, and the FeatureCodec.decodeLoc(SOURCE) method, which are used during indexing, not introduce any buffering that would that
would advance the SOURCE more than a single feature (or the more than the size of the header, in the case of
FeatureCodec.readHeader(SOURCE)).public boolean isDone(LineIterator lineIterator)
FeatureCodecSOURCE has more data. True if it does, false otherwise.public void close(LineIterator lineIterator)
FeatureCodecSOURCE.public TabixFormat getTabixFormat()
FeatureCodecAsciiFeatureCodec could read tabix files as defined in
AbstractFeatureReader.getFeatureReader(String, String, FeatureCodec, boolean, java.util.function.Function, java.util.function.Function)