SeqsData#

class SeqsData(*, data: dict[str, str | bytes | ndarray[int]], alphabet: AlphabetABC, offset: dict[str, int] = None, check: bool = True)#

The builtin cogent3 implementation of a collection of sequences underlying a SequenceCollection. The sequence data is stored as numpy arrays. Indexing this object (using an int or seq name) returns a SeqDataView, which can realise the corresponding slice as a string, bytes, or numpy array via the alphabet.

Attributes:
alphabet
names
offset

Methods

add_seqs(seqs[, force_unique_keys, offset])

Returns a new SeqsData object with added sequences.

get_seq_length(seqid)

return length for seqid

from_seqs

get_seq_array

get_seq_bytes

get_seq_str

get_view

to_alphabet

Notes

Methods on this object only accepts plust strand start, stop and step indices for selecting segments of data. It can return the gap coordinates for a sequence as used by IndelMap.

add_seqs(seqs: dict[str, str | bytes | ndarray[int]], force_unique_keys=True, offset=None) SeqsData#

Returns a new SeqsData object with added sequences. If force_unique_keys is True, raises ValueError if any names already exist in the collection.

property alphabet: AlphabetABC#
classmethod from_seqs(*, data: dict[str, str | bytes | ndarray[int]], alphabet: AlphabetABC, **kwargs)#
get_seq_array(*, seqid: str, start: int | None = None, stop: int | None = None, step: int | None = None) ndarray#
get_seq_bytes(*, seqid: str, start: int | None = None, stop: int | None = None, step: int | None = None) bytes#
get_seq_length(seqid: str) int#

return length for seqid

get_seq_str(*, seqid: str, start: int | None = None, stop: int | None = None, step: int | None = None) str#
get_view(seqid: str) SeqDataView#
property names: list#
property offset: dict[str, int]#
to_alphabet(alphabet: AlphabetABC, check_valid=True) SeqsData#