protein.py (pymol-open-source-2.2.0) | : | protein.py (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
# | # | |||
# | # | |||
# | # | |||
from __future__ import print_function | from __future__ import print_function | |||
from . import bond_amber | from . import bond_amber | |||
from . import protein_residues | from . import protein_residues | |||
from . import protein_amber | from . import protein_amber | |||
import chempy.models | ||||
from chempy.neighbor import Neighbor | from chempy.neighbor import Neighbor | |||
from chempy.models import Connected | from chempy.models import Connected | |||
from chempy import Bond,place,feedback | from chempy import Bond,place,feedback | |||
from chempy.cpv import * | from chempy.cpv import * | |||
MAX_BOND_LEN = 2.2 | MAX_BOND_LEN = 2.2 | |||
PEPT_CUTOFF = 1.7 | PEPT_CUTOFF = 1.7 | |||
N_TERMINAL_ATOMS = ('HT','HT1','HT2','HT3','H1','H2','H3', | N_TERMINAL_ATOMS = ('HT','HT1','HT2','HT3','H1','H2','H3', | |||
'1H','2H','3H','1HT','2HT','3HT') | '1H','2H','3H','1HT','2HT','3HT') | |||
skipping to change at line 69 | skipping to change at line 70 | |||
model.bond = new_bond | model.bond = new_bond | |||
#------------------------------------------------------------------------------- -- | #------------------------------------------------------------------------------- -- | |||
def assign_types(model, forcefield = protein_amber, histidine = 'HIE' ): | def assign_types(model, forcefield = protein_amber, histidine = 'HIE' ): | |||
''' | ''' | |||
assigns types: takes HIS -> HID,HIE,HIP and CYS->CYX where appropriate | assigns types: takes HIS -> HID,HIE,HIP and CYS->CYX where appropriate | |||
but does not add any bonds! | but does not add any bonds! | |||
''' | ''' | |||
if feedback['actions']: | if feedback['actions']: | |||
print(" "+str(__name__)+": assigning types...") | print(" "+str(__name__)+": assigning types...") | |||
if str(model.__class__) != 'chempy.models.Indexed': | if not isinstance(model, chempy.models.Indexed): | |||
raise ValueError('model is not an "Indexed" model object') | raise ValueError('model is not an "Indexed" model object') | |||
if model.nAtom: | if model.nAtom: | |||
crd = model.get_coord_list() | crd = model.get_coord_list() | |||
nbr = Neighbor(crd,MAX_BOND_LEN) | nbr = Neighbor(crd,MAX_BOND_LEN) | |||
res_list = model.get_residues() | res_list = model.get_residues() | |||
if len(res_list): | if len(res_list): | |||
for a in res_list: | for a in res_list: | |||
base = model.atom[a[0]] | base = model.atom[a[0]] | |||
if not base.hetatm: | if not base.hetatm: | |||
resn = base.resn | resn = base.resn | |||
skipping to change at line 167 | skipping to change at line 168 | |||
def add_bonds(model, forcefield = protein_amber, histidine = 'HIE' ): | def add_bonds(model, forcefield = protein_amber, histidine = 'HIE' ): | |||
''' | ''' | |||
add_bonds(model, forcefield = protein_amber, histidine = 'HIE' ) | add_bonds(model, forcefield = protein_amber, histidine = 'HIE' ) | |||
(1) fixes aliases, assigns types, makes HIS into HIE,HID, or HIP | (1) fixes aliases, assigns types, makes HIS into HIE,HID, or HIP | |||
and changes cystine to CYX | and changes cystine to CYX | |||
(2) adds bonds between existing atoms | (2) adds bonds between existing atoms | |||
''' | ''' | |||
if feedback['actions']: | if feedback['actions']: | |||
print(" "+str(__name__)+": assigning types and bonds...") | print(" "+str(__name__)+": assigning types and bonds...") | |||
if str(model.__class__) != 'chempy.models.Indexed': | if not isinstance(model, chempy.models.Indexed): | |||
raise ValueError('model is not an "Indexed" model object') | raise ValueError('model is not an "Indexed" model object') | |||
if model.nAtom: | if model.nAtom: | |||
crd = model.get_coord_list() | crd = model.get_coord_list() | |||
nbr = Neighbor(crd,MAX_BOND_LEN) | nbr = Neighbor(crd,MAX_BOND_LEN) | |||
res_list = model.get_residues() | res_list = model.get_residues() | |||
if len(res_list): | if len(res_list): | |||
for a in res_list: | for a in res_list: | |||
base = model.atom[a[0]] | base = model.atom[a[0]] | |||
if not base.hetatm: | if not base.hetatm: | |||
resn = base.resn | resn = base.resn | |||
skipping to change at line 286 | skipping to change at line 287 | |||
atx = model.atom [c] | atx = model.atom [c] | |||
atx.resn = 'CYX' | atx.resn = 'CYX' | |||
# since b>cur, a ssume assignment later on | # since b>cur, a ssume assignment later on | |||
break | break | |||
#------------------------------------------------------------------------------- -- | #------------------------------------------------------------------------------- -- | |||
def add_hydrogens(model,forcefield=protein_amber,skip_sort=None): | def add_hydrogens(model,forcefield=protein_amber,skip_sort=None): | |||
# assumes no bonds between non-hetatms | # assumes no bonds between non-hetatms | |||
if feedback['actions']: | if feedback['actions']: | |||
print(" "+str(__name__)+": adding hydrogens...") | print(" "+str(__name__)+": adding hydrogens...") | |||
if str(model.__class__) != 'chempy.models.Connected': | if not isinstance(model, chempy.models.Connected): | |||
raise ValueError('model is not a "Connected" model object') | raise ValueError('model is not a "Connected" model object') | |||
if model.nAtom: | if model.nAtom: | |||
if not model.index: | if not model.index: | |||
model.update_index() | model.update_index() | |||
res_list = model.get_residues() | res_list = model.get_residues() | |||
if len(res_list): | if len(res_list): | |||
for a in res_list: | for a in res_list: | |||
base = model.atom[a[0]] | base = model.atom[a[0]] | |||
if not base.hetatm: | if not base.hetatm: | |||
resn = base.resn | resn = base.resn | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added |