- class biotite.sequence.GeneralSequence(alphabet, sequence=())¶
The alphabet of this sequence.
- sequenceiterable object, optional
The symbol sequence, the
Sequenceis initialized with. For alphabets containing single letter strings, this parameter may also be a
strobject. By default the sequence is empty.
This function simply replaces the sequence code of the given sequence with the sequence code of this object.
The Sequence whose sequence code is replaced with the one of this object. The alphabet must equal or extend the alphabet of this object.
The input sequence with replaced sequence code.
Copy the object.
- new_seq_codendarray, optional
If this parameter is set, the sequence code is set to this value, rather than the original sequence code.
A copy of this object.
- static dtype(alphabet_size)¶
Get the sequence code dtype required for the given size of the alphabet.
This method must be overwritten, when subclassing
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.
A dictionary containing the symbols as keys and the corresponding number of occurences in the sequence as values.
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.
True, if the sequence is valid, false otherwise.
- copybool, optional
If set to False, the code
ndarrayof 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.
>>> dna_seq = NucleotideSequence("ACGTA") >>> dna_seq_rev = dna_seq.reverse() >>> print(dna_seq_rev) ATGCA