Skip to content
Snippets Groups Projects
Commit 722849c1 authored by Carlos de Lannoy's avatar Carlos de Lannoy
Browse files

summarized stats for quick benchmark

parent fdfba74c
No related branches found
No related tags found
No related merge requests found
......@@ -29,13 +29,22 @@ rule parse_inference_results:
inference_out_dir='{{ inference_out_dir }}',
index_fold_csv='{{ read_index_fn }}'
output:
summary_file='{{ out_dir }}inference_summary.csv'
summary_file='{{ out_dir }}inference_summary.csv',
stats_file='{{ out_dir }}stats.txt'
run:
read_index_df = pd.read_csv(input.index_fold_csv, index_col=0)
out_df = pd.DataFrame({'is_target': False}, index=read_index_df.query('fold == False').index)
for fn in os.listdir(input.inference_out_dir + '/pos_reads/'):
out_df.loc[os.path.basename(fn), 'is_target'] = True
out_df.to_csv(output.summary_file)
tp = len(out_df.query('is_target and tp'))
p = len(out_df.query('tp'))
pred = len(out_df.query('is_target'))
precision = tp / pred
recall = tp / p
accuracy = tp / len(out_df)
with open(output.stats_file, 'w') as fh:
fh.write(f'precision: {precision}\nrecall: {recall}\naccuracy: {accuracy}')
rule run_inference:
input:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment