From cb06bbb8b5c525777e1949f1f878d0821e1caf96 Mon Sep 17 00:00:00 2001 From: Dominik Brilhaus <brilhaus@nfdi4plants.org> Date: Fri, 2 Aug 2024 16:48:29 +0200 Subject: [PATCH] trying to fix use of R with CWL --- renv.Rmd | 0 runs/kallisto/README.md | 2 +- runs/kallisto_collect/README.md | 6 ++++++ runs/kallisto_collect/run.yml | 8 ++------ workflows/kallisto_collect/kallisto_collect.R | 11 ++++++++--- .../kallisto_collect/kallisto_collect.cwl | 19 ++++++++++++------- .../kallisto_sleuth/kallisto_sleuth.cwl | 0 7 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 renv.Rmd create mode 100644 runs/kallisto_collect/README.md rename runs/kallisto_collect/run.cwl => workflows/kallisto_collect/kallisto_collect.cwl (69%) rename runs/kallisto_sleuth/run.cwl => workflows/kallisto_sleuth/kallisto_sleuth.cwl (100%) diff --git a/renv.Rmd b/renv.Rmd new file mode 100644 index 0000000..e69de29 diff --git a/runs/kallisto/README.md b/runs/kallisto/README.md index 2f01d07..e3c73f3 100644 --- a/runs/kallisto/README.md +++ b/runs/kallisto/README.md @@ -1,6 +1,6 @@ # Kallisto Workflow -## Executing individual steps +## Executing the multi-step workflow ```bash cd runs/kallisto/ diff --git a/runs/kallisto_collect/README.md b/runs/kallisto_collect/README.md new file mode 100644 index 0000000..a680462 --- /dev/null +++ b/runs/kallisto_collect/README.md @@ -0,0 +1,6 @@ + + +```bash +cd runs/kallisto_collect/ +cwltool ../../workflows/kallisto_collect/kallisto_collect.cwl run.yml > $(date +"%Y-%m-%d_%H-%M").log 2>&1 & +``` diff --git a/runs/kallisto_collect/run.yml b/runs/kallisto_collect/run.yml index 2a4197c..ba0dd18 100644 --- a/runs/kallisto_collect/run.yml +++ b/runs/kallisto_collect/run.yml @@ -1,10 +1,6 @@ -cores: 1 -r_script: - class: File - path: ../../workflows/kallisto_collect/kallisto_collect.R -in_kallisto_results: +in_kallisto_results: class: Directory - path: ../kallisto_sleuth/out + path: ../runs/kallisto/kallisto_results in_metadata_file: class: File path: ../merged_isa_metadata/out/merged_isa.tsv diff --git a/workflows/kallisto_collect/kallisto_collect.R b/workflows/kallisto_collect/kallisto_collect.R index 6a24e7e..b2023ff 100644 --- a/workflows/kallisto_collect/kallisto_collect.R +++ b/workflows/kallisto_collect/kallisto_collect.R @@ -4,9 +4,14 @@ #### Load required library ################################################ -library(sleuth) -library(tidyverse) -library(jsonlite) +if(!"BiocManager" %in% row.names(installed.packages())){install.packages('BiocManager')} + +if(!"sleuth" %in% row.names(installed.packages())){ + BiocManager::install('pachterlab/sleuth') +} +if(!"tidyverse" %in% row.names(installed.packages())){install.packages("tidyverse")} +if(!"openxlsx" %in% row.names(installed.packages())){install.packages("openxlsx")} +if(!"jsonlite" %in% row.names(installed.packages())){install.packages("jsonlite")} ################################################ #### Read arguments from CLI diff --git a/runs/kallisto_collect/run.cwl b/workflows/kallisto_collect/kallisto_collect.cwl similarity index 69% rename from runs/kallisto_collect/run.cwl rename to workflows/kallisto_collect/kallisto_collect.cwl index eaee053..6428310 100644 --- a/runs/kallisto_collect/run.cwl +++ b/workflows/kallisto_collect/kallisto_collect.cwl @@ -3,11 +3,19 @@ cwlVersion: v1.2 class: CommandLineTool +requirements: + - class: InitialWorkDirRequirement + listing: + - entryname: kallisto_collect.R + entry: + $include: kallisto_collect.R + - class: NetworkAccess + networkAccess: true + +baseCommand: [Rscript, kallisto_collect.R] + inputs: -- id: r_script - type: File - inputBinding: - position: 0 + - id: in_kallisto_results type: Directory inputBinding: @@ -36,6 +44,3 @@ outputs: items: Directory outputBinding: glob: $(runtime.outdir)/$(inputs.out_folder) - -baseCommand: -- Rscript diff --git a/runs/kallisto_sleuth/run.cwl b/workflows/kallisto_sleuth/kallisto_sleuth.cwl similarity index 100% rename from runs/kallisto_sleuth/run.cwl rename to workflows/kallisto_sleuth/kallisto_sleuth.cwl -- GitLab