Skip to content

Commit

Permalink
DAOTHER-9063: Performance optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
yokochi47 committed Apr 4, 2024
1 parent 5b54063 commit a50dbbe
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 27 deletions.
6 changes: 4 additions & 2 deletions wwpdb/utils/nmr/mr/AmberMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,8 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext)
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if peptide and angleName == 'CHI2' and atom4['atom_id'] == 'CD1' and isLikePheOrTyr(atom2['comp_id'], self.__ccU):
Expand Down Expand Up @@ -3135,7 +3136,8 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext)
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if peptide and angleName == 'CHI2' and atom4['atom_id'] == 'CD1' and isLikePheOrTyr(atom2['comp_id'], self.__ccU):
Expand Down
12 changes: 8 additions & 4 deletions wwpdb/utils/nmr/mr/BiosymMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,8 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -2284,7 +2285,8 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down Expand Up @@ -2444,7 +2446,8 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -2461,7 +2464,8 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down
6 changes: 4 additions & 2 deletions wwpdb/utils/nmr/mr/CharmmMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -1006,7 +1007,8 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down
6 changes: 4 additions & 2 deletions wwpdb/utils/nmr/mr/CnsMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,8 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext):
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -1963,7 +1964,8 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext):
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down
27 changes: 18 additions & 9 deletions wwpdb/utils/nmr/mr/DynamoMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,8 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -2646,7 +2647,8 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down Expand Up @@ -2774,7 +2776,8 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -2793,7 +2796,8 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down Expand Up @@ -2921,7 +2925,8 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName in emptyValue:
continue
fixedAngleName = angleName
Expand All @@ -2940,7 +2945,8 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if isinstance(combinationId, int):
Expand Down Expand Up @@ -3991,7 +3997,8 @@ def exitCoupling_restraint(self, ctx: DynamoMRParser.Coupling_restraintContext):
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if angleName == 'PHI':
Expand Down Expand Up @@ -4136,7 +4143,8 @@ def exitCoupling_restraint_sw_segid(self, ctx: DynamoMRParser.Coupling_restraint
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if angleName == 'PHI':
Expand Down Expand Up @@ -4281,7 +4289,8 @@ def exitCoupling_restraint_ew_segid(self, ctx: DynamoMRParser.Coupling_restraint
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if angleName == 'PHI':
Expand Down
3 changes: 2 additions & 1 deletion wwpdb/utils/nmr/mr/GromacsMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,8 @@ def exitDihedral_restraint(self, ctx: GromacsMRParser.Dihedral_restraintContext)
self.atomSelectionSet[3]):
angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate,
[atom1, atom2, atom3, atom4],
self.__cR, self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
self.__cR, self.__ccU,
self.__representativeModelId, self.__representativeAltId, self.__modelNumName)
if angleName is None:
continue
if peptide and angleName == 'CHI2' and atom4['atom_id'] == 'CD1' and isLikePheOrTyr(atom2['comp_id'], self.__ccU):
Expand Down
5 changes: 4 additions & 1 deletion wwpdb/utils/nmr/mr/ParserListenerUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4897,7 +4897,7 @@ def isAmbigAtomSelection(atoms, csStat):
return False


def getTypeOfDihedralRestraint(polypeptide, polynucleotide, carbohydrates, atoms, cR=None,
def getTypeOfDihedralRestraint(polypeptide, polynucleotide, carbohydrates, atoms, cR=None, ccU=None,
representativeModelId=REPRESENTATIVE_MODEL_ID, representativeAltId=REPRESENTATIVE_ALT_ID,
modelNumName='PDB_model_num'):
""" Return type of dihedral angle restraint.
Expand All @@ -4919,6 +4919,9 @@ def is_connected():
if idx == 0:
continue
atom1 = atoms[idx - 1]
if atom1['chain_id'] == atom2['chain_id'] and atom1['seq_id'] == atom2['seq_id']\
and ccU.hasBond(atom1['comp_id'], atom1['atom_id'], atom2['atom_id']):
continue
if not isStructConn(cR, atom1['chain_id'], atom1['seq_id'], atom1['atom_id'],
atom2['chain_id'], atom2['seq_id'], atom2['atom_id'],
representativeModelId, representativeAltId, modelNumName):
Expand Down
Loading

0 comments on commit a50dbbe

Please sign in to comment.