core.annotation.Feature

core.annotation.Feature(parent, seqid, map, biotype, name, strand, xattr=None)

new style annotation, created on demand

Attributes

Name Description
biotype type of biological feature
map coordinate map and properties of this feature
name name of the feature
parent sequence or aligned or alignment
reversed whether Feature is on the reverse strand relative to bound object
seqid the sequence id of the parent sequence
xattr extra attributes for this feature

Methods

Name Description
as_one_span returns a feature that preserves any gaps in the underlying sequence
get_children generator returns sub-features of self optionally matching biotype
get_coordinates returns sequence coordinates of this Feature as
get_drawable returns plotly trace
get_parent generator returns parent features of self optionally matching biotype
get_slice The corresponding sequence fragment.
shadow returns new instance corresponding to disjoint of self coordinates
to_dict returns
union return as a single Feature
without_lost_spans Keeps only the parts which are actually present in the underlying sequence

as_one_span

core.annotation.Feature.as_one_span(name=None)

returns a feature that preserves any gaps in the underlying sequence

Parameters

Name Type Description Default
name str | None The name of the one-span feature, by default ‘one-span None

get_children

core.annotation.Feature.get_children(biotype=None, **kwargs)

generator returns sub-features of self optionally matching biotype

get_coordinates

core.annotation.Feature.get_coordinates()

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

get_drawable

core.annotation.Feature.get_drawable()

returns plotly trace

get_parent

core.annotation.Feature.get_parent(**kwargs)

generator returns parent features of self optionally matching biotype

get_slice

core.annotation.Feature.get_slice(
    complete=False,
    allow_gaps=False,
    apply_name=True,
)

The corresponding sequence fragment.

Parameters

Name Type Description Default
complete bool if feature not complete on parent, causes an exception to be raised. If False, gaps are removed. False
allow_gaps bool if on an alignment, includes the gap positions False
apply_name bool assigns self.name to the resulting seq.name True

Returns

Name Type Description
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.

shadow

core.annotation.Feature.shadow(name=None)

returns new instance corresponding to disjoint of self coordinates

Parameters

Name Type Description Default
name str | None The name of the shadow feature, by default ‘not None

to_dict

core.annotation.Feature.to_dict()

returns

union

core.annotation.Feature.union(features)

return as a single Feature

Notes

Overlapping spans are merged

without_lost_spans

core.annotation.Feature.without_lost_spans()

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