From 462bb713dc7a04f68617beda01fc1f6e79f23834 Mon Sep 17 00:00:00 2001
From: user name <ameynert@sdf-cs1.eidf.epcc.ed.ac.uk>
Date: Wed, 10 Aug 2022 17:05:51 +0100
Subject: [PATCH] Alternative samplesheet for cnv calling - bam/bai files
 instead of fastq1/fastq2

---
 pipeline/inputs.nf | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/pipeline/inputs.nf b/pipeline/inputs.nf
index d73f38a..de6222f 100644
--- a/pipeline/inputs.nf
+++ b/pipeline/inputs.nf
@@ -39,7 +39,7 @@ workflow read_inputs {
 
 
         /*
-        ch_samplesheet_info - Tuple channel of individual ID, r1 fastqs and r2 fastqs:
+        ch_samplesheet_info - Tuple channel of individual ID, r1 fastqs and r2 fastqs -OR- BAM and BAI files:
         [
             [
                 indv1,
@@ -53,11 +53,19 @@ workflow read_inputs {
         ]
         */
         ch_samplesheet = Channel.fromPath(params.sample_sheet, checkIfExists: true)
-        ch_samplesheet_info = ch_samplesheet.splitCsv(sep:'\t', header: true)
-            .map(
-                { line -> [line.individual_id, file(line.read_1), file(line.read_2), line.bam]}
-            )
-            .groupTuple()
+
+        if (params.workflow == 'variant-calling') {
+            ch_samplesheet_info = ch_samplesheet.splitCsv(sep:'\t', header: true)
+                .map(
+                    { line -> [line.individual_id, file(line.read_1), file(line.read_2)]}
+                )
+                .groupTuple()
+        } else if (params.workflow == 'cnv-calling') {
+            ch_samplesheet_info = ch_samplesheet.splitCsv(sep:'\t', header: true)
+                .map(
+                    { line -> [line.individual_id, file(line.bam), file(line.bai)]}
+                )
+	}
 
         /*
         ch_individuals - merge of samplesheet and ped file information:
@@ -97,7 +105,7 @@ workflow read_inputs {
         ]
         */
         ch_individuals_by_family = ch_individuals.map({[it[1], it]})
-    
+
     emit:
         ch_ped_file = ch_ped_file
         ch_ped_file_info = ch_ped_file_info
-- 
GitLab