Skip to content

Commit

Permalink
Ensure Amber atom number dictionary is based on atom_site.auth_asym_i…
Browse files Browse the repository at this point in the history
…d (2n96)
  • Loading branch information
yokochi47 committed Jul 25, 2024
1 parent 7ed0518 commit 6fb2a54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 10 additions & 8 deletions wwpdb/utils/nmr/mr/AmberMRParserListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5011,7 +5011,8 @@ def getAtomNumberDictFromAmbmaskInfo(self, seqId, atomId, order=0, enableWarning
useDefault = True

for ps in (self.__polySeq if useDefault else self.__altPolySeq):
chainId = ps['auth_chain_id'] if useDefault else ps['chain_id']
refAuthChainId = ps['auth_chain_id']
chainId = refAuthChainId if useDefault else ps['chain_id']

if authChainId is not None and chainId != authChainId:
continue
Expand Down Expand Up @@ -5178,7 +5179,7 @@ def getAtomNumberDictFromAmbmaskInfo(self, seqId, atomId, order=0, enableWarning
seqKey = _seqKey

if found:
factor['chain_id'] = chainId
factor['chain_id'] = refAuthChainId
factor['seq_id'] = seqId if cifSeqId is None else cifSeqId
factor['comp_id'] = compId
factor['atom_id'] = _atomId
Expand All @@ -5192,7 +5193,7 @@ def getAtomNumberDictFromAmbmaskInfo(self, seqId, atomId, order=0, enableWarning
if self.__ccU.updateChemCompDict(compId):
cca = next((cca for cca in self.__ccU.lastAtomList if cca[self.__ccU.ccaAtomId] == _atomId), None)
if cca is not None:
factor['chain_id'] = chainId
factor['chain_id'] = refAuthChainId
factor['seq_id'] = seqId if cifSeqId is None else cifSeqId
factor['comp_id'] = compId
factor['atom_id'] = _atomId
Expand Down Expand Up @@ -5483,7 +5484,8 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use
found = False

for ps in (self.__polySeq if useDefault else self.__altPolySeq):
chainId = ps['auth_chain_id'] if useDefault else ps['chain_id']
refAuthChainId = ps['auth_chain_id']
chainId = refAuthChainId if useDefault else ps['chain_id']
seqId = factor['auth_seq_id']

if authChainId is not None and chainId != authChainId:
Expand Down Expand Up @@ -5691,7 +5693,7 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use
seqKey = _seqKey

if found:
factor['chain_id'] = chainId
factor['chain_id'] = refAuthChainId
factor['seq_id'] = seqKey[1] # seqId if cifSeqId is None else cifSeqId
factor['comp_id'] = compId
factor['atom_id'] = _atomId
Expand All @@ -5705,7 +5707,7 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use
if self.__ccU.updateChemCompDict(compId):
cca = next((cca for cca in self.__ccU.lastAtomList if cca[self.__ccU.ccaAtomId] == _atomId), None)
if cca is not None:
factor['chain_id'] = chainId
factor['chain_id'] = refAuthChainId
factor['seq_id'] = seqId if cifSeqId is None else cifSeqId
factor['comp_id'] = compId
factor['atom_id'] = _atomId
Expand Down Expand Up @@ -5825,7 +5827,7 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use
seqKey = _seqKey

if found:
_factor['chain_id'] = chainId
_factor['chain_id'] = refAuthChainId
_factor['seq_id'] = seqKey[1] # seqId if cifSeqId is None else cifSeqId
_factor['comp_id'] = compId
_factor['atom_id'] = _atomId
Expand All @@ -5839,7 +5841,7 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use
cca = next((cca for cca in self.__ccU.lastAtomList if cca[self.__ccU.ccaAtomId] == _atomId), None)
if cca is not None:
found = True
_factor['chain_id'] = chainId
_factor['chain_id'] = refAuthChainId
_factor['seq_id'] = seqId if cifSeqId is None else cifSeqId
_factor['comp_id'] = compId
_factor['atom_id'] = _atomId
Expand Down
6 changes: 6 additions & 0 deletions wwpdb/utils/nmr/mr/AmberMRReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ def parse(self, mrFilePath, cifFilePath=None, ptFilePath=None, isFilePath=True,


if __name__ == "__main__":
reader = AmberMRReader(True)
reader.setDebugMode(True)
reader.parse('../../tests-nmr/mock-data-remediation/2n96/2n96-trimmed.mr',
'../../tests-nmr/mock-data-remediation/2n96/2n96.cif',
None)

reader = AmberMRReader(True)
reader.setDebugMode(True)
reader.parse('../../tests-nmr/mock-data-remediation/2kxn/2kxn-corrected.mr',
Expand Down

0 comments on commit 6fb2a54

Please sign in to comment.