Aligned#
- class Aligned(data: AlignedDataView, moltype: MolType, name: str | None = None, annotation_db: SupportsFeatures | None = None)#
A single sequence in an alignment.
- Attributes:
- annotation_db
- data
gapped_seq
Returns Sequence object, including gaps.
- map
- moltype
- name
seq
the ungapped sequence.
Methods
annotate_matches_to
(pattern, biotype, name)Adds an annotation at sequence positions matching pattern.
Returns gap_vector of positions.
make_feature
(feature, alignment)returns a feature, not written into annotation_db
parent_coordinates
([seq_coords])returns seqid, start, stop, strand on the parent sequence
slice_with_map
Notes
This is a wrapper around a
AlignedDataView
. This class performs any complenting needed. It can be cast directly to a string or numpy array, e.g.numpy.array(<aligned instance>)
returns a numpy unsigned 8-bit integer array.- annotate_matches_to(pattern: str, biotype: str, name: str, allow_multiple: bool = False)#
Adds an annotation at sequence positions matching pattern.
- Parameters:
- pattern
The search string for which annotations are made. IUPAC ambiguities are converted to regex on sequences with the appropriate MolType.
- biotype
The type of the annotation (e.g. “domain”).
- name
The name of the annotation.
- allow_multiple
If True, allows multiple occurrences of the input pattern. Otherwise, only the first match is used.
- Returns:
- Returns a list of Feature instances.
- property annotation_db#
- property data: AlignedDataView#
- gap_vector() list[bool] #
Returns gap_vector of positions.
- property gapped_seq: Sequence#
Returns Sequence object, including gaps.
- make_feature(feature: FeatureDataType, alignment: Alignment) Feature #
returns a feature, not written into annotation_db
- property map: IndelMap#
- property name: str#
- parent_coordinates(seq_coords=False)#
returns seqid, start, stop, strand on the parent sequence
- Parameters:
- seq_coords
if True, the coordinates for the unaligned sequence
- property seq: Sequence#
the ungapped sequence.
- slice_with_map(span: FeatureMap) tuple[ndarray, ndarray] #