Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pipelines/LidiaAcedrgNew/script/lidiaAcedrgNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def doAcedrg(self, inputType, inputObject):
acedrgPlugin.container.inputData.SMILESIN = inputObject
elif inputType == 'DICT':
acedrgPlugin.container.inputData.DICTIN2 = inputObject
if self.container.controlParameters.TOGGLE_METAL:
acedrgPlugin.container.inputData.METAL_STRUCTURE = self.container.inputData.METAL_STRUCTURE
try:
acedrgPlugin.container.inputData.TLC.set(self.container.inputData.TLC)
acedrgPlugin.container.controlParameters.NOPROT.set(self.container.controlParameters.NOPROT)
Expand All @@ -99,8 +101,6 @@ def doAcedrg(self, inputType, inputObject):
acedrgPlugin.container.inputData.NRANDOM.set(self.container.inputData.NRANDOM)
else:
acedrgPlugin.container.inputData.NRANDOM.set(0)
if self.container.controlParameters.TOGGLE_METAL:
acedrgPlugin.container.inputData.METAL_STRUCTURE = self.container.inputData.METAL_STRUCTURE
except:
exc_type, exc_value,exc_tb = sys.exc_info()[:3]
sys.stdout.write(str(exc_type)+'\n')
Expand Down
11 changes: 6 additions & 5 deletions pipelines/LidiaAcedrgNew/script/lidiaAcedrgNew_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def drawContents(self):
self.createLine(['subtitle','Start point'])
self.openSubFrame( frame=[True])
self.createLine ( [ 'label','Start with molecular structure from ','stretch','widget','MOLSMILESORSKETCH' ] )
self.connectDataChanged('MOLSMILESORSKETCH', self.ToggleShowContainsMetal)

self.createLine ( [ 'advice', 'Will launch Lidia to sketch molecule. Click Apply <b>and</b> Close in Lidia when sketch is ready.' ], toggle=['MOLSMILESORSKETCH','open',['SKETCH']])
self.createLine ( [ 'advice', 'Optionally can provide a starting monomer for the Lidia sketch:' ], toggle=['MOLSMILESORSKETCH','open',['SKETCH']])
Expand All @@ -44,10 +45,10 @@ def drawContents(self):
self.createLine ( [ 'label', 'SMILES file', 'widget', 'SMILESFILEIN' ] , toggle=['MOLSMILESORSKETCH','open',['SMILESFILE']])
self.createLine ( [ 'widget', 'DICTIN2' ] , toggle=['MOLSMILESORSKETCH','open',['DICT']])
self.connectDataChanged('DICTIN2', self.updateTLC)
self.createLine ( [ 'widget', 'TOGGLE_METAL', 'label' , 'This monomer contains a metal atom.' ] )
self.createLine ( [ 'widget', 'TOGGLE_METAL', 'label' , 'This monomer contains a metal atom.' ], toggle=['MOLSMILESORSKETCH','open',['DICT']])
self.connectDataChanged('controlParameters.TOGGLE_METAL', self.ToggleShowContainsMetal)
self.createLine ( [ 'label', indent + 'Provide a relevant structure model in complex with this monomer to get ideal bond angles in the output:'] , toggleFunction=[self.ToggleShowContainsMetal, ['controlParameters.TOGGLE_METAL']])
self.createLine ( [ 'label', indent, 'widget', 'METAL_STRUCTURE'] , toggleFunction=[self.ToggleShowContainsMetal, ['controlParameters.TOGGLE_METAL']])
self.createLine ( [ 'label', indent + 'Provide a relevant structure model in complex with this monomer to get ideal bond angles in the output:'] , toggleFunction=[self.ToggleShowContainsMetal, ['inputData.MOLSMILESORSKETCH', 'controlParameters.TOGGLE_METAL']])
self.createLine ( [ 'label', indent, 'widget', 'METAL_STRUCTURE'] , toggleFunction=[self.ToggleShowContainsMetal, ['inputData.MOLSMILESORSKETCH', 'controlParameters.TOGGLE_METAL']])
self.closeSubFrame()

self.createLine(['subtitle', 'Output monomer'])
Expand Down Expand Up @@ -106,12 +107,12 @@ def updateTLC(self):
pass

