From 5756bb25a98d174ead14f2622070b186aab3937c Mon Sep 17 00:00:00 2001 From: Max Schubach Date: Tue, 17 May 2022 15:14:27 +0200 Subject: [PATCH] feat: ROC and precission curve (plots/PR_ROC_curves_metric) --- plots/PR_ROC_curves_metric/meta.yaml | 4 +++- plots/PR_ROC_curves_metric/wrapper.py | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/plots/PR_ROC_curves_metric/meta.yaml b/plots/PR_ROC_curves_metric/meta.yaml index ad92aab..7e71f05 100644 --- a/plots/PR_ROC_curves_metric/meta.yaml +++ b/plots/PR_ROC_curves_metric/meta.yaml @@ -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 diff --git a/plots/PR_ROC_curves_metric/wrapper.py b/plots/PR_ROC_curves_metric/wrapper.py index c741a27..9b453ea 100644 --- a/plots/PR_ROC_curves_metric/wrapper.py +++ b/plots/PR_ROC_curves_metric/wrapper.py @@ -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} """ )