Skip to content

Commit

Permalink
DAOTHER-8905: Fix SPARKY lexer grammer for comment line and resolve c…
Browse files Browse the repository at this point in the history
…oncatenated assignment
  • Loading branch information
yokochi47 committed Feb 3, 2025
1 parent b4f9abb commit 4bd12d7
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 189 deletions.
21 changes: 21 additions & 0 deletions wwpdb/utils/nmr/pk/BasePKParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,7 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int, hint
atomId = term[_atomNameSpan[idx][0]:atomNameSpan[idx][1]]
if resNameLike[idx]:
compId = term[resNameSpan[idx][0]:resNameSpan[idx][1]]
resId = term[resIdSpan[idx][0]:resIdSpan[idx][1]] if resIdLike[idx] else '.'
if len(compId) == 1 and aaOnly:
compId = next(k for k, v in monDict3.items() if v == compId)
_, _, details = self.nefT.get_valid_star_atom_in_xplor(compId, atomId, leave_unmatched=True)
Expand All @@ -2294,12 +2295,32 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int, hint
_atomNameLike[idx] = False
for shift in range(_atomNameSpan[idx][0], atomNameSpan[idx][1]):
_atomId = term[_atomNameSpan[idx][0] + shift:atomNameSpan[idx][1]]
if _atomId[0] == resId[0]:
continue
_, _, details = self.nefT.get_valid_star_atom_in_xplor(compId, _atomId, leave_unmatched=True)
if details is None:
_atomNameSpan[idx] = (_atomNameSpan[idx][0] + shift, len(_atomId))
atomNameSpan[idx] = (_atomNameSpan[idx][0], atomNameSpan[idx][1])
concat = True
break
else:
_, _, details = self.nefT.get_valid_star_atom_in_xplor(compId, atomId, leave_unmatched=True)
if details is None:
_atomNameLike[idx] = False
atomNameSpan[idx] = (_atomNameSpan[idx][0], atomNameSpan[idx][1])
concat = True
elif numOfDim == 1:
_atomNameLike[idx] = False
for shift in range(_atomNameSpan[idx][0], atomNameSpan[idx][1]):
_atomId = term[_atomNameSpan[idx][0] + shift:atomNameSpan[idx][1]]
if _atomId[0] == resId[0]:
continue
_, _, details = self.nefT.get_valid_star_atom_in_xplor(compId, _atomId, leave_unmatched=True)
if details is None:
_atomNameSpan[idx] = (_atomNameSpan[idx][0] + shift, len(_atomId))
atomNameSpan[idx] = (_atomNameSpan[idx][0], atomNameSpan[idx][1])
concat = True
break
if not concat:
for compId in self.compIdSet:
_, _, details = self.nefT.get_valid_star_atom_in_xplor(compId, atomId, leave_unmatched=True)
Expand Down
Loading

0 comments on commit 4bd12d7

Please sign in to comment.