\

### Navigation

- index
- next |
- previous |
- PyCogent v1.5.0 documentation »
- PyCogent Cookbook »
- Manipulating biological data »

# Protein sequences

## Creating a ProteinSequence with a name

    >>> from cogent import PROTEIN
    >>> p = PROTEIN.makeSequence('THISISAPRQTEIN','myProtein')
    >>> type(p)
    <class 'cogent.core.sequence.ProteinSequence'>
    >>> str(p)
    'THISISAPRQTEIN'

## Converting a DNA sequence string to protein sequence string

    >>> from cogent.core.genetic_code import DEFAULT as standard_code
    >>> standard_code.translate('TTTGCAAAC')
    'FAN'

Conversion to a `ProteinSequence` from a `DnaSequence` is shown in Translate a DnaSequence to protein.

## Loading protein sequences from a Phylip file

    >>> from cogent import LoadSeqs, PROTEIN
    >>> seq = LoadSeqs('data/abglobin_aa.phylip', moltype=PROTEIN,
    ...              aligned=True)

Loading other formats, or collections of sequences is shown in Loading nucleotide, protein sequences.

### Navigation

- index
- next |
- previous |
- PyCogent v1.5.0 documentation »
- PyCogent Cookbook »
- Manipulating biological data »