From 384e4ef6203b04481d8641ed406dd0776d6bd473 Mon Sep 17 00:00:00 2001
From: Dominik <dominik.brilhaus@hhu.de>
Date: Fri, 24 Mar 2023 12:40:49 +0100
Subject: [PATCH] docker-free kallisto quant

---
 runs/kallisto_quant/run.cwl                | 77 +++++++++++++---------
 runs/kallisto_quant/run.yml                |  3 +
 workflows/kallisto_quant/kallisto_quant.sh | 18 +----
 workflows/kallisto_quant/workflow.cwl      | 53 ---------------
 workflows/kallisto_sleuth/workflow.cwl     | 33 ----------
 5 files changed, 50 insertions(+), 134 deletions(-)
 delete mode 100644 workflows/kallisto_quant/workflow.cwl
 delete mode 100644 workflows/kallisto_sleuth/workflow.cwl

diff --git a/runs/kallisto_quant/run.cwl b/runs/kallisto_quant/run.cwl
index af2bc99..980dc14 100644
--- a/runs/kallisto_quant/run.cwl
+++ b/runs/kallisto_quant/run.cwl
@@ -1,36 +1,49 @@
 #!/usr/bin/env cwl-runner
+
 cwlVersion: v1.2
-class: Workflow
+class: CommandLineTool
+
 inputs:
-  out_folder:
-    type: string
-  in_kallisto_index:
-    type: File
-  in_fastq_dir:
-    type: Directory
-  kallisto_bootstrap:
-    type: int
-  kallisto_threads:
-    type: int
-  kallisto_fragmentLength:
-    type: int
-  kallisto_stdDev:
-    type: int
+- id: sh_script
+  type: File
+  inputBinding:
+    position: 0
+- id: out_folder
+  type: string
+  inputBinding:
+    position: 1
+- id: in_kallisto_index
+  type: File
+  inputBinding:
+    position: 2
+- id: in_fastq_dir
+  type: Directory
+  inputBinding:
+    position: 3
+- id: kallisto_bootstrap
+  type: int
+  inputBinding:
+    position: 4
+- id: kallisto_threads
+  type: int
+  inputBinding:
+    position: 5
+- id: kallisto_fragmentLength
+  type: int
+  inputBinding:
+    position: 6
+- id: kallisto_stdDev
+  type: int
+  inputBinding:
+    position: 7
+
 outputs:
-  out_dir:
-    type:
-      type: array
-      items: Directory
-    outputSource: kallisto_quant/outdir
-steps:
-  kallisto_quant:
-    run: ../../workflows/kallisto_quant/workflow.cwl
-    in:
-      out_folder: out_folder
-      in_kallisto_index: in_kallisto_index
-      in_fastq_dir: in_fastq_dir
-      kallisto_bootstrap: kallisto_bootstrap
-      kallisto_threads: kallisto_threads
-      kallisto_fragmentLength: kallisto_fragmentLength
-      kallisto_stdDev: kallisto_stdDev
-    out: [outdir]
+- id: outdir
+  type:
+    type: array
+    items: Directory
+  outputBinding:
+    glob: $(runtime.outdir)/$(inputs.out_folder)
+
+baseCommand:
+- bash
diff --git a/runs/kallisto_quant/run.yml b/runs/kallisto_quant/run.yml
index e5c7505..09afef4 100644
--- a/runs/kallisto_quant/run.yml
+++ b/runs/kallisto_quant/run.yml
@@ -1,4 +1,7 @@
 cores: 4
+sh_script:
+  class: File
+  path: ../../workflows/kallisto_quant/kallisto_quant.sh
 out_folder: ./kallisto_results
 in_kallisto_index:
   class: File
diff --git a/workflows/kallisto_quant/kallisto_quant.sh b/workflows/kallisto_quant/kallisto_quant.sh
index 124698c..63d0cb1 100644
--- a/workflows/kallisto_quant/kallisto_quant.sh
+++ b/workflows/kallisto_quant/kallisto_quant.sh
@@ -3,19 +3,6 @@
 ### Map RNASeq reads via kallisto
 ### Note, this is written for single-end mode only
 
-################################################
-#### CWL-independent tests
-################################################
-
-# arc_root=/Users/dominikbrilhaus/gitlab_dataplant/samplearc_rnaseq
-# out_folder=runs/kallisto_quant/kallisto_results_v48_anaconda
-# in_kallisto_index=runs/kallisto_index/kallisto_index
-# in_fastq_folder=assays/Talinum_RNASeq_minimal/dataset
-# kallisto_bootstrap=100
-# kallisto_threads=4
-# kallisto_fragmentLength=200
-# kallisto_stdDev=20
-
 ################################################
 #### Read arguments from CLI
 ################################################
@@ -45,9 +32,8 @@ fastq_files=$(ls "${in_fastq_folder}"/*fastq*)
 ################################################
 
 for j in $fastq_files; do
-
-	# cut away path. retain only first six chars of file name
-	sampleName=$(echo $j | sed -e 's|.*/||' | sed -e 's|.fastq.*||')
+	
+	sampleName=$(basename $j)
 	
 	echo $sampleName
 	
diff --git a/workflows/kallisto_quant/workflow.cwl b/workflows/kallisto_quant/workflow.cwl
deleted file mode 100644
index 1041d73..0000000
--- a/workflows/kallisto_quant/workflow.cwl
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env cwl-runner
-cwlVersion: v1.2
-class: CommandLineTool
-hints:
-  DockerRequirement:
-    dockerPull: zlskidmore/kallisto:0.48.0
-requirements:
-- class: InitialWorkDirRequirement
-  listing:
-  - class: File
-    location: kallisto_quant.sh
-baseCommand:
-- bash
-arguments:
-- position: 0
-  valueFrom: ./kallisto_quant.sh
-inputs:
-- id: out_folder
-  type: string
-  inputBinding:
-    position: 1
-- id: in_kallisto_index
-  type: File
-  inputBinding:
-    position: 2
-- id: in_fastq_dir
-  type: Directory
-  inputBinding:
-    position: 3
-- id: kallisto_bootstrap
-  type: int
-  inputBinding:
-    position: 4
-- id: kallisto_threads
-  type: int
-  inputBinding:
-    position: 5
-- id: kallisto_fragmentLength
-  type: int
-  inputBinding:
-    position: 6
-- id: kallisto_stdDev
-  type: int
-  inputBinding:
-    position: 7
-
-outputs:
-- id: outdir
-  type:
-    type: array
-    items: Directory
-  outputBinding:
-    glob: $(runtime.outdir)/$(inputs.out_folder)
diff --git a/workflows/kallisto_sleuth/workflow.cwl b/workflows/kallisto_sleuth/workflow.cwl
deleted file mode 100644
index 48ac0b1..0000000
--- a/workflows/kallisto_sleuth/workflow.cwl
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env cwl-runner
-
-cwlVersion: v1.2
-class: CommandLineTool
-hints:
-  DockerRequirement:
-    dockerPull: zimmera95/rnaseq:latest
-requirements:
-  - class: InitialWorkDirRequirement
-    listing:
-      - class: File
-        location: kallisto_sleuth.R
-baseCommand:
-- Rscript
-arguments:
-  - position: 0
-    valueFrom: kallisto_sleuth.R
-inputs:
-  - id: in_sleuth
-    type: File
-    inputBinding:
-      position: 1
-  - id: out_folder
-    type: string
-    inputBinding:
-      position: 2
-outputs:
-- id: outdir
-  type:
-    type: array
-    items: Directory
-  outputBinding:
-    glob: $(runtime.outdir)/$(inputs.out_folder)
-- 
GitLab