biotite.sequence.ProteinSequence

class biotite.sequence.ProteinSequence(sequence=())[source]

Bases: biotite.sequence.sequence.Sequence

Representation of a protein sequence.

Furthermore this class offers a conversion of amino acids from 3-letter code into 1-letter code and vice versa.

Parameters
sequenceiterable object, optional

The initial protein sequence. This may either be a list or a string. May take upper or lower case letters. If a list is given, the list elements can be 1-letter or 3-letter amino acid representations. By default the sequence is empty.

get_alphabet(self)[source]

Get the Alphabet of the Sequence.

This method must be overwritten, when subclassing Sequence.

Returns
alphabetAlphabet

Sequence alphabet.

remove_stops(self)[source]

Remove stop signals from the sequence.

Returns
no_stopProteinSequence

A copy of this sequence without stop signals.

static convert_letter_3to1(symbol)[source]

Convert a 3-letter to a 1-letter amino acid representation.

Parameters
symbolstring

3-letter amino acid representation.

Returns
convertstring

1-letter amino acid representation.

static convert_letter_1to3(symbol)[source]

Convert a 1-letter to a 3-letter amino acid representation.

Parameters
symbolstring

1-letter amino acid representation.

Returns
convertstring

3-letter amino acid representation.

copy(self, new_seq_code=None)

Copy the object.

Parameters
new_seq_codendarray, optional

If this parameter is set, the sequence code is set to this value, rather than the original sequence code.

Returns
copy

A copy of this object.

get_symbol_frequency(self)

Get the number of occurences of each symbol in the sequence.

If a symbol does not occur in the sequence, but it is in the alphabet, its number of occurences is 0.

Returns
frequencydict

A dictionary containing the symbols as keys and the corresponding number of occurences in the sequence as values.

is_valid(self)

Check, if the sequence contains a valid sequence code.

A sequence code is valid, if at each sequence position the code is smaller than the size of the alphabet.

Invalid code means that the code cannot be decoded into symbols. Furthermore invalid code can lead to serious errors in alignments, since the substitution matrix is indexed with an invalid index.

Returns
validbool

True, if the sequence is valid, false otherwise.

reverse(self)

Reverse the Sequence.

Returns
reversedSequence

The reversed Sequence.

Examples

>>> dna_seq = NucleotideSequence("ACGTA")
>>> dna_seq_rev = dna_seq.reverse()
>>> print(dna_seq_rev)
ATGCA