SeqDataView#

class SeqDataView(*, parent: str | bytes | ndarray[tuple[int, ...], dtype[integer]], alphabet: CharAlphabet[Any], parent_len: int, seqid: str | None = None, slice_record: SliceRecordABC | None = None, offset: int = 0)#

A view class for SeqsData, providing methods for different representations of a single sequence.

Attributes:
alphabet
array_value

returns the sequence as a numpy array

bytes_value

returns the sequence as bytes

is_reversed

whether the sequence is reversed

offset

the annotation offset of this view

parent
parent_len

length of the parent sequence

parent_offset

returns the offset from the true parent

seqid

name of the sequence

slice_record

the slice state of this view

str_value

returns the sequence as a string

Methods

copy([sliced])

returns copy

parent_coords(*[, apply_offset])

returns coordinates on parent

to_rich_dict()

returns a json serialisable dict.

with_offset(offset)

returns new instance with annotation offset set

Notes

str_value / array_value are not complemented, but can be reversed. The latter is done by the Sequence object which has a moltype.

alphabet#
property array_value: ndarray#

returns the sequence as a numpy array

property bytes_value: bytes#

returns the sequence as bytes

copy(sliced: bool = False) Self#

returns copy

property is_reversed: bool#

whether the sequence is reversed

property offset: int#

the annotation offset of this view

parent#
parent_coords(*, apply_offset: bool = False, **kwargs) tuple[str, int, int, int]#

returns coordinates on parent

Parameters:
apply_offset

if True adds annotation offset from parent

Returns:
parent seqid, start, stop, strand
property parent_len: int#

length of the parent sequence

property parent_offset: int#

returns the offset from the true parent

Notes

If from storage with an offset attribute, returns that value or 0

property seqid: str | None#

name of the sequence

property slice_record: SliceRecordABC#

the slice state of this view

property str_value: str#

returns the sequence as a string

to_rich_dict() dict[str, str | dict[str, str]]#

returns a json serialisable dict.

Warning

This method is not intended to provide serialisation of this object, instead, it is intended for usage by an enclosing class.

Notes

This method will slice the underlying sequence to the start and stop values

with_offset(offset: int) Self#

returns new instance with annotation offset set