Sequences¶
The Sequence
object provides generic biological sequence manipulation functions, plus functions that are critical for the evolve
module calculations.
Generic molecular types¶
Sequence properties are affected by the moltype you specify. The default type for a sequence is "text"
.
In some circumstances you can also have a "bytes"
moltype, which I’ll explicitly construct here.
DNA and RNA sequences¶
Creating a DNA sequence from a string¶
Sequence properties are affected by the moltype you specify. Here we specify the DNA
MolType
.
Creating a RNA sequence from a string¶
Converting to FASTA format¶
Convert a RNA sequence to FASTA format¶
Creating a named sequence¶
You can also use a convenience make_seq()
function, providing the moltype as a string.
Setting or changing the name of a sequence¶
Complementing a DNA sequence¶
Reverse complementing a DNA sequence¶
Translate a DnaSequence
to protein¶
Converting a DNA sequence to RNA¶
Convert an RNA sequence to DNA¶
Testing complementarity¶
Joining two DNA sequences¶
Slicing DNA sequences¶
Getting 3rd positions from codons¶
The easiest approach is to work off the cogent3
ArrayAlignment
object.
Getting 1st and 2nd positions from codons¶
In this instance we can use features.