From 11a52fbcd95757625f8140c2d3694f6ed0f98f3d Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Fri, 1 Mar 2019 17:05:45 +0100
Subject: [PATCH] Bowtie: add singularity to nf files

---
 src/nf_modules/Bowtie/indexing.config       | 14 +++++++++++++-
 src/nf_modules/Bowtie/indexing.nf           |  1 -
 src/nf_modules/Bowtie/mapping_paired.config | 11 +++++++++++
 src/nf_modules/Bowtie/mapping_paired.nf     |  1 -
 src/nf_modules/Bowtie/mapping_single.config | 11 +++++++++++
 src/nf_modules/Bowtie/mapping_single.nf     |  1 -
 src/nf_modules/Bowtie/tests.sh              | 18 ++++++++++++++++++
 7 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/src/nf_modules/Bowtie/indexing.config b/src/nf_modules/Bowtie/indexing.config
index 954b245..5e9d823 100644
--- a/src/nf_modules/Bowtie/indexing.config
+++ b/src/nf_modules/Bowtie/indexing.config
@@ -4,10 +4,20 @@ profiles {
     docker.enabled = true
     process {
       withName: index_fasta {
+        cpus = 4
         container = "bowtie:1.2.2"
       }
     }
   }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: index_fasta {
+        cpus = 4
+        container = "file://bin/bowtie:1.2.2.sif"
+      }
+    }
+  }
   psmn {
     process{
       withName: index_fasta {
@@ -16,8 +26,10 @@ profiles {
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
         memory = "20GB"
+        cpus = 16
         time = "12h"
-        queue = 'monointeldeb128'
+        queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
+        penv = 'openmp16'
       }
     }
   }
diff --git a/src/nf_modules/Bowtie/indexing.nf b/src/nf_modules/Bowtie/indexing.nf
index 537d684..cf6bfae 100644
--- a/src/nf_modules/Bowtie/indexing.nf
+++ b/src/nf_modules/Bowtie/indexing.nf
@@ -11,7 +11,6 @@ Channel
 
 process index_fasta {
   tag "$fasta.baseName"
-  cpus 4
   publishDir "results/mapping/index/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/Bowtie/mapping_paired.config b/src/nf_modules/Bowtie/mapping_paired.config
index 5b3b9f9..b27917e 100644
--- a/src/nf_modules/Bowtie/mapping_paired.config
+++ b/src/nf_modules/Bowtie/mapping_paired.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "bowtie:1.2.2"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        cpus = 4
+        container = "file://bin/bowtie:1.2.2.sif"
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "Bowtie/1.2.2:SAMtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 16
         memory = "30GB"
         time = "24h"
         queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
diff --git a/src/nf_modules/Bowtie/mapping_paired.nf b/src/nf_modules/Bowtie/mapping_paired.nf
index cc9f40b..e92cb3d 100644
--- a/src/nf_modules/Bowtie/mapping_paired.nf
+++ b/src/nf_modules/Bowtie/mapping_paired.nf
@@ -19,7 +19,6 @@ Channel
 
 process mapping_fastq {
   tag "$pair_id"
-  cpus 4
   publishDir "results/mapping/bams/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/Bowtie/mapping_single.config b/src/nf_modules/Bowtie/mapping_single.config
index 5b3b9f9..b27917e 100644
--- a/src/nf_modules/Bowtie/mapping_single.config
+++ b/src/nf_modules/Bowtie/mapping_single.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "bowtie:1.2.2"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        cpus = 4
+        container = "file://bin/bowtie:1.2.2.sif"
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "Bowtie/1.2.2:SAMtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 16
         memory = "30GB"
         time = "24h"
         queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
diff --git a/src/nf_modules/Bowtie/mapping_single.nf b/src/nf_modules/Bowtie/mapping_single.nf
index ad9754d..490cb1d 100644
--- a/src/nf_modules/Bowtie/mapping_single.nf
+++ b/src/nf_modules/Bowtie/mapping_single.nf
@@ -19,7 +19,6 @@ Channel
 
 process mapping_fastq {
   tag "$file_id"
-  cpus 4
   publishDir "results/mapping/bams/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/Bowtie/tests.sh b/src/nf_modules/Bowtie/tests.sh
index 803f628..3df87df 100755
--- a/src/nf_modules/Bowtie/tests.sh
+++ b/src/nf_modules/Bowtie/tests.sh
@@ -15,3 +15,21 @@
   --index "results/mapping/index/*.ebwt" \
   --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq"
 
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/Bowtie/indexing.nf \
+  -c src/nf_modules/Bowtie/indexing.config \
+  -profile singularity \
+  --fasta "data/tiny_dataset/fasta/tiny_v2.fasta"
+
+./nextflow src/nf_modules/Bowtie/mapping_single.nf \
+  -c src/nf_modules/Bowtie/mapping_single.config \
+  -profile singularity \
+  --index "results/mapping/index/*.ebwt" \
+  --fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
+
+./nextflow src/nf_modules/Bowtie/mapping_paired.nf \
+  -c src/nf_modules/Bowtie/mapping_paired.config \
+  -profile singularity \
+  --index "results/mapping/index/*.ebwt" \
+  --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq"
+fi
-- 
GitLab