From 20f7b1f764cf787f7fa5c29ee9f39a491f40cc13 Mon Sep 17 00:00:00 2001
From: Dominik Brilhaus <brilhaus@nfdi4plants.org>
Date: Mon, 5 Aug 2024 11:26:45 +0200
Subject: [PATCH] allow to adapt which part of the file name(s) shall be kept

---
 runs/kallisto/workflow.yml               |  2 ++
 workflows/kallisto/kallisto-workflow.cwl | 12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/runs/kallisto/workflow.yml b/runs/kallisto/workflow.yml
index 65f21a5..21d672d 100644
--- a/runs/kallisto/workflow.yml
+++ b/runs/kallisto/workflow.yml
@@ -34,6 +34,8 @@ InputReadsMultipleSamples:
       path: ../../assays/Talinum_RNASeq_minimal/dataset/DB_165_re-C3MD_GTGAAA_L002_R1_001.fastq.gz
       format: edam:format_1930 # FASTQ
 
+numUnderscoresFileName: 1
+
 ### Kallisto quant Parameters
 isSingle: true
 FragmentLength: 200
diff --git a/workflows/kallisto/kallisto-workflow.cwl b/workflows/kallisto/kallisto-workflow.cwl
index 8a94523..e7f0350 100644
--- a/workflows/kallisto/kallisto-workflow.cwl
+++ b/workflows/kallisto/kallisto-workflow.cwl
@@ -14,6 +14,12 @@ inputs:
       items: 
         type: array
         items: File
+  # numCharsFileName:
+  #   type: int
+  #   default: 6
+  numUnderscoresFileName:
+    type: int
+    default: 2
   isSingle: boolean
   FragmentLength: double?  
   StandardDeviation: double?
@@ -37,9 +43,13 @@ steps:
     scatterMethod: dotproduct
     in:
       InputReads: InputReadsMultipleSamples
+      # numChars:
+      #   source: numCharsFileName
+      numUnderscores: numUnderscoresFileName
       QuantOutfolder:
         source: InputReadsMultipleSamples
-        valueFrom: $(self[0].nameroot.substring(0,6))
+        # valueFrom: $(self[0].nameroot.substring(0, inputs.numChars))
+        valueFrom: $(self[0].nameroot.split('_').slice(0, inputs.numUnderscores).join('_'))
       Index: index/index
       isSingle: isSingle
       FragmentLength: FragmentLength 
-- 
GitLab