Biological Alphabets#
Base#
- class pyhmmer.easel.Alphabet#
A biological alphabet, including additional marker symbols.
This type is used to share an alphabet to several objects in the
easelandplan7modules. Reference counting helps sharing the same instance everywhere, instead of reallocating memory every time an alphabet is needed.Use the factory class methods to obtain a default
Alphabetfor one of the three standard biological alphabets:>>> dna = Alphabet.dna() >>> rna = Alphabet.rna() >>> aa = Alphabet.amino()
- classmethod amino()#
Create a default amino-acid alphabet.
- Returns:
pyhmmer.easel.AA– A new amino-acid alphabet object.
- decode(sequence)#
Decode a raw digital sequence into its textual representation.
- Parameters:
sequence (
object, buffer-like) – A raw sequence in digital format. Any object implementing the buffer protocol (likebytearray,VectorU8, etc.) may be given.- Returns:
str– A raw sequence in textual format.
Example
>>> alphabet = easel.Alphabet.amino() >>> dseq = easel.VectorU8([0, 4, 2, 17, 3, 13, 0, 0, 5]) >>> alphabet.decode(dseq) 'AFDVEQAAG'
Added in version 0.6.3.
- classmethod dna()#
Create a default DNA alphabet.
- Returns:
pyhmmer.easel.DNA– A new DNA alphabet object.
- encode(sequence)#
Encode a raw text sequence into its digital representation.
- Parameters:
sequence (
str) – A raw sequence in text format.- Returns:
VectorU8– A raw sequence in digital format.
Example
>>> alphabet = easel.Alphabet.dna() >>> alphabet.encode("ACGT") VectorU8([0, 1, 2, 3])
Added in version 0.6.3.
- classmethod rna()#
Create a default RNA alphabet.
- Returns:
pyhmmer.easel.RNA– A new RNA alphabet object.
- K#
The alphabet size, counting only actual alphabet symbols.
Example
>>> Alphabet.dna().K 4 >>> Alphabet.amino().K 20
- Type:
- Kp#
The complete alphabet size, including marker symbols.
Example
>>> Alphabet.dna().Kp 18 >>> Alphabet.amino().Kp 29
- Type:
- symbols#
The symbols composing the alphabet.
Example
>>> Alphabet.dna().symbols 'ACGT-RYMKSWHBVDN*~' >>> Alphabet.rna().symbols 'ACGU-RYMKSWHBVDN*~'
- Type:
Nucleotide alphabets#
- class pyhmmer.easel.DNA#
- class pyhmmer.easel.RNA#
Protein alphabet#
- class pyhmmer.easel.AA#