1 """@namespace IMP.pmi.alphabets
2 Mapping between FASTA one-letter codes and residue types.
5 from __future__
import print_function
10 """Map between FASTA codes and residue types.
11 Typically one would use the `amino_acid`, `rna`, or `dna` objects."""
12 def __init__(self, charmm_to_one, chain_type=IMP.atom.UnknownChainType):
13 self._one_to_charmm = {}
14 for k, v
in charmm_to_one.items():
15 self._one_to_charmm[v] = k
16 self.charmm_to_one = charmm_to_one
17 self._chain_type = chain_type
20 """Given a one-letter code, return an IMP.atom.ResidueType"""
24 """Given a residue type, return a one-letter code"""
27 return self.charmm_to_one.get(rt,
'X')
30 """Get the IMP.atom.ChainType for this alphabet"""
31 return self._chain_type
34 """Mapping between FASTA one-letter codes and residue types for amino acids"""
36 {
'ALA':
'A',
'ARG':
'R', 'ASN': 'N', 'ASP': 'D',
37 'CYS':
'C',
'GLU':
'E',
'GLN':
'Q',
'GLY':
'G',
38 'HIS':
'H',
'ILE':
'I',
'LEU':
'L',
'LYS':
'K',
39 'MET':
'M',
'PHE':
'F',
'PRO':
'P',
'SER':
'S',
40 'THR':
'T',
'TRP':
'W',
'TYR':
'Y',
'VAL':
'V',
41 'UNK':
'X'}, IMP.atom.Protein)
44 """Mapping between FASTA one-letter codes and residue types for DNA"""
46 {
'DADE':
'A',
'DURA':
'U', 'DCYT': 'C', 'DGUA': 'G',
47 'DTHY':
'T',
'UNK':
'X'}, IMP.atom.DNA)
50 """Mapping between FASTA one-letter codes and residue types for RNA"""
52 {
'ADE':
'A',
'URA':
'U', 'CYT': 'C', 'GUA': 'G',
53 'THY':
'T',
'UNK':
'X'}, IMP.atom.RNA)
def get_one_letter_code_from_residue_type
Given a residue type, return a one-letter code.
Map between FASTA codes and residue types.
def get_residue_type_from_one_letter_code
Given a one-letter code, return an IMP.atom.ResidueType.
Functionality for loading, creating, manipulating and scoring atomic structures.
def get_chain_type
Get the IMP.atom.ChainType for this alphabet.