Multipart features¶
Several GFF3 lines may share one ID — the standard way to represent a CDS
interrupted by a frameshift, and how NCBI RefSeq encodes split CDS segments.
Under mode="strict" those lines become one logical feature with a
segments side table holding the physical lines.
MultipartFeature and FeatureSegment both subclass Feature and override
none of __str__, __len__, __hash__, __eq__, __getitem__ or
astuple — the compatibility surface is preserved by inaction. len() stays
the envelope span; covered_length is the new quantity that excludes the
gaps.
gffbase.feature.MultipartFeature ¶
Bases: Feature
A logical feature assembled from more than one input line.
Its own start/end are the ENVELOPE -- MIN(segment.start) and
MAX(segment.end) -- and every inherited method operates on that envelope,
so a caller that knows nothing about discontinuous features sees exactly
the gffutils behaviour for a feature spanning that range.
Consequently len(f) is the envelope span, matching Feature.
covered_length is the different, new quantity.
Source code in python/gffbase/feature.py
covered_length
property
¶
Total length actually covered, with the gaps excluded.
Differs from len(self), which is the envelope span. For a CDS split
across two 100 bp exons 700 bp apart, len is 900 and this is 200.
Segments of a discontinuous feature must not overlap; if a malformed file provides overlapping ones, the shared bases are counted twice.
to_lines ¶
gffbase.feature.FeatureSegment ¶
Bases: Feature
One physical input line of a discontinuous feature.
Carries its OWN coordinates, score, phase and column 9 -- per-segment CDS
phase is the main reason the storage exists -- while seqid, source,
featuretype and strand come from the logical feature, which by
definition shares them.
self.id is the LOGICAL id, so db[seg.id] finds the whole feature.
The segment's own ID= is preserved byte-for-byte in the attributes
blob, so str(segment) reproduces the input line exactly.