Skip to content

Commit

Permalink
Auto-split CYSZ:ZN as ZN:ZN (2n1u)
Browse files Browse the repository at this point in the history
  • Loading branch information
yokochi47 committed Feb 2, 2024
1 parent 84a1762 commit d5d27e0
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 22 deletions.
40 changes: 38 additions & 2 deletions wwpdb/utils/nmr/mr/AriaMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ def exitAria_mr(self, ctx: AriaMRParser.Aria_mrContext): # pylint: disable=unus

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -553,7 +554,7 @@ def exitAria_mr(self, ctx: AriaMRParser.Aria_mrContext): # pylint: disable=unus
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

finally:
Expand Down Expand Up @@ -869,6 +870,18 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId):

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -1153,6 +1166,18 @@ def assignCoordPolymerSequenceWithChainId(self, refChainId, seqId, compId, atomI

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -1501,6 +1526,17 @@ def selectCoordAtoms(self, chainAssign, seqId, compId, atomId, allowAmbig=True,
_compId = compId
_atomId = atomId

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = znSeqId

if self.__mrAtomNameMapping is not None and compId not in monDict3:
_atomId = retrieveAtomIdFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down
28 changes: 26 additions & 2 deletions wwpdb/utils/nmr/mr/BiosymMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def exitBiosym_mr(self, ctx: BiosymMRParser.Biosym_mrContext): # pylint: disabl

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -562,7 +563,7 @@ def exitBiosym_mr(self, ctx: BiosymMRParser.Biosym_mrContext): # pylint: disabl
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

finally:
Expand Down Expand Up @@ -1003,6 +1004,18 @@ def assignCoordPolymerSequence(self, refChainId, seqId, compId, atomId):

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if refChainId is not None:
if any(ps for ps in self.__polySeq if ps['auth_chain_id'] == refChainId):
if refChainId not in self.__chainNumberDict:
Expand Down Expand Up @@ -1347,6 +1360,17 @@ def selectCoordAtoms(self, chainAssign, seqId, compId, atomId, allowAmbig=True,
_compId = compId
_atomId = atomId

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = znSeqId

if self.__mrAtomNameMapping is not None and compId not in monDict3:
_atomId = retrieveAtomIdFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down
5 changes: 3 additions & 2 deletions wwpdb/utils/nmr/mr/CharmmMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ def exitCharmm_mr(self, ctx: CharmmMRParser.Charmm_mrContext): # pylint: disabl

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -732,7 +733,7 @@ def exitCharmm_mr(self, ctx: CharmmMRParser.Charmm_mrContext): # pylint: disabl
del self.reasonsForReParsing['np_seq_id_remap']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

if 'global_sequence_offset' in self.reasonsForReParsing:
Expand Down
5 changes: 3 additions & 2 deletions wwpdb/utils/nmr/mr/CnsMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ def exitCns_mr(self, ctx: CnsMRParser.Cns_mrContext): # pylint: disable=unused-

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -866,7 +867,7 @@ def exitCns_mr(self, ctx: CnsMRParser.Cns_mrContext): # pylint: disable=unused-
del self.reasonsForReParsing['np_seq_id_remap']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

if 'global_sequence_offset' in self.reasonsForReParsing:
Expand Down
42 changes: 39 additions & 3 deletions wwpdb/utils/nmr/mr/CyanaMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ def exitCyana_mr(self, ctx: CyanaMRParser.Cyana_mrContext): # pylint: disable=u

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -711,7 +712,7 @@ def exitCyana_mr(self, ctx: CyanaMRParser.Cyana_mrContext): # pylint: disable=u
if 'chain_seq_id_remap' not in self.reasonsForReParsing:
self.reasonsForReParsing['chain_seq_id_remap'] = seqIdRemapFailed

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f):
if self.__reasons is None and any(f for f in self.__f if '[Atom not found]' in f):
if len(self.unambigAtomNameMapping) > 0:
if 'unambig_atom_id_remap' not in self.reasonsForReParsing:
self.reasonsForReParsing['unambig_atom_id_remap'] = self.unambigAtomNameMapping
Expand All @@ -734,7 +735,7 @@ def exitCyana_mr(self, ctx: CyanaMRParser.Cyana_mrContext): # pylint: disable=u
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

if self.__remediate:
Expand Down Expand Up @@ -2073,6 +2074,18 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId):

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -2371,6 +2384,18 @@ def assignCoordPolymerSequenceWithChainId(self, refChainId, seqId, compId, atomI

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -3129,6 +3154,17 @@ def selectCoordAtoms(self, chainAssign, seqId, compId, atomId, allowAmbig=True,

if compId is not None:

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = znSeqId

if self.__mrAtomNameMapping is not None and compId not in monDict3:
_atomId = retrieveAtomIdFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down
28 changes: 26 additions & 2 deletions wwpdb/utils/nmr/mr/DynamoMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ def exitDynamo_mr(self, ctx: DynamoMRParser.Dynamo_mrContext): # pylint: disabl

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -606,7 +607,7 @@ def exitDynamo_mr(self, ctx: DynamoMRParser.Dynamo_mrContext): # pylint: disabl
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

finally:
Expand Down Expand Up @@ -1324,6 +1325,18 @@ def assignCoordPolymerSequence(self, refChainId, seqId, compId, atomId, index=No

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -1665,6 +1678,17 @@ def selectCoordAtoms(self, chainAssign, seqId, compId, atomId, allowAmbig=True,
_compId = compId
_atomId = atomId

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = znSeqId

if self.__mrAtomNameMapping is not None and compId not in monDict3:
_atomId = retrieveAtomIdFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down
28 changes: 26 additions & 2 deletions wwpdb/utils/nmr/mr/IsdMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ def exitIsd_mr(self, ctx: IsdMRParser.Isd_mrContext): # pylint: disable=unused-

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -536,7 +537,7 @@ def exitIsd_mr(self, ctx: IsdMRParser.Isd_mrContext): # pylint: disable=unused-
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

finally:
Expand Down Expand Up @@ -831,6 +832,18 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId):

preferNonPoly = False

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = _seqId = znSeqId
preferNonPoly = True

if self.__mrAtomNameMapping is not None and compId not in monDict3:
seqId, compId, _ = retrieveAtomIdentFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down Expand Up @@ -1111,6 +1124,17 @@ def selectCoordAtoms(self, chainAssign, seqId, compId, atomId, allowAmbig=True,
_compId = compId
_atomId = atomId

if compId == 'CYSZ' and atomId == 'ZN' and self.__hasNonPoly:
znCount = 0
znSeqId = None
for np in self.__nonPoly:
if np['comp_id'][0] == 'ZN':
znSeqId = np['auth_seq_id'][0]
znCount += 1
if znCount == 1:
compId = _compId = 'ZN'
seqId = znSeqId

if self.__mrAtomNameMapping is not None and compId not in monDict3:
_atomId = retrieveAtomIdFromMRMap(self.__mrAtomNameMapping, seqId, compId, atomId)

Expand Down
5 changes: 3 additions & 2 deletions wwpdb/utils/nmr/mr/RosettaMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ def exitRosetta_mr(self, ctx: RosettaMRParser.Rosetta_mrContext): # pylint: dis

trimSequenceAlignment(self.__seqAlign, self.__chainAssign)

if self.__reasons is None and any(f for f in self.__f if 'Atom not found' in f or 'Sequence mismatch' in f):
if self.__reasons is None and any(f for f in self.__f
if '[Atom not found]' in f or '[Sequence mismatch]' in f):

seqIdRemap = []

Expand Down Expand Up @@ -642,7 +643,7 @@ def exitRosetta_mr(self, ctx: RosettaMRParser.Rosetta_mrContext): # pylint: dis
del self.reasonsForReParsing['local_seq_scheme']

if 'seq_id_remap' in self.reasonsForReParsing and 'non_poly_remap' in self.reasonsForReParsing:
if self.__reasons is None and not any(f for f in self.__f if 'Sequence mismatch' in f):
if self.__reasons is None and not any(f for f in self.__f if '[Sequence mismatch]' in f):
del self.reasonsForReParsing['seq_id_remap']

if self.__remediate:
Expand Down
Loading

0 comments on commit d5d27e0

Please sign in to comment.