cogent3.core.seqview.SeqView#
- class SeqView(*, parent: str | bytes | NumpyIntArrayType | SeqsDataABC, alphabet: c3_alphabet.CharAlphabet[Any], parent_len: int, seqid: str | None = None, slice_record: SliceRecordABC | None = 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
SliceRecordto 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_valuereturns the sequence as a array of indices
bytes_valuereturns the sequence as a bytes string
is_reversedwhether the sequence is reversed
offsetthe annotation offset of this view
- parent
parent_lenlength of the parent sequence
parent_offsetreturns the offset from the true parent
seqidname of the sequence
slice_recordthe slice state of this view
str_valuereturns the sequence as a string
Methods
copy([sliced])returns copy
parent_coords(*[, apply_offset])returns coordinates on parent
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.