32
32
33
33
### start function definitions #########################################
34
34
35
- field_FeatureSteinScore = "FeatureStein_Score"
35
+ field_FeatureSteinQualityScore = "FeatureStein_Qual"
36
+ field_FeatureSteinQuantityScore = "FeatureStein_Quant"
36
37
37
38
# Setting up the features to use in FeatureMap
38
39
ffact = AllChem .BuildFeatureFactory (os .path .join (RDConfig .RDDataDir , 'BaseFeatures.fdef' ))
@@ -54,18 +55,18 @@ def create_feature_map(mol):
54
55
return FeatMaps .FeatMap (feats = feats , weights = [1 ]* len (feats ),params = fmaps .params )
55
56
56
57
def score_featmaps (fm1 ):
57
- "Generate the score for 2 feature maps"
58
+ """ Generate the score for 2 feature maps"" "
58
59
if fm1 .GetNumFeatures () == 0 :
59
- return 0
60
+ return 0 , 0
60
61
else :
61
62
score = fm1 .ScoreFeats (fmaps .GetFeatures ())
62
63
#utils.log(score, fm1.GetNumFeatures())
63
- return score / fm1 .GetNumFeatures ()
64
+ return score , score / fm1 .GetNumFeatures ()
64
65
65
- def get_fmap_score (mol ):
66
+ def get_fmap_scores (mol ):
66
67
featMap = create_feature_map (mol )
67
- score = score_featmaps (featMap )
68
- return score
68
+ quantScore , qualScore = score_featmaps (featMap )
69
+ return quantScore , qualScore
69
70
70
71
def process (inputs , writer ):
71
72
total = 0
@@ -77,11 +78,12 @@ def process(inputs, writer):
77
78
errors += 1
78
79
continue
79
80
try :
80
- score = get_fmap_score (mol )
81
+ quantScore , qualScore = get_fmap_scores (mol )
81
82
# utils.log('Score:', score)
82
83
if total % 1000 == 0 :
83
84
utils .log ('Processed molecule' , total , '...' )
84
- mol .SetDoubleProp (field_FeatureSteinScore , score )
85
+ mol .SetDoubleProp (field_FeatureSteinQualityScore , qualScore )
86
+ mol .SetDoubleProp (field_FeatureSteinQuantityScore , quantScore )
85
87
writer .write (mol )
86
88
success += 1
87
89
except :
@@ -115,8 +117,10 @@ def main():
115
117
116
118
clsMappings = {}
117
119
fieldMetaProps = []
118
- clsMappings [field_FeatureSteinScore ] = "java.lang.Float"
119
- fieldMetaProps .append ({"fieldName" :field_FeatureSteinScore , "values" : {"source" :source , "description" :"FeatureStein score" }})
120
+ clsMappings [field_FeatureSteinQualityScore ] = "java.lang.Float"
121
+ clsMappings [field_FeatureSteinQuantityScore ] = "java.lang.Float"
122
+ fieldMetaProps .append ({"fieldName" :field_FeatureSteinQualityScore , "values" : {"source" :source , "description" :"FeatureStein quality score" },
123
+ "fieldName" :field_FeatureSteinQuantityScore , "values" : {"source" :source , "description" :"FeatureStein quantity score" }})
120
124
121
125
pkl_file = open (args .feat_map , 'rb' )
122
126
fmaps = pickle .load (pkl_file )
0 commit comments