core.slice_record.SliceRecord

core.slice_record.SliceRecord(
    parent_len,
    start=None,
    stop=None,
    step=None,
    offset=0,
)

records cumulative slice operations on an object without modifying it

Notes

Basis for lazy evaluation of slicing operations on sequences and alignments. A reference to an instance of this class is used by different view objects.

Attributes

Name Description
parent_start returns the start on the parent plus strand
parent_stop returns the stop on the parent plus strand
plus_start start on plus strand
plus_step step on plus strand
plus_stop stop on plus strand

Methods

Name Description
absolute_position Converts an index relative to the current view to be with respect
copy returns self
relative_position converts an index on the original “Python sequence” into an index
to_rich_dict returns dict suitable for serialisation

absolute_position

core.slice_record.SliceRecord.absolute_position(
    rel_index,
    include_boundary=False,
)

Converts an index relative to the current view to be with respect to the coordinates of the original “Python sequence”.

Parameters

Name Type Description Default
rel_index int relative position with respect to the current view required
include_boundary bool whether considering index as part of a range False

Returns

Name Type Description
the absolute index with respect to the coordinates of the original
sequence (including offset if present).

copy

core.slice_record.SliceRecord.copy(sliced=False)

returns self

relative_position

core.slice_record.SliceRecord.relative_position(abs_index, stop=False)

converts an index on the original “Python sequence” into an index on this “view”

Notes

The returned value DOES NOT reflect python indexing. Importantly, negative values represent positions that precede the current view.

to_rich_dict

core.slice_record.SliceRecord.to_rich_dict()

returns dict suitable for serialisation