core.seqview.SeqView
core.seqview.SeqView(
parent,
alphabet,
parent_len,
seqid=None,
slice_record=None,
offset=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
| Name | Type | Description | Default |
|---|---|---|---|
| parent | str | bytes | NumpyIntArrayType | SeqsDataABC | the original sequence data | required |
| alphabet | c3_alphabet.CharAlphabet[Any] | the alphabet object defining valid characters for the sequence | required |
| seqid | str | None | the name or identifier of the sequence | None |
| parent_len | int | the length of the sequence. Defaults to the length of the input sequence | required |
Notes
It utilises the alphabet object to allow providing different types such as strings or numpy arrays, corresponding to its underlying data.
Attributes
| Name | Description |
|---|---|
| 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_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
| Name | Description |
|---|---|
| copy | returns copy |
| parent_coords | returns coordinates on parent |
| with_offset | returns new instance with annotation offset set |
copy
core.seqview.SeqView.copy(sliced=False)returns copy
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| sliced | bool | if True, the underlying sequence is truncated and the start/stop adjusted | False |
parent_coords
core.seqview.SeqView.parent_coords(apply_offset=False, **kwargs)returns coordinates on parent
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| apply_offset | bool | if True adds annotation offset from parent | False |
Returns
| Name | Type | Description |
|---|---|---|
| parent seqid, start, stop, strand |
with_offset
core.seqview.SeqView.with_offset(offset)returns new instance with annotation offset set