Feature#

class Feature(*, parent: Sequence | Alignment, seqid: str, map: FeatureMap, biotype: str, name: str, strand: str, xattr: dict[str, Any] | None = None)#

new style annotation, created on demand

Attributes:
biotype
map
name
parent
reversed

whether Feature is on the reverse strand relative to bound object

seqid
xattr

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, apply_name])

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() Self#

returns a feature that preserves any gaps

property biotype: str#
get_children(biotype: str | None = None, **kwargs) Iterable[Self]#

generator returns sub-features of self optionally matching biotype

get_coordinates() list[tuple[int, int]]#

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

get_drawable() Shape#

returns plotly trace

get_parent(**kwargs) Iterable[Self]#

generator returns parent features of self optionally matching biotype

get_slice(complete: bool = False, allow_gaps: bool = False, apply_name: bool = True) Sequence | Alignment#

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

apply_name

assigns self.name to the resulting seq.name

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: FeatureMap#
property name: str#
property parent: Sequence | Alignment#
remapped_to(grandparent, gmap)#
property reversed: bool#

whether Feature is on the reverse strand relative to bound object

property seqid: str#
shadow() Self#

returns new instance corresponding to disjoint of self coordinates

to_dict() dict[str, Any]#

returns

union(features: Iterable) Self#

return as a single Feature

Notes

Overlapping spans are merged

without_lost_spans() Self#

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

property xattr: dict[str, Any] | None#