diff --git a/wwpdb/utils/nmr/NmrDpReport.py b/wwpdb/utils/nmr/NmrDpReport.py index 190e8d5c..cdf1bdea 100644 --- a/wwpdb/utils/nmr/NmrDpReport.py +++ b/wwpdb/utils/nmr/NmrDpReport.py @@ -2475,8 +2475,7 @@ def sortChemicalShiftValidation(self): d = [] - anomalous_cs = False - mixed_status = False + anomalous_cs = mixed_status = False for item in ['anomalous_data', 'anomalous_chemical_shift', 'unusual_data', 'unusual_chemical_shift']: diff --git a/wwpdb/utils/nmr/mr/AmberMRParserListener.py b/wwpdb/utils/nmr/mr/AmberMRParserListener.py index 4cc5eb52..3b63a927 100644 --- a/wwpdb/utils/nmr/mr/AmberMRParserListener.py +++ b/wwpdb/utils/nmr/mr/AmberMRParserListener.py @@ -32,7 +32,7 @@ isCyclicPolymer, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, getRestraintName, @@ -106,7 +106,7 @@ isCyclicPolymer, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, getRestraintName, @@ -1455,7 +1455,8 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1463,7 +1464,7 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1736,16 +1737,17 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3656,7 +3658,8 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -3664,7 +3667,7 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -3983,16 +3986,17 @@ def exitRestraint_statement(self, ctx: AmberMRParser.Restraint_statementContext) self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -9684,9 +9688,10 @@ def exitAlign_statement(self, ctx: AmberMRParser.Align_statementContext): # pyl for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} dataset={self.dataset} n={n} " diff --git a/wwpdb/utils/nmr/mr/AriaMRParserListener.py b/wwpdb/utils/nmr/mr/AriaMRParserListener.py index 0f6c52ee..98495323 100644 --- a/wwpdb/utils/nmr/mr/AriaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/AriaMRParserListener.py @@ -835,7 +835,8 @@ def exitDistance_restraint(self, ctx: AriaMRParser.Distance_restraintContext): memberLogicCode = 'OR' if len(self.atomSelectionSet[i]) * len(self.atomSelectionSet[i + 1]) > 1 else '.' for atom1, atom2 in itertools.product(self.atomSelectionSet[i], self.atomSelectionSet[i + 1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -843,7 +844,7 @@ def exitDistance_restraint(self, ctx: AriaMRParser.Distance_restraintContext): if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, diff --git a/wwpdb/utils/nmr/mr/BiosymMRParserListener.py b/wwpdb/utils/nmr/mr/BiosymMRParserListener.py index 52925425..3d6b2092 100644 --- a/wwpdb/utils/nmr/mr/BiosymMRParserListener.py +++ b/wwpdb/utils/nmr/mr/BiosymMRParserListener.py @@ -23,7 +23,7 @@ from wwpdb.utils.nmr.mr.ParserListenerUtil import (coordAssemblyChecker, extendCoordChainsForExactNoes, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, translateToStdResName, translateToStdAtomName, translateToLigandName, @@ -104,7 +104,7 @@ from nmr.mr.ParserListenerUtil import (coordAssemblyChecker, extendCoordChainsForExactNoes, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, translateToStdResName, translateToStdAtomName, translateToLigandName, @@ -812,7 +812,8 @@ def exitDistance_restraint(self, ctx: BiosymMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -820,7 +821,7 @@ def exitDistance_restraint(self, ctx: BiosymMRParser.Distance_restraintContext): if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -950,7 +951,8 @@ def exitDistance_constraint(self, ctx: BiosymMRParser.Distance_constraintContext for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -958,7 +960,7 @@ def exitDistance_constraint(self, ctx: BiosymMRParser.Distance_constraintContext if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -2735,16 +2737,17 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2763,16 +2766,17 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2935,16 +2939,17 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2963,16 +2968,17 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: diff --git a/wwpdb/utils/nmr/mr/CharmmMRParserListener.py b/wwpdb/utils/nmr/mr/CharmmMRParserListener.py index a3a871fb..3227d052 100644 --- a/wwpdb/utils/nmr/mr/CharmmMRParserListener.py +++ b/wwpdb/utils/nmr/mr/CharmmMRParserListener.py @@ -33,7 +33,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, isCyclicPolymer, getRestraintName, @@ -117,7 +117,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRestraintName, isCyclicPolymer, @@ -1300,7 +1300,8 @@ def exitDistance_restraint(self, ctx: CharmmMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1308,7 +1309,7 @@ def exitDistance_restraint(self, ctx: CharmmMRParser.Distance_restraintContext): if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1413,16 +1414,17 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -1441,16 +1443,17 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: diff --git a/wwpdb/utils/nmr/mr/CnsMRParserListener.py b/wwpdb/utils/nmr/mr/CnsMRParserListener.py index a67136f3..474c521c 100644 --- a/wwpdb/utils/nmr/mr/CnsMRParserListener.py +++ b/wwpdb/utils/nmr/mr/CnsMRParserListener.py @@ -35,7 +35,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, isCyclicPolymer, @@ -138,7 +138,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, isCyclicPolymer, @@ -2002,7 +2002,8 @@ def exitNoe_assign(self, ctx: CnsMRParser.Noe_assignContext): # pylint: disable memberLogicCode = 'OR' if len(self.atomSelectionSet[i]) * len(self.atomSelectionSet[i + 1]) > 1 else '.' for atom1, atom2 in itertools.product(self.atomSelectionSet[i], self.atomSelectionSet[i + 1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -2010,7 +2011,7 @@ def exitNoe_assign(self, ctx: CnsMRParser.Noe_assignContext): # pylint: disable if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -2381,16 +2382,17 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2409,16 +2411,17 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2986,13 +2989,14 @@ def exitSani_assign(self, ctx: CnsMRParser.Sani_assignContext): # pylint: disab for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__symmetric == 'no': - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue else: - if isAsymmetricRangeRestraint([atom1, atom2], chain_id_set, self.__symmetric): + if isAsymmetricRangeRestraint(atoms, chain_id_set, self.__symmetric): continue if atom1['chain_id'] != atom2['chain_id']: self.__f.append(f"[Anomalous RDC vector] {self.__getCurrentRestraint()}" @@ -4338,9 +4342,10 @@ def exitDani_assign(self, ctx: CnsMRParser.Dani_assignContext): # pylint: disab for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} (DANI) id={self.diffRestraints} " diff --git a/wwpdb/utils/nmr/mr/CyanaMRParserListener.py b/wwpdb/utils/nmr/mr/CyanaMRParserListener.py index 69932895..7281cbd2 100644 --- a/wwpdb/utils/nmr/mr/CyanaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/CyanaMRParserListener.py @@ -36,7 +36,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getMetalCoordOf, getRestraintName, @@ -137,7 +137,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getMetalCoordOf, getRestraintName, @@ -1354,9 +1354,10 @@ def exitDistance_restraint(self, ctx: CyanaMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} id={self.rdcRestraints} " @@ -1428,7 +1429,8 @@ def exitDistance_restraint(self, ctx: CyanaMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1438,7 +1440,7 @@ def exitDistance_restraint(self, ctx: CyanaMRParser.Distance_restraintContext): if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1951,9 +1953,10 @@ def exitDistance_wo_comp_restraint(self, chainId1, seqId1, atomId1, chainId2, se for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} id={self.rdcRestraints} " @@ -2025,7 +2028,8 @@ def exitDistance_wo_comp_restraint(self, chainId1, seqId1, atomId1, chainId2, se for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -2035,7 +2039,7 @@ def exitDistance_wo_comp_restraint(self, chainId1, seqId1, atomId1, chainId2, se if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -5390,9 +5394,9 @@ def exitTorsion_angle_restraint(self, ctx: CyanaMRParser.Torsion_angle_restraint 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + [atom1, atom2, atom3, atom4], + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: @@ -5416,9 +5420,9 @@ def exitTorsion_angle_restraint(self, ctx: CyanaMRParser.Torsion_angle_restraint 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + [atom1, atom2, atom3, atom4], + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: @@ -5894,9 +5898,10 @@ def exitRdc_restraint(self, ctx: CyanaMRParser.Rdc_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -6437,7 +6442,8 @@ def exitFixres_distance_restraint(self, ctx: CyanaMRParser.Fixres_distance_restr for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -6447,7 +6453,7 @@ def exitFixres_distance_restraint(self, ctx: CyanaMRParser.Fixres_distance_restr if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -6786,7 +6792,8 @@ def exitFixresw_distance_restraint(self, ctx: CyanaMRParser.Fixresw_distance_res for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -6796,7 +6803,7 @@ def exitFixresw_distance_restraint(self, ctx: CyanaMRParser.Fixresw_distance_res if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -7042,7 +7049,8 @@ def exitFixresw2_distance_restraint(self, ctx: CyanaMRParser.Fixresw2_distance_r for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -7052,7 +7060,7 @@ def exitFixresw2_distance_restraint(self, ctx: CyanaMRParser.Fixresw2_distance_r if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -7314,7 +7322,8 @@ def exitFixatm_distance_restraint(self, ctx: CyanaMRParser.Fixatm_distance_restr for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -7324,7 +7333,7 @@ def exitFixatm_distance_restraint(self, ctx: CyanaMRParser.Fixatm_distance_restr if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -7663,7 +7672,8 @@ def exitFixatmw_distance_restraint(self, ctx: CyanaMRParser.Fixatmw_distance_res for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -7673,7 +7683,7 @@ def exitFixatmw_distance_restraint(self, ctx: CyanaMRParser.Fixatmw_distance_res if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -7919,7 +7929,8 @@ def exitFixatmw2_distance_restraint(self, ctx: CyanaMRParser.Fixatmw2_distance_r for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -7929,7 +7940,7 @@ def exitFixatmw2_distance_restraint(self, ctx: CyanaMRParser.Fixatmw2_distance_r if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -8101,7 +8112,8 @@ def exitQconvr_distance_restraint(self, ctx: CyanaMRParser.Qconvr_distance_restr for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -8111,7 +8123,7 @@ def exitQconvr_distance_restraint(self, ctx: CyanaMRParser.Qconvr_distance_restr if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -8645,9 +8657,10 @@ def exitDistance_w_chain_restraint(self, ctx: CyanaMRParser.Distance_w_chain_res for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} id={self.rdcRestraints} " @@ -8729,7 +8742,8 @@ def exitDistance_w_chain_restraint(self, ctx: CyanaMRParser.Distance_w_chain_res for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -8737,7 +8751,7 @@ def exitDistance_w_chain_restraint(self, ctx: CyanaMRParser.Distance_w_chain_res if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -9169,9 +9183,9 @@ def exitTorsion_angle_w_chain_restraint(self, ctx: CyanaMRParser.Torsion_angle_w 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + [atom1, atom2, atom3, atom4], + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: @@ -9195,9 +9209,9 @@ def exitTorsion_angle_w_chain_restraint(self, ctx: CyanaMRParser.Torsion_angle_w 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + [atom1, atom2, atom3, atom4], + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: diff --git a/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py b/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py index cc60d354..3edf1167 100644 --- a/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py +++ b/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py @@ -839,7 +839,8 @@ def exitNoe_assignments(self, ctx: CyanaNOAParser.Noe_assignmentsContext): # py for atom1, atom2 in itertools.product(atomSelectionSet[0], atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -849,7 +850,7 @@ def exitNoe_assignments(self, ctx: CyanaNOAParser.Noe_assignmentsContext): # py if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, diff --git a/wwpdb/utils/nmr/mr/DynamoMRParserListener.py b/wwpdb/utils/nmr/mr/DynamoMRParserListener.py index df2d67d4..e4b73856 100644 --- a/wwpdb/utils/nmr/mr/DynamoMRParserListener.py +++ b/wwpdb/utils/nmr/mr/DynamoMRParserListener.py @@ -29,7 +29,7 @@ isAmbigAtomSelection, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, translateToStdResName, @@ -119,7 +119,7 @@ isAmbigAtomSelection, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, translateToStdResName, @@ -925,7 +925,8 @@ def exitDistance_restraint(self, ctx: DynamoMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -935,7 +936,7 @@ def exitDistance_restraint(self, ctx: DynamoMRParser.Distance_restraintContext): if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1099,7 +1100,8 @@ def exitDistance_restraint_sw_segid(self, ctx: DynamoMRParser.Distance_restraint for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1107,7 +1109,7 @@ def exitDistance_restraint_sw_segid(self, ctx: DynamoMRParser.Distance_restraint if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1272,7 +1274,8 @@ def exitDistance_restraint_ew_segid(self, ctx: DynamoMRParser.Distance_restraint for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1280,7 +1283,7 @@ def exitDistance_restraint_ew_segid(self, ctx: DynamoMRParser.Distance_restraint if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -3107,16 +3110,17 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3137,16 +3141,17 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3278,16 +3283,17 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3308,16 +3314,17 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3449,16 +3456,17 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3479,16 +3487,17 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3767,9 +3776,10 @@ def exitRdc_restraint(self, ctx: DynamoMRParser.Rdc_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -3952,9 +3962,10 @@ def exitRdc_restraint_sw_segid(self, ctx: DynamoMRParser.Rdc_restraint_sw_segidC for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -4137,9 +4148,10 @@ def exitRdc_restraint_ew_segid(self, ctx: DynamoMRParser.Rdc_restraint_ew_segidC for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -4331,9 +4343,10 @@ def exitPales_rdc_output(self, ctx: DynamoMRParser.Pales_rdc_outputContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -4556,16 +4569,17 @@ def exitCoupling_restraint(self, ctx: DynamoMRParser.Coupling_restraintContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -4715,16 +4729,17 @@ def exitCoupling_restraint_sw_segid(self, ctx: DynamoMRParser.Coupling_restraint self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -4874,16 +4889,17 @@ def exitCoupling_restraint_ew_segid(self, ctx: DynamoMRParser.Coupling_restraint self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint(n=index)) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint(n=index)) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -5196,14 +5212,15 @@ def exitTalos_restraint(self, ctx: DynamoMRParser.Talos_restraintContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] _angleName = getTypeOfDihedralRestraint(True, False, False, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: @@ -5222,16 +5239,17 @@ def exitTalos_restraint(self, ctx: DynamoMRParser.Talos_restraintContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): - if isLongRangeRestraint([atom1, atom2, atom3, atom4], self.__polySeq if self.__gapInAuthSeq else None): + atoms = [atom1, atom2, atom3, atom4] + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue _angleName = getTypeOfDihedralRestraint(True, False, False, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelection != 4: @@ -5449,14 +5467,15 @@ def exitTalos_restraint_wo_s2(self, ctx: DynamoMRParser.Talos_restraint_wo_s2Con self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] _angleName = getTypeOfDihedralRestraint(True, False, False, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: @@ -5475,16 +5494,17 @@ def exitTalos_restraint_wo_s2(self, ctx: DynamoMRParser.Talos_restraint_wo_s2Con self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): - if isLongRangeRestraint([atom1, atom2, atom3, atom4], self.__polySeq if self.__gapInAuthSeq else None): + atoms = [atom1, atom2, atom3, atom4] + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue _angleName = getTypeOfDihedralRestraint(True, False, False, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc) if _angleName is not None and _angleName.startswith('pseudo'): - _angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(_angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + _angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(_angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if _angleName in emptyValue and atomSelTotal != 4: diff --git a/wwpdb/utils/nmr/mr/GromacsMRParserListener.py b/wwpdb/utils/nmr/mr/GromacsMRParserListener.py index 3609738f..20622586 100644 --- a/wwpdb/utils/nmr/mr/GromacsMRParserListener.py +++ b/wwpdb/utils/nmr/mr/GromacsMRParserListener.py @@ -23,7 +23,7 @@ isAmbigAtomSelection, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, getRestraintName, @@ -72,7 +72,7 @@ isAmbigAtomSelection, getAltProtonIdInBondConstraint, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, getRestraintName, @@ -480,7 +480,8 @@ def get_eff_digits(val): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -488,7 +489,7 @@ def get_eff_digits(val): if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -1011,16 +1012,17 @@ def exitDihedral_restraint(self, ctx: GromacsMRParser.Dihedral_restraintContext) self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -1304,9 +1306,10 @@ def exitOrientation_restraint(self, ctx: GromacsMRParser.Orientation_restraintCo for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} id={self.rdcRestraints} exp={exp} index={index} " @@ -1704,9 +1707,10 @@ def exitAngle_restraint_z(self, ctx: GromacsMRParser.Angle_restraint_zContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} id={self.angRestraints} mult={mult} " diff --git a/wwpdb/utils/nmr/mr/IsdMRParserListener.py b/wwpdb/utils/nmr/mr/IsdMRParserListener.py index 53ed3c19..5f66f8be 100644 --- a/wwpdb/utils/nmr/mr/IsdMRParserListener.py +++ b/wwpdb/utils/nmr/mr/IsdMRParserListener.py @@ -781,7 +781,8 @@ def exitDistance_restraint(self, ctx: IsdMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -791,7 +792,7 @@ def exitDistance_restraint(self, ctx: IsdMRParser.Distance_restraintContext): if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, diff --git a/wwpdb/utils/nmr/mr/ParserListenerUtil.py b/wwpdb/utils/nmr/mr/ParserListenerUtil.py index b1610e3b..f82a5d8e 100644 --- a/wwpdb/utils/nmr/mr/ParserListenerUtil.py +++ b/wwpdb/utils/nmr/mr/ParserListenerUtil.py @@ -6253,8 +6253,8 @@ def is_connected(): return '.' if is_connected() else None -def remediateBackboneDehedralRestraint(angleName, atoms, currentRestraint): - """ Return valid angle name and remediated backbone atoms. +def fixBackboneAtomsOfDihedralRestraint(angleName, atoms, currentRestraint): + """ Return valid dihedral angle name and remediated protein backbone atoms. """ msg = '' diff --git a/wwpdb/utils/nmr/mr/RosettaMRParserListener.py b/wwpdb/utils/nmr/mr/RosettaMRParserListener.py index 2b23cb9e..0297beaa 100644 --- a/wwpdb/utils/nmr/mr/RosettaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/RosettaMRParserListener.py @@ -29,7 +29,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, translateToStdAtomName, @@ -113,7 +113,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, translateToStdAtomName, @@ -1095,7 +1095,8 @@ def exitAtom_pair_restraint(self, ctx: RosettaMRParser.Atom_pair_restraintContex for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -1105,7 +1106,7 @@ def exitAtom_pair_restraint(self, ctx: RosettaMRParser.Atom_pair_restraintContex if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -2759,16 +2760,17 @@ def exitDihedral_restraint(self, ctx: RosettaMRParser.Dihedral_restraintContext) self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2793,16 +2795,17 @@ def exitDihedral_restraint(self, ctx: RosettaMRParser.Dihedral_restraintContext) self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2929,16 +2932,17 @@ def exitDihedral_pair_restraint(self, ctx: RosettaMRParser.Dihedral_pair_restrai self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2971,16 +2975,17 @@ def exitDihedral_pair_restraint(self, ctx: RosettaMRParser.Dihedral_pair_restrai self.atomSelectionSet[5], self.atomSelectionSet[6], self.atomSelectionSet[7]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -4682,9 +4687,10 @@ def exitRdc_restraint(self, ctx: RosettaMRParser.Rdc_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -5015,7 +5021,8 @@ def exitAtom_pair_w_chain_restraint(self, ctx: RosettaMRParser.Atom_pair_w_chain for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -5025,7 +5032,7 @@ def exitAtom_pair_w_chain_restraint(self, ctx: RosettaMRParser.Atom_pair_w_chain if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, diff --git a/wwpdb/utils/nmr/mr/SybylMRParserListener.py b/wwpdb/utils/nmr/mr/SybylMRParserListener.py index f8f57deb..4490d1fa 100644 --- a/wwpdb/utils/nmr/mr/SybylMRParserListener.py +++ b/wwpdb/utils/nmr/mr/SybylMRParserListener.py @@ -786,7 +786,8 @@ def exitDistance_restraint(self, ctx: SybylMRParser.Distance_restraintContext): for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -796,7 +797,7 @@ def exitDistance_restraint(self, ctx: SybylMRParser.Distance_restraintContext): if has_intra_chain and (atom1['chain_id'] != atom2['chain_id'] or atom1['chain_id'] not in rep_chain_id_set): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, diff --git a/wwpdb/utils/nmr/mr/XplorMRParserListener.py b/wwpdb/utils/nmr/mr/XplorMRParserListener.py index 14708262..dc176385 100644 --- a/wwpdb/utils/nmr/mr/XplorMRParserListener.py +++ b/wwpdb/utils/nmr/mr/XplorMRParserListener.py @@ -35,7 +35,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, isCyclicPolymer, @@ -151,7 +151,7 @@ getAltProtonIdInBondConstraint, guessCompIdFromAtomId, getTypeOfDihedralRestraint, - remediateBackboneDehedralRestraint, + fixBackboneAtomsOfDihedralRestraint, isLikePheOrTyr, getRdcCode, isCyclicPolymer, @@ -2500,7 +2500,8 @@ def exitNoe_assign(self, ctx: XplorMRParser.Noe_assignContext): # pylint: disab memberLogicCode = 'OR' if len(self.atomSelectionSet[i]) * len(self.atomSelectionSet[i + 1]) > 1 else '.' for atom1, atom2 in itertools.product(self.atomSelectionSet[i], self.atomSelectionSet[i + 1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -2508,7 +2509,7 @@ def exitNoe_assign(self, ctx: XplorMRParser.Noe_assignContext): # pylint: disab if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2, @@ -2879,16 +2880,17 @@ def exitDihedral_assign(self, ctx: XplorMRParser.Dihedral_assignContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -2907,16 +2909,17 @@ def exitDihedral_assign(self, ctx: XplorMRParser.Dihedral_assignContext): self.atomSelectionSet[1], self.atomSelectionSet[2], self.atomSelectionSet[3]): + atoms = [atom1, atom2, atom3, atom4] angleName = getTypeOfDihedralRestraint(peptide, nucleotide, carbohydrate, - [atom1, atom2, atom3, atom4], + atoms, 'plane_like' in dstFunc, self.__cR, self.__ccU, self.__representativeModelId, self.__representativeAltId, self.__modelNumName) if angleName is not None and angleName.startswith('pseudo'): - angleName, atom2, atom3, err = remediateBackboneDehedralRestraint(angleName, - [atom1, atom2, atom3, atom4], - self.__getCurrentRestraint()) + angleName, atom2, atom3, err = fixBackboneAtomsOfDihedralRestraint(angleName, + atoms, + self.__getCurrentRestraint()) self.__f.append(err) if angleName in emptyValue and atomSelTotal != 4: @@ -3378,13 +3381,14 @@ def proc_as_if_pcs_assign(_target_value, _lower_limit, _upper_limit): for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__symmetric == 'no': - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue else: - if isAsymmetricRangeRestraint([atom1, atom2], chain_id_set, self.__symmetric): + if isAsymmetricRangeRestraint(atoms, chain_id_set, self.__symmetric): continue if atom1['chain_id'] != atom2['chain_id']: self.__f.append(f"[Anomalous RDC vector] {self.__getCurrentRestraint()}" @@ -3790,9 +3794,10 @@ def exitXdip_assign(self, ctx: XplorMRParser.Xdip_assignContext): # pylint: dis for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -4359,9 +4364,10 @@ def exitTenso_assign(self, ctx: XplorMRParser.Tenso_assignContext): # pylint: d for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -6121,9 +6127,10 @@ def exitDani_assign(self, ctx: XplorMRParser.Dani_assignContext): # pylint: dis for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} (DANI) id={self.diffRestraints} " @@ -7736,9 +7743,10 @@ def exitPrdc_assign(self, ctx: XplorMRParser.Prdc_assignContext): # pylint: dis for atom1, atom2 in itertools.product(self.atomSelectionSet[4], self.atomSelectionSet[5]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if isinstance(combinationId, int): combinationId += 1 @@ -7903,9 +7911,10 @@ def exitPorientation_assign(self, ctx: XplorMRParser.Porientation_assignContext) for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} (XANG) id={self.pangRestraints} " @@ -8053,9 +8062,10 @@ def exitPccr_assign(self, ctx: XplorMRParser.Pccr_assignContext): # pylint: dis for atom1, atom2 in itertools.product(self.atomSelectionSet[1], self.atomSelectionSet[2]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue - if isLongRangeRestraint([atom1, atom2], self.__polySeq if self.__gapInAuthSeq else None): + if isLongRangeRestraint(atoms, self.__polySeq if self.__gapInAuthSeq else None): continue if self.__debug: print(f"subtype={self.__cur_subtype} (XCCR) id={self.pccrRestraints} " @@ -8492,7 +8502,8 @@ def proc_as_if_noe_assign(): if self.__createSfDict: memberLogicCode = 'OR' if len(self.atomSelectionSet[0]) * len(self.atomSelectionSet[1]) > 1 else '.' for atom1, atom2 in itertools.product(self.atomSelectionSet[0], self.atomSelectionSet[1]): - if isIdenticalRestraint([atom1, atom2], self.__nefT): + atoms = [atom1, atom2] + if isIdenticalRestraint(atoms, self.__nefT): continue if self.__createSfDict and isinstance(memberId, int): star_atom1 = getStarAtom(self.__authToStarSeq, self.__authToOrigSeq, self.__offsetHolder, copy.copy(atom1)) @@ -8500,7 +8511,7 @@ def proc_as_if_noe_assign(): if star_atom1 is None or star_atom2 is None or isIdenticalRestraint([star_atom1, star_atom2], self.__nefT): continue if self.__createSfDict and memberLogicCode == '.': - altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint([atom1, atom2], self.__csStat) + altAtomId1, altAtomId2 = getAltProtonIdInBondConstraint(atoms, self.__csStat) if altAtomId1 is not None or altAtomId2 is not None: atom1, atom2 =\ self.selectRealisticBondConstraint(atom1, atom2,