Protein sequences#
Note
These docs now use the new_type
core objects via the following setting.
import os
# using new types without requiring an explicit argument
os.environ["COGENT3_NEW_TYPE"] = "1"
Creating a ProteinSequence with a name#
from cogent3 import make_seq
p = make_seq("THISISAPRQTEIN", "myProtein", moltype="protein")
type(p)
cogent3.core.new_sequence.ProteinSequence
p
0 | |
myProtein | THISISAPRQTEIN |
ProteinSequence, length=14
Converting a DNA sequence string to protein sequence string#
from cogent3 import get_code
standard_code = get_code(1)
standard_code.translate("TTTGCAAAC")
'FAN'
Conversion to a ProteinSequence
from a DnaSequence
is shown in Translate a sequence to protein.
Converting a nucleic acid sequence object to protein#
from cogent3 import make_seq
nuc = make_seq("TTTGCAAAC", moltype="dna")
pep = nuc.get_translation()
pep
0 | |
None | FAN |
ProteinSequence, length=3
Loading protein sequences from a Phylip file#
from cogent3 import load_aligned_seqs
seq = load_aligned_seqs("data/abglobin_aa.phylip", moltype="protein")