Skip to content

Commit

Permalink
Fix IndexError of the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yokochi47 committed Jan 30, 2024
1 parent 07bb358 commit 3c4e1d5
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 78 deletions.
26 changes: 14 additions & 12 deletions wwpdb/utils/nmr/mr/BiosymMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2046,10 +2046,14 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a dihedral angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a dihedral angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2058,9 +2062,6 @@ def exitDihedral_angle_restraint(self, ctx: BiosymMRParser.Dihedral_angle_restra
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down Expand Up @@ -2205,10 +2206,14 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a dihedral angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a dihedral angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2217,9 +2222,6 @@ def exitDihedral_angle_constraint(self, ctx: BiosymMRParser.Dihedral_angle_const
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down
17 changes: 9 additions & 8 deletions wwpdb/utils/nmr/mr/CharmmMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,12 +941,16 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra

if len(self.atomSelectionSet) != 4:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a dihedral angle (DIHE)',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -955,9 +959,6 @@ def exitDihedral_angle_restraint(self, ctx: CharmmMRParser.Dihedral_angle_restra
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down
17 changes: 9 additions & 8 deletions wwpdb/utils/nmr/mr/CnsMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -1885,12 +1885,16 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext):

if not self.__hasPolySeq and not self.__hasNonPolySeq:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a dihedral angle (DIHE)',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -1899,9 +1903,6 @@ def exitDihedral_assign(self, ctx: CnsMRParser.Dihedral_assignContext):
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down
36 changes: 24 additions & 12 deletions wwpdb/utils/nmr/mr/CyanaMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -4059,10 +4059,13 @@ def exitTorsion_angle_restraint(self, ctx: CyanaMRParser.Torsion_angle_restraint

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down Expand Up @@ -4171,10 +4174,13 @@ def exitTorsion_angle_restraint(self, ctx: CyanaMRParser.Torsion_angle_restraint

if len(self.atomSelectionSet) < 5:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down Expand Up @@ -7544,10 +7550,13 @@ def exitTorsion_angle_w_chain_restraint(self, ctx: CyanaMRParser.Torsion_angle_w

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down Expand Up @@ -7656,10 +7665,13 @@ def exitTorsion_angle_w_chain_restraint(self, ctx: CyanaMRParser.Torsion_angle_w

if len(self.atomSelectionSet) < 5:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down
57 changes: 33 additions & 24 deletions wwpdb/utils/nmr/mr/DynamoMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2405,10 +2405,14 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2419,9 +2423,6 @@ def exitTorsion_angle_restraint(self, ctx: DynamoMRParser.Torsion_angle_restrain
potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc),
softwareName='DYNAMO/TALOS')

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down Expand Up @@ -2534,10 +2535,14 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2548,9 +2553,6 @@ def exitTorsion_angle_restraint_sw_segid(self, ctx: DynamoMRParser.Torsion_angle
potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc),
softwareName='DYNAMO/TALOS')

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down Expand Up @@ -2663,10 +2665,14 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a torsion angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2677,9 +2683,6 @@ def exitTorsion_angle_restraint_ew_segid(self, ctx: DynamoMRParser.Torsion_angle
potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc),
softwareName='DYNAMO/TALOS')

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down Expand Up @@ -4291,10 +4294,13 @@ def exitTalos_restraint(self, ctx: DynamoMRParser.Talos_restraintContext):

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle (TALOS)'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle (TALOS)')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle (TALOS)',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down Expand Up @@ -4483,10 +4489,13 @@ def exitTalos_restraint_wo_s2(self, ctx: DynamoMRParser.Talos_restraint_wo_s2Con

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a torsion angle (TALOS)'):

try:
self.atomSelectionSet[0][0]['comp_id']
except IndexError:
self.areUniqueCoordAtoms('a torsion angle (TALOS)')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle (TALOS)',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand Down
13 changes: 7 additions & 6 deletions wwpdb/utils/nmr/mr/RosettaMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2236,10 +2236,14 @@ def exitDihedral_restraint(self, ctx: RosettaMRParser.Dihedral_restraintContext)

if len(self.atomSelectionSet) < 4:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle'):

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
self.areUniqueCoordAtoms('a dihedral angle')
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a torsion angle',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2248,9 +2252,6 @@ def exitDihedral_restraint(self, ctx: RosettaMRParser.Dihedral_restraintContext)
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

isNested = len(self.stackNest) > 0

if isNested:
Expand Down
17 changes: 9 additions & 8 deletions wwpdb/utils/nmr/mr/XplorMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2350,12 +2350,16 @@ def exitDihedral_assign(self, ctx: XplorMRParser.Dihedral_assignContext):

if not self.__hasPolySeq and not self.__hasNonPolySeq:
return
"""
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)

try:
compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)
except IndexError:
if not self.areUniqueCoordAtoms('a dihedral angle (DIHE)'):
if len(self.__g) > 0:
self.__f.extend(self.__g)
return
"""

len_f = len(self.__f)
self.areUniqueCoordAtoms('a dihedral angle (DIHE)',
allow_ambig=True, allow_ambig_warn_title='Ambiguous dihedral angle')
Expand All @@ -2364,9 +2368,6 @@ def exitDihedral_assign(self, ctx: XplorMRParser.Dihedral_assignContext):
if self.__createSfDict:
sf = self.__getSf(potentialType=getPotentialType(self.__file_type, self.__cur_subtype, dstFunc))

compId = self.atomSelectionSet[0][0]['comp_id']
peptide, nucleotide, carbohydrate = self.__csStat.getTypeOfCompId(compId)

first_item = True

for atom1, atom2, atom3, atom4 in itertools.product(self.atomSelectionSet[0],
Expand Down

0 comments on commit 3c4e1d5

Please sign in to comment.