Skip to content

Commit

Permalink
feat: ROC and precission curve
Browse files Browse the repository at this point in the history
(plots/PR_ROC_curves_metric)
  • Loading branch information
Max Schubach committed May 17, 2022
1 parent 588c06d commit 5756bb2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
4 changes: 3 additions & 1 deletion plots/PR_ROC_curves_metric/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ description: Using the result of evaluate/metrics_per_threshold to create a Prec
authors:
- Max Schubach
input: TSV tables with headers from evaluate/metrics_per_threshold
output: The plot
output: The PR or ROC plot
params:
xname: Name of the x-lab (default Score)
yname: Name of the y-lab (default Value)
type: Type of plot that should be generated, ROC or PR
names: List of names that should be uses as fill variable. Same length as input
25 changes: 21 additions & 4 deletions plots/PR_ROC_curves_metric/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,31 @@ def __str__(self):
else:
param_yname = ""

if "type" in snakemake.params.keys():
param_type = snakemake.params["type"]
else:
raise MissingParameterException("type")

if "names" in snakemake.params.keys():
param_name = "--name '%s'" % ",".join(snakemake.params["names"])
else:
raise MissingParameterException("names")

inputs = ",".join(snakemake.input)


if len(snakemake.log) > 0:
log = "&> %s" % snakemake.log[0]
else:
log = ""

# running the shell
shell(
"""
Rscript {scriptFolder}/pre_re_f1_f2.R \
{param_xname} {param_yname} \
--input {snakemake.input} \
--output {snakemake.output}
Rscript {scriptFolder}/pr_roc_curve.R \
{param_xname} {param_yname} {param_name}\
--type {param_type} \
--input {inputs} \
--output {snakemake.output} {log}
"""
)

0 comments on commit 5756bb2

Please sign in to comment.