Mercurial > repos > bgruening > sucos_clustering
comparison sucos.py @ 2:58d18838e244 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
author | bgruening |
---|---|
date | Thu, 19 Mar 2020 07:25:25 -0400 |
parents | f80cfac80c53 |
children | b8725fec8c7b |
comparison
equal
deleted
inserted
replaced
1:334ad24525db | 2:58d18838e244 |
---|---|
107 query_features = getRawFeatures(query_mol) | 107 query_features = getRawFeatures(query_mol) |
108 | 108 |
109 fm_score = get_FeatureMapScore(ref_features, query_features, tani, score_mode) | 109 fm_score = get_FeatureMapScore(ref_features, query_features, tani, score_mode) |
110 fm_score = np.clip(fm_score, 0, 1) | 110 fm_score = np.clip(fm_score, 0, 1) |
111 | 111 |
112 if tani: | 112 try : |
113 tani_sim = 1 - float(rdShapeHelpers.ShapeTanimotoDist(ref_mol, query_mol)) | 113 if tani: |
114 tani_sim = np.clip(tani_sim, 0, 1) | 114 tani_sim = 1 - float(rdShapeHelpers.ShapeTanimotoDist(ref_mol, query_mol)) |
115 SuCOS_score = 0.5*fm_score + 0.5*tani_sim | 115 tani_sim = np.clip(tani_sim, 0, 1) |
116 return SuCOS_score, fm_score, tani_sim | 116 SuCOS_score = 0.5*fm_score + 0.5*tani_sim |
117 else: | 117 return SuCOS_score, fm_score, tani_sim |
118 protrude_dist = rdShapeHelpers.ShapeProtrudeDist(ref_mol, query_mol, allowReordering=False) | 118 else: |
119 protrude_dist = np.clip(protrude_dist, 0, 1) | 119 protrude_dist = rdShapeHelpers.ShapeProtrudeDist(ref_mol, query_mol, allowReordering=False) |
120 protrude_val = 1.0 - protrude_dist | 120 protrude_dist = np.clip(protrude_dist, 0, 1) |
121 SuCOS_score = 0.5 * fm_score + 0.5 * protrude_val | 121 protrude_val = 1.0 - protrude_dist |
122 return SuCOS_score, fm_score, protrude_val | 122 SuCOS_score = 0.5 * fm_score + 0.5 * protrude_val |
123 return SuCOS_score, fm_score, protrude_val | |
124 except: | |
125 utils.log("Failed to calculate SuCOS scores. Returning 0,0,0") | |
126 return 0, 0, 0 | |
123 | 127 |
124 def process(refmol_filename, inputs_filename, outputs_filename, refmol_index=None, | 128 def process(refmol_filename, inputs_filename, outputs_filename, refmol_index=None, |
125 refmol_format=None, tani=False, score_mode=FeatMaps.FeatMapScoreMode.All): | 129 refmol_format=None, tani=False, score_mode=FeatMaps.FeatMapScoreMode.All): |
126 | 130 |
127 ref_mol = utils.read_single_molecule(refmol_filename, index=refmol_index, format=refmol_format) | 131 ref_mol = utils.read_single_molecule(refmol_filename, index=refmol_index, format=refmol_format) |