Mercurial > repos > bgruening > sucos_clustering
diff sucos.py @ 1:dbfcc048cbbc draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/sucos commit 6f1ee2812cca091561a2b2e464498dae2f913b8d"
| author | bgruening |
|---|---|
| date | Thu, 19 Mar 2020 13:09:24 +0000 |
| parents | c0e3a335dbfc |
| children | ba1a2eba3f3d |
line wrap: on
line diff
--- a/sucos.py Wed Oct 02 13:00:09 2019 -0400 +++ b/sucos.py Thu Mar 19 13:09:24 2020 +0000 @@ -109,17 +109,21 @@ fm_score = get_FeatureMapScore(ref_features, query_features, tani, score_mode) fm_score = np.clip(fm_score, 0, 1) - if tani: - tani_sim = 1 - float(rdShapeHelpers.ShapeTanimotoDist(ref_mol, query_mol)) - tani_sim = np.clip(tani_sim, 0, 1) - SuCOS_score = 0.5*fm_score + 0.5*tani_sim - return SuCOS_score, fm_score, tani_sim - else: - protrude_dist = rdShapeHelpers.ShapeProtrudeDist(ref_mol, query_mol, allowReordering=False) - protrude_dist = np.clip(protrude_dist, 0, 1) - protrude_val = 1.0 - protrude_dist - SuCOS_score = 0.5 * fm_score + 0.5 * protrude_val - return SuCOS_score, fm_score, protrude_val + try : + if tani: + tani_sim = 1 - float(rdShapeHelpers.ShapeTanimotoDist(ref_mol, query_mol)) + tani_sim = np.clip(tani_sim, 0, 1) + SuCOS_score = 0.5*fm_score + 0.5*tani_sim + return SuCOS_score, fm_score, tani_sim + else: + protrude_dist = rdShapeHelpers.ShapeProtrudeDist(ref_mol, query_mol, allowReordering=False) + protrude_dist = np.clip(protrude_dist, 0, 1) + protrude_val = 1.0 - protrude_dist + SuCOS_score = 0.5 * fm_score + 0.5 * protrude_val + return SuCOS_score, fm_score, protrude_val + except: + utils.log("Failed to calculate SuCOS scores. Returning 0,0,0") + return 0, 0, 0 def process(refmol_filename, inputs_filename, outputs_filename, refmol_index=None, refmol_format=None, tani=False, score_mode=FeatMaps.FeatMapScoreMode.All):
