Previous changeset 2:fc45bf8b6e01 (2020-07-28) |
Commit message:
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/silicos-it/qed commit 943ff93be2257426d69a8406ed55c838495ecf3f" |
modified:
qed.py silicos_qed.xml |
b |
diff -r fc45bf8b6e01 -r 52a8d34dd08f qed.py --- a/qed.py Tue Jul 28 08:47:05 2020 -0400 +++ b/qed.py Fri Jul 30 12:51:45 2021 +0000 |
[ |
b'@@ -1,20 +1,22 @@\n #!/usr/bin/env python\n-__all__ = [\'weights_max\', \'weights_mean\', \'weights_none\', \'default\']\n+__all__ = ["weights_max", "weights_mean", "weights_none", "default"]\n \n-# RDKit\n-from rdkit.Chem import Descriptors\n-from rdkit import Chem\n-\n+import argparse\n+import os\n+import re\n+import sys\n # General\n from copy import deepcopy\n from math import exp, log\n-import sys, os, re\n-import argparse\n+\n+from rdkit import Chem\n+# RDKit\n+from rdkit.Chem import Descriptors\n \n \n class SilicosItError(Exception):\n """Base class for exceptions in Silicos-it code"""\n- pass\n+\n \n class WrongArgument(SilicosItError):\n """\n@@ -24,172 +26,175 @@\n function -- function in which error occurred\n msg -- explanation of the error\n """\n+\n def __init__(self, function, msg):\n self.function = function\n self.msg = msg\n \n+\n def check_filetype(filepath):\n mol = False\n possible_inchi = True\n for line_counter, line in enumerate(open(filepath)):\n if line_counter > 10000:\n break\n- if line.find(\'$$$$\') != -1:\n- return \'sdf\'\n- elif line.find(\'@<TRIPOS>MOLECULE\') != -1:\n- return \'mol2\'\n- elif line.find(\'ligand id\') != -1:\n- return \'drf\'\n- elif possible_inchi and re.findall(\'^InChI=\', line):\n- return \'inchi\'\n- elif re.findall(\'^M\\s+END\', line):\n+ if line.find("$$$$") != -1:\n+ return "sdf"\n+ elif line.find("@<TRIPOS>MOLECULE") != -1:\n+ return "mol2"\n+ elif line.find("ligand id") != -1:\n+ return "drf"\n+ elif possible_inchi and re.findall("^InChI=", line):\n+ return "inchi"\n+ elif re.findall("^M\\s+END", line): # noqa W605\n mol = True\n # first line is not an InChI, so it can\'t be an InChI file\n possible_inchi = False\n \n if mol:\n- # END can occures before $$$$, so and SDF file will \n+ # END can occures before $$$$, so and SDF file will\n # be recognised as mol, if you not using this hack\'\n- return \'mol\'\n- return \'smi\'\n+ return "mol"\n+ return "smi"\n \n-AliphaticRings = Chem.MolFromSmarts(\'[$([A;R][!a])]\')\n+\n+AliphaticRings = Chem.MolFromSmarts("[$([A;R][!a])]")\n \n AcceptorSmarts = [\n- \'[oH0;X2]\',\n- \'[OH1;X2;v2]\',\n- \'[OH0;X2;v2]\',\n- \'[OH0;X1;v2]\',\n- \'[O-;X1]\',\n- \'[SH0;X2;v2]\',\n- \'[SH0;X1;v2]\',\n- \'[S-;X1]\',\n- \'[nH0;X2]\',\n- \'[NH0;X1;v3]\',\n- \'[$([N;+0;X3;v3]);!$(N[C,S]=O)]\'\n- ]\n+ "[oH0;X2]",\n+ "[OH1;X2;v2]",\n+ "[OH0;X2;v2]",\n+ "[OH0;X1;v2]",\n+ "[O-;X1]",\n+ "[SH0;X2;v2]",\n+ "[SH0;X1;v2]",\n+ "[S-;X1]",\n+ "[nH0;X2]",\n+ "[NH0;X1;v3]",\n+ "[$([N;+0;X3;v3]);!$(N[C,S]=O)]",\n+]\n Acceptors = []\n for hba in AcceptorSmarts:\n Acceptors.append(Chem.MolFromSmarts(hba))\n \n StructuralAlertSmarts = [\n- \'*1[O,S,N]*1\',\n- \'[S,C](=[O,S])[F,Br,Cl,I]\',\n- \'[CX4][Cl,Br,I]\',\n- \'[C,c]S(=O)(=O)O[C,c]\',\n- \'[$([CH]),$(CC)]#CC(=O)[C,c]\',\n- \'[$([CH]),$(CC)]#CC(=O)O[C,c]\',\n- \'n[OH]\',\n- \'[$([CH]),$(CC)]#CS(=O)(=O)[C,c]\',\n- \'C=C(C=O)C=O\',\n- \'n1c([F,Cl,Br,I])cccc1\',\n- \'[CH1](=O)\',\n- \'[O,o][O,o]\',\n- \'[C;!R]=[N;!R]\',\n- \'[N!R]=[N!R]\',\n- \'[#6](=O)[#6](=O)\',\n- \'[S,s][S,s]\',\n- \'[N,n][NH2]\',\n- \'C(=O)N[NH2]\',\n- \'[C,c]=S\',\n- \'[$([CH2]),$([CH][CX4]),$(C([CX4])[CX4])]=[$([CH2]),$([CH][CX4]),$(C([CX4])[CX4])]\',\n- \'C1(=[O,N])C=CC(=[O,N])C=C1\',\n- \'C1(=[O,N])C(=[O,N])C=CC=C1\',\n- \'a21aa3a(aa1aaaa2)aaaa3\',\n- \'a31a(a2a(aa1)aaaa2)aaaa3\',\n- \'a1aa2a3a(a1)A=AA=A3=AA=A2\',\n- \'c1cc([NH2])ccc1\',\n- \'[Hg,Fe,As,Sb,Zn,Se,se,Te,B,Si,Na,Ca,Ge,Ag,Mg,K,Ba,Sr,Be,Ti,Mo,Mn,Ru,Pd,Ni,Cu,Au,Cd,Al,Ga,Sn,Rh,Tl,Bi,Nb,Li,Pb,Hf,Ho]\',\n- \'I\',\n- \'OS(=O)(=O)[O-]\',\n- \'[N+](=O)[O-]\',\n- \'C(=O)N[OH]\',\n- \'C1NC(=O)NC(=O)1\',\n- \'[SH]\',\n- \'[S-]\',\n- \'c1ccc([Cl,Br,I,F])c([Cl,Br,I,F])c1[Cl,Br,I,F]\',\n- \'c1cc([Cl,Br,I,F])cc([Cl,Br,I,F])c1[Cl,Br,I,F]\',\n- \'[CR1]1[CR1][CR1][C'..b' continue\n props = properties(mol)\n \n- if args.method == \'max\':\n+ if args.method == "max":\n calc_qed = weights_max(mol, True, props)\n- elif args.method == \'unweighted\':\n+ elif args.method == "unweighted":\n calc_qed = weights_none(mol, True, props)\n else:\n calc_qed = weights_mean(mol, True, props)\n \n- args.outfile.write( "%.2f\\t%.3f\\t%d\\t%d\\t%.2f\\t%d\\t%d\\t%d\\t%s\\t%.3f\\t%-s\\n" % (\n- props[0], \n- props[1], \n- props[2], \n- props[3], \n- props[4], \n- props[5], \n- props[6], \n- props[7],\n- props[8],\n- calc_qed,\n- mol.GetProp("_Name"),\n- ))\n- elif filetype == \'smi\':\n- supplier = Chem.SmilesMolSupplier( ifile, " \\t", 0, 1, False, True )\n+ args.outfile.write(\n+ "%.2f\\t%.3f\\t%d\\t%d\\t%.2f\\t%d\\t%d\\t%d\\t%s\\t%.3f\\t%-s\\n"\n+ % (\n+ props[0],\n+ props[1],\n+ props[2],\n+ props[3],\n+ props[4],\n+ props[5],\n+ props[6],\n+ props[7],\n+ props[8],\n+ calc_qed,\n+ mol.GetProp("_Name"),\n+ )\n+ )\n+ elif filetype == "smi":\n+ supplier = Chem.SmilesMolSupplier(ifile, " \\t", 0, 1, False, True)\n \n # Process file\n if args.header:\n- args.outfile.write("MW\\tALOGP\\tHBA\\tHBD\\tPSA\\tROTB\\tAROM\\tALERTS\\tLRo5\\tQED\\tNAME\\tSMILES\\n")\n+ args.outfile.write(\n+ "MW\\tALOGP\\tHBA\\tHBD\\tPSA\\tROTB\\tAROM\\tALERTS\\tLRo5\\tQED\\tNAME\\tSMILES\\n"\n+ )\n count = 0\n for line in open(ifile):\n- tokens = line.strip().split(\'\\t\')\n+ tokens = line.strip().split("\\t")\n if len(tokens) > 1:\n smiles, title = tokens\n else:\n smiles = tokens[0]\n- title = \'\'\n+ title = ""\n mol = Chem.MolFromSmiles(smiles)\n count += 1\n if mol is None:\n- print("Warning: skipping molecule ", count, " and continuing with next.")\n+ print(\n+ "Warning: skipping molecule ", count, " and continuing with next."\n+ )\n continue\n props = properties(mol)\n \n- if args.method == \'max\':\n+ if args.method == "max":\n calc_qed = weights_max(mol, True, props)\n- elif args.method == \'unweighted\':\n+ elif args.method == "unweighted":\n calc_qed = weights_none(mol, True, props)\n else:\n calc_qed = weights_mean(mol, True, props)\n \n- args.outfile.write( "%.2f\\t%.3f\\t%d\\t%d\\t%.2f\\t%d\\t%d\\t%d\\t%s\\t%.3f\\t%-s\\t%s\\n" % (\n- props[0], \n- props[1], \n- props[2], \n- props[3], \n- props[4], \n- props[5], \n- props[6], \n- props[7],\n- props[8],\n- calc_qed,\n- title,\n- smiles\n- ))\n+ args.outfile.write(\n+ "%.2f\\t%.3f\\t%d\\t%d\\t%.2f\\t%d\\t%d\\t%d\\t%s\\t%.3f\\t%-s\\t%s\\n"\n+ % (\n+ props[0],\n+ props[1],\n+ props[2],\n+ props[3],\n+ props[4],\n+ props[5],\n+ props[6],\n+ props[7],\n+ props[8],\n+ calc_qed,\n+ title,\n+ smiles,\n+ )\n+ )\n else:\n sys.exit("Error: unknown file-type: %s" % filetype)\n' |
b |
diff -r fc45bf8b6e01 -r 52a8d34dd08f silicos_qed.xml --- a/silicos_qed.xml Tue Jul 28 08:47:05 2020 -0400 +++ b/silicos_qed.xml Fri Jul 30 12:51:45 2021 +0000 |
b |
@@ -1,6 +1,6 @@ <tool id="ctb_silicos_qed" name="Drug-likeness" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@"> <macros> - <token name="@TOOL_VERSION@">2019.03.1</token> + <token name="@TOOL_VERSION@">2021.03.4</token> <token name="@GALAXY_VERSION@">0</token> </macros> <description>quantitative estimation (QED) with RDKit</description> |