From 211c056651e2f34ec6184e451125830e80f6573e Mon Sep 17 00:00:00 2001 From: Vince Buffalo Date: Sat, 18 May 2024 16:10:12 -0700 Subject: [PATCH] New figure code --- additional_benchmarks/Snakefile | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/additional_benchmarks/Snakefile b/additional_benchmarks/Snakefile index b6eb714..0fe6696 100644 --- a/additional_benchmarks/Snakefile +++ b/additional_benchmarks/Snakefile @@ -101,5 +101,28 @@ rule combine: combined_df = pd.concat(dfs, ignore_index=True) combined_df.to_csv(output[0], sep="\t", index=False) -rule merge: +rule figure: input: "combined_benchmarks.tsv" + output: "benchmark_figure.pdf" + run: + import matplotlib.pyplot as plt + import matplotlib as mpl + mpl.use('agg') + import pandas as pd + d = pd.read_csv(input[0], sep="\t") + d = d.groupby(['tool', 'size'], as_index=False)['s'].median() + fig, ax = plt.subplots() + for tool in d['tool'].unique(): + data = d[d['tool'] == tool] + ax.plot(data['size'], data['s'], '-o', label=tool) + ax.set_title('Benchmark Results') + ax.semilogx() + ax.semilogy() + ax.set_xlabel('Number of BED ranges') + ax.set_ylabel('Time (s)') + ax.legend() + plt.tight_layout() + plt.savefig('benchmark_figure.pdf') + +rule merge: + input: "benchmark_figure.pdf"