Skip to content

Commit 2e96763

Browse files
committed
added score-threshold as a parameter to xcos
1 parent 63ac14d commit 2e96763

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/python/pipelines/xchem/xcos.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ def getReverseScores(mols, frags, score_threshold, writer):
200200
# Score 1: the score is scaled by the number of bit atoms
201201
score_1 = final_df.Modified_SuCOS_score.sum()
202202

203-
# Let's only get frags with a score > 0
204-
#final_df['SuCOS_score'] = 0.5 * final_df.Feat_score + 0.5 * final_df.Shape_score
203+
# Let's only get frags with a score > 0
205204
final_df = final_df[final_df.Modified_SuCOS_score > 0]
206205

207206
# Get the unique fragments above threshold
@@ -216,7 +215,7 @@ def getReverseScores(mols, frags, score_threshold, writer):
216215
writer.write(mol)
217216
writer.flush()
218217

219-
def process(molecules, fragments, writer):
218+
def process(molecules, fragments, writer, threshold=0.4):
220219

221220
frag_mol_list = []
222221
errors = 0
@@ -231,20 +230,20 @@ def process(molecules, fragments, writer):
231230
utils.log('Using', len(frag_mol_list), 'fragments. No errors')
232231

233232
#mols, frags, score_threshold, writer
234-
getReverseScores(molecules, frag_mol_list, 0.5, writer)
233+
getReverseScores(molecules, frag_mol_list, threshold, writer)
235234

236235

237236
def main():
238237

239238
# Example usage:
240-
# python -m pipelines.xchem.xcos -f ../../data/mpro/hits-17.sdf.gz -i ../../data/mpro/poses.sdf.gz -o xcos
241-
242-
global fmaps
239+
# python -m pipelines.xchem.xcos -f ../../data/mpro/hits-17.sdf.gz -i ../../data/mpro/poses.sdf.gz -o xcos
243240

244241
parser = argparse.ArgumentParser(description='XCos scoring with RDKit')
245242
parameter_utils.add_default_io_args(parser)
246243
parser.add_argument('-f', '--fragments', required=True, help='Fragments to compare')
247244
parser.add_argument('-ff', '--fragments-format', help='Fragments format')
245+
parser.add_argument('-t', '--score-threshold', type=float, default=0.4,
246+
help='Minimum shape overlay and feature map score required for scoring a bit to a fragment')
248247
parser.add_argument('--no-gzip', action='store_true', help='Do not compress the output (STDOUT is never compressed')
249248
parser.add_argument('--metrics', action='store_true', help='Write metrics')
250249

@@ -276,7 +275,7 @@ def main():
276275
compress=not args.no_gzip)
277276

278277
# this does the processing
279-
process(inputs_supplr, frags_suppl, writer)
278+
process(inputs_supplr, frags_suppl, writer, threshold=args.score_threshold)
280279

281280
writer.close()
282281

0 commit comments

Comments
 (0)