I3DSequence#

class biotite.structure.alphabet.I3DSequence(sequence='')[source]#

Bases: Sequence

Representation of a structure in the 3Di structural alphabet. [1]

Parameters:
sequenceiterable object, optional

The 3Di sequence. This may either be a list or a string. May take upper or lower case letters. By default the sequence is empty.

See also

to_3di

Create 3Di sequences from a structure.

References

copy(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.

static dtype(alphabet_size)#

Get the sequence code dtype required for the given size of the alphabet.

Parameters:
alpahabet_sizeint

The size of the alphabet.

Returns:
dtype

The dtype, that is large enough to store symbol codes, that are encoded by an Alphabet of the given size.

get_alphabet()#

Get the Alphabet of the Sequence.

This method must be overwritten, when subclassing Sequence.

Returns:
alphabetAlphabet

Sequence alphabet.

get_symbol_frequency()#

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()#

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(copy=True)#

Reverse the Sequence.

Parameters:
copybool, optional

If set to False, the code ndarray of the returned sequence is an array view to the sequence code of this object. In this case, manipulations on the returned sequence would also affect this object. Otherwise, the sequence code is copied.

Returns:
reversedSequence

The reversed Sequence.

Examples

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