core.seq_storage.SeqsData

core.seq_storage.SeqsData(
    data,
    alphabet,
    offset=None,
    check=True,
    reversed_seqs=None,
)

The builtin cogent3 implementation of sequence storage 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.

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.

Attributes

Name Description
alphabet the character alphabet for validating, encoding, decoding sequences
names returns the names of the sequences in the storage
offset annotation offsets for each sequence
reversed_seqs names of sequences that are reverse complemented

Methods

Name Description
add_seqs Returns a new SeqsData object with added sequences. If force_unique_keys
copy shallow copy of self
get_hash returns hash of seqid
get_seq_bytes Return ungapped sequence corresponding to seqid as a bytes string.
get_seq_length return length for seqid
get_seq_str Return ungapped sequence corresponding to seqid as a string.
get_view reurns view of sequence data for seqid

add_seqs

core.seq_storage.SeqsData.add_seqs(seqs, force_unique_keys=True, offset=None)

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

copy

core.seq_storage.SeqsData.copy(**kwargs)

shallow copy of self

Notes

kwargs are passed to constructor and will over-ride existing values

get_hash

core.seq_storage.SeqsData.get_hash(seqid)

returns hash of seqid

get_seq_bytes

core.seq_storage.SeqsData.get_seq_bytes(seqid, start=None, stop=None, step=None)

Return ungapped sequence corresponding to seqid as a bytes string. start/stop are in sequence coordinates. Excludes gaps.

get_seq_length

core.seq_storage.SeqsData.get_seq_length(seqid)

return length for seqid

get_seq_str

core.seq_storage.SeqsData.get_seq_str(seqid, start=None, stop=None, step=None)

Return ungapped sequence corresponding to seqid as a string. start/stop are in sequence coordinates. Excludes gaps.

get_view

core.seq_storage.SeqsData.get_view(seqid)

reurns view of sequence data for seqid