mutcleaner.core.alphabet#

Classes

BaseAlphabet(letters, name)

Base class for biological alphabets

DNAAlphabet([include_ambiguous])

By default, the DNA alphabet accepts the four standard bases A, C, G, and T.

ProteinAlphabet([include_stop, ...])

By default, the protein alphabet accepts the 20 standard amino acids and the stop symbol (*).

RNAAlphabet([include_ambiguous])

By default, the RNA alphabet accepts the four standard bases A, C, G, and U.

class mutcleaner.core.alphabet.BaseAlphabet(letters, name)[source]#

Bases: ABC

Base class for biological alphabets

Methods

get_invalid_chars(sequence)

Get set of invalid characters in sequence

is_valid_char(char)

Check if character is valid in this alphabet

is_valid_sequence(sequence)

Check if entire sequence is valid

validate_sequence(sequence)

Validate sequence and raise error if invalid

get_invalid_chars(sequence)[source]#

Get set of invalid characters in sequence

Return type:

Set[str]

is_valid_char(char)[source]#

Check if character is valid in this alphabet

Return type:

bool

is_valid_sequence(sequence)[source]#

Check if entire sequence is valid

Return type:

bool

validate_sequence(sequence)[source]#

Validate sequence and raise error if invalid

Return type:

str

class mutcleaner.core.alphabet.DNAAlphabet(include_ambiguous=False)[source]#

Bases: BaseAlphabet

By default, the DNA alphabet accepts the four standard bases A, C, G, and T.

The alphabet can also include IUPAC ambiguity codes for positions where more than one base is possible.

Parameters:

include_ambiguous (bool) – Also accept the IUPAC ambiguity codes R, Y, S, W, K, M, B, D, H, V, and N.

Methods

get_invalid_chars(sequence)

Get set of invalid characters in sequence

is_valid_char(char)

Check if character is valid in this alphabet

is_valid_sequence(sequence)

Check if entire sequence is valid

validate_sequence(sequence)

Validate sequence and raise error if invalid

class mutcleaner.core.alphabet.ProteinAlphabet(include_stop=True, include_ambiguous=False, include_sec_pyl=False)[source]#

Bases: BaseAlphabet

By default, the protein alphabet accepts the 20 standard amino acids and the stop symbol (*).

The alphabet can also include selenocysteine and pyrrolysine, ambiguous residue symbols, or both.

Parameters:
  • include_stop (bool) – Accept the stop symbol (*).

  • include_ambiguous (bool) – Accept the ambiguous residue symbols B, Z, J, and X.

  • include_sec_pyl (bool) – Accept selenocysteine (U) and pyrrolysine (O).

Methods

get_invalid_chars(sequence)

Get set of invalid characters in sequence

get_one_letter_code(three_letter[, strict])

Convert three-letter to one-letter amino acid code

get_three_letter_code(one_letter[, strict])

Convert one-letter to three-letter amino acid code

is_valid_char(char)

Check if character is valid in this alphabet

is_valid_sequence(sequence)

Check if entire sequence is valid

validate_sequence(sequence)

Validate sequence and raise error if invalid

get_one_letter_code(three_letter, strict=True)[source]#

Convert three-letter to one-letter amino acid code

Return type:

str

get_three_letter_code(one_letter, strict=True)[source]#

Convert one-letter to three-letter amino acid code

Return type:

str

class mutcleaner.core.alphabet.RNAAlphabet(include_ambiguous=False)[source]#

Bases: BaseAlphabet

By default, the RNA alphabet accepts the four standard bases A, C, G, and U.

The alphabet can also include IUPAC ambiguity codes for positions where more than one base is possible.

Parameters:

include_ambiguous (bool) – Also accept the IUPAC ambiguity codes R, Y, S, W, K, M, B, D, H, V, and N.

Methods

get_invalid_chars(sequence)

Get set of invalid characters in sequence

is_valid_char(char)

Check if character is valid in this alphabet

is_valid_sequence(sequence)

Check if entire sequence is valid

validate_sequence(sequence)

Validate sequence and raise error if invalid