SeqView#

class SeqView(*, parent: str | bytes | ndarray, alphabet: CharAlphabet, parent_len: int, seqid: str | None = None, slice_record: SliceRecordABC = None, offset: int = 0)#

Provides a view of a sequence with support for slicing operations.

This class represents a view of a sequence. It uses SliceRecord to enable efficient slicing without altering the original sequence data.

Parameters:
parent

the original sequence data

alphabet

the alphabet object defining valid characters for the sequence

seqid

the name or identifier of the sequence

parent_len

the length of the sequence. Defaults to the length of the input sequence

Attributes:
alphabet
array_value

returns the sequence as a array of indices

bytes_value

returns the sequence as a bytes string

is_reversed

whether the sequence is reversed

offset

the annotation offset of this view

parent
parent_len

length of the parent sequence

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

with_offset(offset)

returns new instance with annotation offset set

Notes

It utilises the alphabet object to allow providing different types such as strings or numpy arrays, corresponding to its underlying data.

alphabet#
property array_value: ndarray[int]#

returns the sequence as a array of indices

property bytes_value: bytes#

returns the sequence as a bytes string

copy(sliced: bool = False) Self#

returns copy

Parameters:
sliced

if True, the underlying sequence is truncated and the start/stop adjusted

property is_reversed: bool#

whether the sequence is reversed

property offset: int#

the annotation offset of this view

parent#
property parent_len: int#

length of the parent sequence

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

with_offset(offset: int) Self#

returns new instance with annotation offset set