def ToggleShowContainsMetal(self, fromUpdateTLC=False):
if self.container.inputData.MOLSMILESORSKETCH != 'DICT':
return False
if self.container.controlParameters.TOGGLE_METAL and not fromUpdateTLC:
return True
if not self.container.controlParameters.TOGGLE_METAL and not fromUpdateTLC:
return False
if self.container.inputData.MOLSMILESORSKETCH != 'DICT':
return False
if not self.container.inputData.DICTIN2.isSet():
return False
if not os.path.isfile(str(self.container.inputData.DICTIN2.fullPath)):
Expand Down
46 changes: 14 additions & 32 deletions test/i2run/test_acedrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,40 +91,22 @@ def test_from_smiles_atom_name_matching():
check_output(job, "LIG")


def test_from_cif_rcsb_metal_OEX():
with download(rcsb_ligand_cif("AF3")) as cifOEX, download(rcsb_mmcif("4ub6")) as cif4ub6:
args = ["LidiaAcedrgNew"]
args += ["--MOLSMILESORSKETCH", "DICT"]
args += ["--TLC", "OEX"]
args += ["--DICTIN2", cifOEX]
args += ["--TOGGLE_METAL", "True"]
args += ["--METAL_STRUCTURE", cif4ub6]
with i2run(args) as job:
check_output(job, "OEX")


def check_output(job: Path, code: str):
doc = gemmi.cif.read(str(job / f"{code}.cif"))
if len(code) <= 3:
gemmi.read_pdb(str(job / f"{code}.pdb"))
doc = gemmi.cif.read(str(job / f"{code}.cif"))
comp = gemmi.make_chemcomp_from_block(doc[-1])
for atom in comp.atoms:
assert " " not in atom.id


# These tests crashes as acedrg or metalCoord crash themselves, not an i2 problem.

# @fixture(name="cif4ub6", scope="module")
# def cif4ub6_fixture():
# with download(rcsb_mmcif("4ub6")) as path:
# yield path

# def test_from_cif_rcsb_metal_OEX(cif4ub6):
# with download(rcsb_ligand_cif("OEX")) as cifOEX:
# args = ["LidiaAcedrgNew"]
# args += ["--MOLSMILESORSKETCH", "DICT"]
# args += ["--TLC", "OEX"]
# args += ["--DICTIN2", cifOEX]
# args += ["--TOGGLE_METAL", "True"]
# args += ["--METAL_STRUCTURE", cif4ub6]
# with i2run(args) as job:
# check_output(job, "OEX")

# def test_from_sdf_rcsb_metal_OEX(cif4ub6):
# with download(rcsb_ligand_sdf("OEX")) as sdfOEX:
# args = ["LidiaAcedrgNew"]
# args += ["--MOLSMILESORSKETCH", "MOL"]
# args += ["--TLC", "OEX"]
# args += ["--MOLIN", sdfOEX]
# args += ["--TOGGLE_METAL", "True"]
# args += ["--METAL_STRUCTURE", cif4ub6]
# with i2run(args) as job:
# check_output(job, "OEX")
assert " " not in atom.id
4 changes: 2 additions & 2 deletions wrappers/acedrgNew/script/acedrgNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def makeCommandAndScript(self):
if self.container.inputData.DICTIN2.isSet():
self.appendCommandLine('-c')
self.appendCommandLine(str(self.container.inputData.DICTIN2))
if self.container.inputData.METAL_STRUCTURE.isSet():
self.appendCommandLine('--metalPDB=' + str(self.container.inputData.METAL_STRUCTURE))
elif self.container.inputData.MOLIN.isSet():
self.appendCommandLine('-m')
self.appendCommandLine(str(self.container.inputData.MOLIN))
elif self.container.inputData.MOL2IN.isSet():
self.appendCommandLine('-g')
self.appendCommandLine(str(self.container.inputData.MOL2IN))
if self.container.inputData.METAL_STRUCTURE.isSet():
self.appendCommandLine('--metalPDB=' + str(self.container.inputData.METAL_STRUCTURE))
if self.container.controlParameters.NOPROT:
self.appendCommandLine('--noProt')
if self.container.inputData.DICTIN2.isSet() or self.container.inputData.MOLIN.isSet() or self.container.inputData.MOL2IN.isSet():
Expand Down