Feature#

class Feature(*, parent, seqid: str, map: FeatureMap, biotype: str, name: str, strand: str)#

new style annotation, created on demand

Attributes:
biotype
map
name
parent
reversed

whether Feature is on the reverse strand relative to bound object

seqid

Methods

as_one_span()

returns a feature that preserves any gaps

get_children([biotype])

generator returns sub-features of self optionally matching biotype

get_coordinates()

returns sequence coordinates of this Feature as [(start1, end1), ...]

get_drawable()

returns plotly trace

get_parent(**kwargs)

generator returns parent features of self optionally matching biotype

get_slice([complete, allow_gaps])

The corresponding sequence fragment.

shadow()

returns new instance corresponding to disjoint of self coordinates

to_dict()

returns

union(features)

return as a single Feature

without_lost_spans()

Keeps only the parts which are actually present in the underlying sequence

remapped_to

as_one_span()#

returns a feature that preserves any gaps

property biotype#
get_children(biotype: str | None = None, **kwargs)#

generator returns sub-features of self optionally matching biotype

get_coordinates()#

returns sequence coordinates of this Feature as [(start1, end1), …]

get_drawable()#

returns plotly trace

get_parent(**kwargs)#

generator returns parent features of self optionally matching biotype

get_slice(complete: bool = False, allow_gaps: bool = False)#

The corresponding sequence fragment.

Parameters:
complete

if feature not complete on parent, causes an exception to be raised. If False, gaps are removed.

allow_gaps

if on an alignment, includes the gap positions

Returns:
a slice of self.parent

Notes

If ‘complete’ is true and the full length of this feature is not present in the sequence, then this method will fail.

property map#
property name#
property parent#
remapped_to(grandparent, gmap)#
property reversed#

whether Feature is on the reverse strand relative to bound object

property seqid#
shadow()#

returns new instance corresponding to disjoint of self coordinates

to_dict()#

returns

union(features: Iterable)#

return as a single Feature

Notes

Overlapping spans are merged

without_lost_spans()#

Keeps only the parts which are actually present in the underlying sequence