Package Biskit :: Module molUtils
[hide private]
[frames] | no frames]

Module molUtils

source code

Utilities for handling structures and sequences

Classes [hide private]
  MolUtilError
  Test
Test class

Functions [hide private]
[str] allAACodes()
Returns list of all single AA codes, including B, Z, X
[str] allAA()
Returns list of all 20 'exact' single AA codes.
p|u OR None elementType(eLetter)
Classify an atom as polar or unpolar:
a|c|p OR None resType(resCode)
Classify residues as aromatic (a), charged (c) or polar (p).
[str] singleAA(seq, xtable=xxDic)
convert list with 3-letter AA code to list with 1-letter code
[str] single2longAA(seq)
Convert string of 1-letter AA code into list of 3-letter AA codes.
  positionByDescription(model, descr, report=0)
Returns int or list of matching positions
[-1|0|1] cmpAtoms(a1, a2)
Comparison function for bringing atoms into standard order within residues as defined by atomDic.
PDBModel sortAtomsOfModel(model)
Sort atoms within residues into the standard order defined in atomDic.

Variables [hide private]
  aaDicStandard = {'asp': 'D', 'glu': 'E', 'lys': 'K', 'his': 'H', 'ar...
  nsDicStandard = {'atp': 'A', 'gtp': 'G', 'ctp': 'C', 'thy': 'T', 'ur...
  aaDic = copy.copy(aaDicStandard)
  xxDic = {'tip3': '~', 'hoh': '~', 'wat': '~', 'cl-': '-', 'n...
  nonStandardAA = {'UNK': 'ALA', 'ABA': 'ALA', 'B2A': 'ALA', 'ORN': 'A...
  aaAtoms = {'GLY': ['N', 'CA', 'C', 'O', 'OXT'], 'ALA': ['N', '...
  elements = {'carbon': ['C', 'CD2', 'CZ2', 'CB', 'CA', 'CG', 'CE...
  aaAtomsH = {'XXX': {'N': 1, 'CA': 1, 'C': 0, 'O': 0, 'OXT': 0},...
  nsAtoms = {'ATP': ['PG', 'O1G', 'O2G', 'O3G', 'PB', 'O1B', 'O2...
  resDic = copy.copy(aaDic)
  atomDic = copy.copy(aaAtoms)
  atomSynonyms = {"O'": 'O', 'OT1': 'O', "O''": 'OXT', 'OT2': 'OXT', ...
  hydrogenSynonyms = {'H': 'HN', '1HE2': 'HE21', '2HE2': 'HE22', '1HH1': ...
  hbonds = {'donors': {'GLY': ['H', 'H1', 'H2', 'H3'], 'ALA': [...
  polarH = {'GLY': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N'},...
  pairScore = {'WW': 5.85, 'WY': 6.19, 'RT': 3.77, 'RV': 4.18, 'RW...
  boltzmann = 1.38066e-23
  NA = 6.02214199e+23
  planck2 = 1.0545727e-34
  euler = N.e
  mu = 1.66056e-27
  angstroem = 1e-10
  calorie = 4.184
  atomMasses = {'H': 1.00797, 'C': 12.01115, 'N': 14.0067, 'S': 32....
  test = Test()

Function Details [hide private]

allAACodes()

source code 
Returns: [str]
list of all single AA codes, including B, Z, X

allAA()

source code 
Returns: [str]
list of all 20 'exact' single AA codes.

elementType(eLetter)

source code 

Classify an atom as polar or unpolar:
 atomType( eLetter ) -> list of types this element belongs to
Parameters:
  • eLetter (str) - atom name
Returns: p|u OR None
return 'p' for polar, 'u' for unpolar and None if not in classified

resType(resCode)

source code 

Classify residues as aromatic (a), charged (c) or polar (p).
Parameters:
  • resCode (str) - amino acid code
Returns: a|c|p OR None
list of types this residue belongs to...

singleAA(seq, xtable=xxDic)

source code 

convert list with 3-letter AA code to list with 1-letter code
Parameters:
  • seq ([str]) - amino acid sequence in 3-letter code
  • xtable (dict) - dictionary with additional str:single_char mapping
Returns: [str]
list with 1-letter code; ['A','C','L','A'...]

single2longAA(seq)

source code 

Convert string of 1-letter AA code into list of 3-letter AA codes.
Parameters:
  • seq (str) - amino acid sequence in 1-letter code
Returns: [str]
list with the amino acids in 3-letter code

positionByDescription(model, descr, report=0)

source code 
Parameters:
  • descr (dict) - dictionary with keys from the atom dictionary
  • report (1|0) - write a message to stdOut
Returns:
int or list of matching positions

Note:

Obsolete: use PDBModel.filter instead.

Find the position of an atom(s) in the atom dictioanry by description. If the description matches more than one atom a list of matching positions is returned.

Example atom dictioary (valid keys):
 {'name': 'OG1', 'residue_number': 20, 'insertion_code': '',
  'alternate': '', 'name_original': ' OG1',
  'temperature_factor': 23.640000000000001, 'occupancy': 1.0,
  'element': 'O', 'segment_id': 'RECA', 'charge': '',
  'residue_name': 'THR', 'serial_number': 201, 'type': 'ATOM',
  'chain_id': ''}

cmpAtoms(a1, a2)

source code 

Comparison function for bringing atoms into standard order within residues as defined by atomDic.
Parameters:
  • a1 (PDBModel.atoms) - atom dictionary
  • a2 (PDBModel.atoms) - atom dictionary
Returns: [-1|0|1]
int or list of matching positions

sortAtomsOfModel(model)

source code 

Sort atoms within residues into the standard order defined in atomDic.
Parameters:
  • model (PDBModel) - model to sort
Returns: PDBModel
model with sorted atoms

Variables Details [hide private]

aaDicStandard

Value:
{'asp': 'D', 'glu': 'E', 'lys': 'K', 'his': 'H', 'arg': 'R', 'gln': 'Q
', 'asn': 'N', 'ser': 'S', 'asx': 'B', 'glx': 'Z', 'phe': 'F', 'trp': 
'W', 'tyr': 'Y', 'gly': 'G', 'ala': 'A', 'ile': 'I', 'leu': 'L', 'cys'
: 'C', 'met': 'M', 'thr': 'T', 'val': 'V', 'pro': 'P'}                 
      

nsDicStandard

Value:
{'atp': 'A', 'gtp': 'G', 'ctp': 'C', 'thy': 'T', 'ura': 'U'}           
      

aaDic

Value:
copy.copy(aaDicStandard)                                               
      

xxDic

Value:
{'tip3': '~', 'hoh': '~', 'wat': '~', 'cl-': '-', 'na+': '+', 'ndp': '
X', 'nap': 'X'}                                                        
      

nonStandardAA

Value:
{'UNK': 'ALA', 'ABA': 'ALA', 'B2A': 'ALA', 'ORN': 'ARG', 'ASX': 'ASP',
 'CSH': 'CYS', 'OCS': 'CYS', 'CSO': 'CYS', 'GLX': 'GLU', 'CGU': 'GLU',
 'ILG': 'GLU', 'B2I': 'ILE', 'BLE': 'LEU', 'KCX': 'LYS', 'BLY': 'LYS',
 'MSE': 'MET', 'B1F': 'PHE', 'B2F': 'PHE', 'HYP': 'PRO', '5HP': 'PRO',
 'SEP': 'SER', 'TYS': 'TYR', 'B2V': 'B2V', 'HIE': 'HIS', 'HID': 'HIS',
 'HIP': 'HIS', 'CYX': 'CYS'}                                           
      

aaAtoms

Value:
{'GLY': ['N', 'CA', 'C', 'O', 'OXT'], 'ALA': ['N', 'CA', 'C', 'O', 'CB
', 'OXT'], 'VAL': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'OXT'], 'L
EU': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2', 'OXT'], 'ILE': ['
N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'CD1', 'OXT'], 'MET': ['N', 'C
A', 'C', 'O', 'CB', 'CG', 'SD', 'CE', 'OXT'], 'PRO': ['N', 'CA', 'C', 
'O', 'CB', 'CG', 'CD', 'OXT'], 'PHE': ['N', 'CA', 'C', 'O', 'CB', 'CG'
, 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OXT'], 'TRP': ['N', 'CA', 'C', 'O
', 'CB', 'CG', 'CD1', 'CD2', 'NE1', 'CE2', 'CE3', 'CZ2', 'CZ3', 'CH2',
...                                                                    
      

elements

Value:
{'carbon': ['C', 'CD2', 'CZ2', 'CB', 'CA', 'CG', 'CE', 'CD', 'CZ', 'CH
2', 'CE3', 'CD1', 'CE1', 'CZ3', 'CG1', 'CG2', 'CE2'], 'nitrogen': ['NZ
', 'ND2', 'NH1', 'NH2', 'ND1', 'NE1', 'NE2', 'NE', 'N'], 'oxygen': ['O
G', 'OE2', 'OXT', 'OD1', 'OE1', 'OH', 'OG1', 'OD2', 'O'], 'suplphur': 
['SG', 'SD'], 'clustering_BDZ': ['C', 'CB', 'CD', 'CD1', 'CD2', 'CZ', 
'CZ2', 'CZ3', 'ND1', 'ND2', 'NZ', 'OD1', 'OD2', 'SD'], 'clustering_ABD
Z': ['C', 'CA', 'CB', 'CD', 'CD1', 'CD2', 'CZ', 'CZ2', 'CZ3', 'ND1', '
ND2', 'NZ', 'OD1', 'OD2', 'SD'], 'clustering_G': ['C', 'CG', 'CG1', 'O
...                                                                    
      

aaAtomsH

Value:
{'XXX': {'N': 1, 'CA': 1, 'C': 0, 'O': 0, 'OXT': 0}, 'GLY': {}, 'ALA':
 {'CB': 3}, 'VAL': {'CB': 0, 'CG1': 3, 'CG2': 3}, 'LEU': {'CB': 2, 'CG
': 0, 'CD1': 3, 'CD2': 3}, 'ILE': {'CB': 0, 'CG1': 1, 'CG2': 3, 'CD1':
 3}, 'MET': {'CB': 2, 'CG': 2, 'SD': 0, 'CE': 3}, 'PRO': {'N': 0, 'CB'
: 2, 'CG': 2, 'CD': 2}, 'PHE': {'CB': 2, 'CG': 0, 'CD1': 1, 'CD2': 1, 
'CE1': 1, 'CE2': 1, 'CZ': 1}, 'TRP': {'CB': 2, 'CG': 0, 'CD1': 1, 'CD2
': 0, 'NE1': 1, 'CE2': 0, 'CE3': 1, 'CZ2': 1, 'CZ3': 1, 'CH2': 1}, 'SE
R': {'CB': 2, 'OG': 1}, 'THR': {'CB': 0, 'OG1': 1, 'CG2': 3}, 'ASN': {
...                                                                    
      

nsAtoms

Value:
{'ATP': ['PG', 'O1G', 'O2G', 'O3G', 'PB', 'O1B', 'O2B', 'O3B', 'PA', '
O1A', 'O2A', 'O3A', 'O5*', 'C5*', 'C4*', 'O4*', 'C3*', 'O3*', 'C2*', '
O2*', 'C1*', 'N9', 'C8', 'N7', 'C5', 'C6', 'N6', 'N1', 'C2', 'N3', 'C4
'], 'GTP': ['PG', 'O1G', 'O2G', 'O3G', 'PB', 'O1B', 'O2B', 'O3B', 'PA'
, 'O1A', 'O2A', 'O3A', 'O5*', 'C5*', 'C4*', 'O4*', 'C3*', 'O3*', 'C2*'
, 'O2*', 'C1*', 'N9', 'C8', 'N7', 'C5', 'C6', 'O6', 'N1', 'C2', 'N2', 
'N3', 'C4'], 'MG': ['MG'], 'NDP': ['P1', 'O1', 'O2', 'O5R', 'C5R', 'O1
R', 'C4R', 'C3R', 'O3R', 'C2R', 'O2R', 'C1R', 'N9', 'C8', 'N7', 'C5', 
...                                                                    
      

resDic

Value:
copy.copy(aaDic)                                                       
      

atomDic

Value:
copy.copy(aaAtoms)                                                     
      

atomSynonyms

Value:
{"O'": 'O', 'OT1': 'O', "O''": 'OXT', 'OT2': 'OXT', 'O1': 'O', 'O2': '
OXT', 'CD': 'CD1'}                                                     
      

hydrogenSynonyms

Value:
{'H': 'HN', '1HE2': 'HE21', '2HE2': 'HE22', '1HH1': 'HH11', '2HH1': 'H
H12', '1HH2': 'HH21', '2HH2': 'HH22', '1HD2': 'HD21', '2HD2': 'HD22'}  
      

hbonds

Value:
{'donors': {'GLY': ['H', 'H1', 'H2', 'H3'], 'ALA': ['H', 'H1', 'H2', '
H3'], 'VAL': ['H', 'H1', 'H2', 'H3'], 'LEU': ['H', 'H1', 'H2', 'H3'], 
'ILE': ['H', 'H1', 'H2', 'H3'], 'MET': ['H', 'H1', 'H2', 'H3'], 'PRO':
 ['H', 'H1', 'H2', 'H3'], 'PHE': ['H', 'H1', 'H2', 'H3'], 'TRP': ['H',
 'H1', 'H2', 'H3', 'HE1'], 'SER': ['H', 'H1', 'H2', 'H3', 'HG'], 'THR'
: ['H', 'H1', 'H2', 'H3', 'HG1'], 'ASN': ['H', 'H1', 'H2', 'H3', '1HD2
', '2HD2'], 'GLN': ['H', 'H1', 'H2', 'H3', '1HE2', '2HE2'], 'TYR': ['H
', 'H1', 'H2', 'H3', 'HH'], 'CYS': ['H', 'H1', 'H2', 'H3', 'HG'], 'LYS
...                                                                    
      

polarH

Value:
{'GLY': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N'}, 'ALA': {'H': 'N',
 'H1': 'N', 'H2': 'N', 'H3': 'N'}, 'VAL': {'H': 'N', 'H1': 'N', 'H2': 
'N', 'H3': 'N'}, 'LEU': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N'}, '
ILE': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N'}, 'MET': {'H': 'N', '
H1': 'N', 'H2': 'N', 'H3': 'N'}, 'PRO': {'H': 'N', 'H1': 'N', 'H2': 'N
', 'H3': 'N'}, 'PHE': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N'}, 'TR
P': {'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N', 'HE1': 'NE1'}, 'SER': 
{'H': 'N', 'H1': 'N', 'H2': 'N', 'H3': 'N', 'HG': 'OG'}, 'THR': {'H': 
...                                                                    
      

pairScore

Value:
{'WW': 5.85, 'WY': 6.19, 'RT': 3.77, 'RV': 4.18, 'RW': 8.57, 'RR': 2.8
7, 'RS': 2.82, 'RY': 5.28, 'GW': 1.42, 'GV':-0.41, 'GT': 0.21, 'GS':-1
.53, 'GR': 1.59, 'GQ': 1.70, 'GP':-0.51, 'GY': 1.25, 'GG':-4.40, 'GN':
-0.54, 'GM': 0.91, 'GL':-0.37, 'GK': 1.33, 'GI': 0.77, 'GH': 1.08, 'SS
':-0.09, 'IY': 5.61, 'HY': 6.05, 'HR': 4.90, 'HS': 0.80, 'HP': 2.89, '
HQ': 4.00, 'HV': 3.21, 'HW': 6.46, 'HT': 2.71, 'KN': 3.17, 'HK': 2.72,
 'HH': 5.37, 'HI': 3.38, 'HN': 2.38, 'HL': 4.88, 'HM': 4.65, 'ST': 1.9
1, 'PR': 3.99, 'PS': 1.33, 'PP': 0.60, 'PQ': 3.50, 'PV': 2.90, 'PW': 7
...                                                                    
      

boltzmann

Value:
1.38066e-23                                                            
      

NA

Value:
6.02214199e+23                                                         
      

planck2

Value:
1.0545727e-34                                                          
      

euler

Value:
N.e                                                                    
      

mu

Value:
1.66056e-27                                                            
      

angstroem

Value:
1e-10                                                                  
      

calorie

Value:
4.184                                                                  
      

atomMasses

Value:
{'H': 1.00797, 'C': 12.01115, 'N': 14.0067, 'S': 32.064, 'O': 15.9994,
 'P': 30.9738}                                                         
      

test

Value:
Test()