annotate sucos.py @ 6:4f1896782f7c draft default tip

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
author bgruening
date Wed, 14 Apr 2021 09:31:11 +0000
parents 8161c08627bf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
1 #!/usr/bin/env python
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
2 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
3 Basic SuCOS scoring. Allows a set of molecules from a SD file to be overlayed to a reference molecule,
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
4 with the resulting scores being written as properties in the output SD file.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
5
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
6 SuCOS is the work of Susan Leung.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
7 GitHub: https://github.com/susanhleung/SuCOS
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
8 Publication: https://doi.org/10.26434/chemrxiv.8100203.v1
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
9 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
10
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
11 from __future__ import print_function
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
12
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
13 import argparse
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
14 import os
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
15
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
16 import numpy as np
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
17 import utils
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
18 from rdkit import Chem, RDConfig
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
19 from rdkit.Chem import AllChem, rdShapeHelpers
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
20 from rdkit.Chem.FeatMaps import FeatMaps
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
21
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
22 # start function definitions #########################################
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
23
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
24 # Setting up the features to use in FeatureMap
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
25 fdef = AllChem.BuildFeatureFactory(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
26 os.path.join(RDConfig.RDDataDir, "BaseFeatures.fdef")
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
27 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
28
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
29 fmParams = {}
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
30 for k in fdef.GetFeatureFamilies():
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
31 fparams = FeatMaps.FeatMapParams()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
32 fmParams[k] = fparams
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
33
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
34 keep = (
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
35 "Donor",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
36 "Acceptor",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
37 "NegIonizable",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
38 "PosIonizable",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
39 "ZnBinder",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
40 "Aromatic",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
41 "Hydrophobe",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
42 "LumpedHydrophobe",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
43 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
44
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
45
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
46 def filterFeature(f):
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
47 result = f.GetFamily() in keep
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
48 # TODO - nothing ever seems to be filtered. Is this expected?
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
49 if not result:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
50 utils.log("Filtered out feature type", f.GetFamily())
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
51 return result
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
52
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
53
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
54 def getRawFeatures(mol):
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
55
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
56 rawFeats = fdef.GetFeaturesForMol(mol)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
57 # filter that list down to only include the ones we're interested in
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
58 filtered = list(filter(filterFeature, rawFeats))
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
59 return filtered
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
60
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
61
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
62 def get_FeatureMapScore(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
63 small_feats, large_feats, tani=False, score_mode=FeatMaps.FeatMapScoreMode.All
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
64 ):
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
65 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
66 Generate the feature map score.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
67
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
68 :param small_feats:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
69 :param large_feats:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
70 :param tani:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
71 :return:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
72 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
73
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
74 featLists = []
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
75 for rawFeats in [small_feats, large_feats]:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
76 # filter that list down to only include the ones we're interested in
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
77 featLists.append(rawFeats)
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
78 fms = [
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
79 FeatMaps.FeatMap(feats=x, weights=[1] * len(x), params=fmParams)
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
80 for x in featLists
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
81 ]
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
82 # set the score mode
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
83 fms[0].scoreMode = score_mode
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
84
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
85 try:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
86 if tani:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
87 c = fms[0].ScoreFeats(featLists[1])
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
88 A = fms[0].GetNumFeatures()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
89 B = len(featLists[1])
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
90 if B != fms[1].GetNumFeatures():
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
91 utils.log("Why isn't B equal to number of features...?!")
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
92 tani_score = float(c) / (A + B - c)
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
93 return tani_score
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
94 else:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
95 fm_score = fms[0].ScoreFeats(featLists[1]) / min(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
96 fms[0].GetNumFeatures(), len(featLists[1])
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
97 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
98 return fm_score
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
99 except ZeroDivisionError:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
100 utils.log("ZeroDivisionError")
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
101 return 0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
102
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
103 if tani:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
104 tani_score = float(c) / (A + B - c)
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
105 return tani_score
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
106 else:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
107 fm_score = fms[0].ScoreFeats(featLists[1]) / min(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
108 fms[0].GetNumFeatures(), len(featLists[1])
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
109 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
110 return fm_score
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
111
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
112
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
113 def get_SucosScore(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
114 ref_mol,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
115 query_mol,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
116 tani=False,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
117 ref_features=None,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
118 query_features=None,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
119 score_mode=FeatMaps.FeatMapScoreMode.All,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
120 ):
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
121 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
122 This is the key function that calculates the SuCOS scores and is expected to be called from other modules.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
123 To improve performance you can pre-calculate the features and pass them in as optional parameters to avoid having
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
124 to recalculate them. Use the getRawFeatures function to pre-calculate the features.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
125
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
126 :param ref_mol: The reference molecule to compare to
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
127 :param query_mol: The molecule to align to the reference
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
128 :param tani: Whether to calculate Tanimoto distances
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
129 :param ref_features: An optional feature map for the reference molecule, avoiding the need to re-calculate it.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
130 :param query_features: An optional feature map for the query molecule, avoiding the need to re-calculate it.
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
131 :return: A tuple of 3 values. 1 the sucos score, 2 the feature map score,
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
132 3 the Tanimoto distance or 1 minus the protrude distance
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
133 """
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
134
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
135 if not ref_features:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
136 ref_features = getRawFeatures(ref_mol)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
137 if not query_features:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
138 query_features = getRawFeatures(query_mol)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
139
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
140 fm_score = get_FeatureMapScore(ref_features, query_features, tani, score_mode)
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
141 fm_score = np.float(np.clip(fm_score, 0, 1))
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
142
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
143 try:
2
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
144 if tani:
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
145 tani_sim = 1 - float(rdShapeHelpers.ShapeTanimotoDist(ref_mol, query_mol))
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
146 tani_sim = np.clip(tani_sim, 0, 1)
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
147 SuCOS_score = 0.5 * fm_score + 0.5 * tani_sim
2
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
148 return SuCOS_score, fm_score, tani_sim
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
149 else:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
150 protrude_dist = rdShapeHelpers.ShapeProtrudeDist(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
151 ref_mol, query_mol, allowReordering=False
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
152 )
2
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
153 protrude_dist = np.clip(protrude_dist, 0, 1)
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
154 protrude_val = 1.0 - protrude_dist
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
155 SuCOS_score = 0.5 * fm_score + 0.5 * protrude_val
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
156 return SuCOS_score, fm_score, protrude_val
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
157 except Exception:
2
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
158 utils.log("Failed to calculate SuCOS scores. Returning 0,0,0")
8161c08627bf "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
bgruening
parents: 0
diff changeset
159 return 0, 0, 0
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
160
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
161
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
162 def process(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
163 refmol_filename,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
164 inputs_filename,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
165 outputs_filename,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
166 refmol_index=None,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
167 refmol_format=None,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
168 tani=False,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
169 score_mode=FeatMaps.FeatMapScoreMode.All,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
170 ):
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
171
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
172 ref_mol = utils.read_single_molecule(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
173 refmol_filename, index=refmol_index, format=refmol_format
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
174 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
175 # utils.log("Reference mol has", ref_mol.GetNumHeavyAtoms(), "heavy atoms")
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
176 ref_features = getRawFeatures(ref_mol)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
177
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
178 input_file = utils.open_file_for_reading(inputs_filename)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
179 suppl = Chem.ForwardSDMolSupplier(input_file)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
180 output_file = utils.open_file_for_writing(outputs_filename)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
181 writer = Chem.SDWriter(output_file)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
182
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
183 count = 0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
184 total = 0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
185 errors = 0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
186 for mol in suppl:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
187 count += 1
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
188 if mol is None:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
189 continue
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
190 # utils.log("Mol has", str(mol.GetNumHeavyAtoms()), "heavy atoms")
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
191 try:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
192 sucos_score, fm_score, val3 = get_SucosScore(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
193 ref_mol,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
194 mol,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
195 tani=tani,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
196 ref_features=ref_features,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
197 score_mode=score_mode,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
198 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
199 mol.SetDoubleProp("SuCOS_Score", sucos_score)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
200 mol.SetDoubleProp("SuCOS_FeatureMap_Score", fm_score)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
201 if tani:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
202 mol.SetDoubleProp("SuCOS_Tanimoto_Score", val3)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
203 else:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
204 mol.SetDoubleProp("SuCOS_Protrude_Score", val3)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
205 utils.log("Scores:", sucos_score, fm_score, val3)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
206 writer.write(mol)
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
207 total += 1
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
208 except ValueError as e:
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
209 errors += 1
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
210 utils.log("Molecule", count, "failed to score:", e.message)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
211
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
212 input_file.close()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
213 writer.flush()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
214 writer.close()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
215 output_file.close()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
216
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
217 utils.log(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
218 "Completed.", total, "processed, ", count, "succeeded, ", errors, "errors"
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
219 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
220
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
221
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
222 def parse_score_mode(value):
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
223 if value is None or value == "all":
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
224 return FeatMaps.FeatMapScoreMode.All
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
225 elif value == "closest":
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
226 return FeatMaps.FeatMapScoreMode.Closest
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
227 elif value == "best":
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
228 return FeatMaps.FeatMapScoreMode.Best
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
229 else:
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
230 raise ValueError(value + " is not a valid scoring mode option")
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
231
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
232
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
233 # start main execution #########################################
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
234
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
235
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
236 def main():
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
237
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
238 parser = argparse.ArgumentParser(description="SuCOS with RDKit")
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
239 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
240 "-i", "--input", help="Input file in SDF format. Can be gzipped (*.gz)."
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
241 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
242 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
243 "-r",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
244 "--refmol",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
245 help="Molecule to compare against in Molfile (.mol) or SDF (.sdf) format",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
246 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
247 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
248 "--refmol-format",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
249 help="Format for the reference molecule (mol or sdf). "
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
250 + "Only needed if files don't have the expected extensions",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
251 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
252 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
253 "--refmolidx",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
254 help="Reference molecule index in SD file if not the first",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
255 type=int,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
256 default=1,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
257 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
258 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
259 "-o", "--output", help="Output file in SDF format. Can be gzipped (*.gz)."
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
260 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
261 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
262 "--tanimoto", action="store_true", help="Include Tanimoto distance in score"
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
263 )
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
264 parser.add_argument(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
265 "--score_mode",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
266 choices=["all", "closest", "best"],
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
267 help="choose the scoring mode for the feature map, default is 'all'.",
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
268 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
269
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
270 args = parser.parse_args()
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
271 utils.log("SuCOS Args: ", args)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
272
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
273 score_mode = parse_score_mode(args.score_mode)
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
274
6
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
275 process(
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
276 args.refmol,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
277 args.input,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
278 args.output,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
279 refmol_index=args.refmolidx,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
280 refmol_format=args.refmol_format,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
281 tani=args.tanimoto,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
282 score_mode=score_mode,
4f1896782f7c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 05dc325ce687441e5d3bdbdedcc0e3529cd5e070"
bgruening
parents: 2
diff changeset
283 )
0
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
284
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
285
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
286 if __name__ == "__main__":
f8f53668d5a2 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit ef86cfa5f7ab5043de420511211579d03df58645"
bgruening
parents:
diff changeset
287 main()