From f720ba52c8ae09a315d766d62e6668f40234bd41 Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent@modolo.fr>
Date: Wed, 6 Mar 2019 17:00:38 +0100
Subject: [PATCH] nf_modules: add singularity in config files and tests.sh

---
 src/nf_modules/htseq/htseq.config             | 13 +++++++++
 src/nf_modules/htseq/tests.sh                 |  8 ++++++
 src/nf_modules/kallisto/indexing.config       | 11 ++++++++
 src/nf_modules/kallisto/indexing.nf           |  1 -
 src/nf_modules/kallisto/mapping_paired.config | 11 ++++++++
 src/nf_modules/kallisto/mapping_paired.nf     |  1 -
 src/nf_modules/kallisto/mapping_single.config | 11 ++++++++
 src/nf_modules/kallisto/mapping_single.nf     |  1 -
 src/nf_modules/kallisto/tests.sh              | 21 +++++++++++++++
 src/nf_modules/multiqc/multiqc_paired.config  | 17 ++++++++++++
 src/nf_modules/multiqc/multiqc_single.config  | 17 ++++++++++++
 src/nf_modules/multiqc/tests.sh               | 14 ++++++++++
 .../music/peak_calling_single.config          | 23 ++++++++++++++++
 src/nf_modules/rsem/indexing.config           | 11 ++++++++
 src/nf_modules/rsem/indexing.nf               |  1 -
 .../rsem/quantification_paired.config         | 11 ++++++++
 src/nf_modules/rsem/quantification_paired.nf  |  1 -
 .../rsem/quantification_single.config         | 11 ++++++++
 src/nf_modules/rsem/quantification_single.nf  |  1 -
 src/nf_modules/rsem/tests.sh                  | 23 ++++++++++++++++
 src/nf_modules/samblaster/dedup_sams.config   | 11 ++++++++
 src/nf_modules/samblaster/dedup_sams.nf       |  1 -
 src/nf_modules/samblaster/tests.sh            |  8 ++++++
 src/nf_modules/samtools/filter_bams.config    | 18 ++++++++++---
 src/nf_modules/samtools/filter_bams.nf        |  1 -
 src/nf_modules/samtools/index_bams.config     | 11 ++++++++
 src/nf_modules/samtools/sort_bams.config      | 18 ++++++++++---
 src/nf_modules/samtools/sort_bams.nf          |  1 -
 src/nf_modules/samtools/split_bams.config     | 11 ++++++++
 src/nf_modules/samtools/split_bams.nf         |  1 -
 src/nf_modules/samtools/tests.sh              | 27 +++++++++++++++++++
 src/nf_modules/sratoolkit/fastqdump.config    | 11 ++++++++
 src/nf_modules/sratoolkit/tests.sh            |  8 ++++++
 33 files changed, 319 insertions(+), 16 deletions(-)

diff --git a/src/nf_modules/htseq/htseq.config b/src/nf_modules/htseq/htseq.config
index 94fe2781..95eff69c 100644
--- a/src/nf_modules/htseq/htseq.config
+++ b/src/nf_modules/htseq/htseq.config
@@ -5,9 +5,20 @@ profiles {
     process {
       withName: sort_bam {
         container = "samtools:1.7"
+        cpus = 1
       }
       withName: counting {
         container = "htseq:0.8.0"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: sort_bam {
+        container = "file://bin/htseq:0.8.0.sif"
+        cpus = 1
       }
     }
   }
@@ -18,6 +29,7 @@ profiles {
         module = "samtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
@@ -27,6 +39,7 @@ profiles {
         module = "htseq/0.8.0"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
diff --git a/src/nf_modules/htseq/tests.sh b/src/nf_modules/htseq/tests.sh
index 3bb59705..904b42b3 100755
--- a/src/nf_modules/htseq/tests.sh
+++ b/src/nf_modules/htseq/tests.sh
@@ -5,3 +5,11 @@
   --bam "data/tiny_dataset/map/tiny_v2.bam" \
   -resume
 
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/htseq/htseq.nf \
+  -c src/nf_modules/htseq/htseq.config \
+  -profile docker \
+  --gtf "data/tiny_dataset/annot/tiny.gff" \
+  --bam "data/tiny_dataset/map/tiny_v2.bam" \
+  -resume
+fi
diff --git a/src/nf_modules/kallisto/indexing.config b/src/nf_modules/kallisto/indexing.config
index 8e713129..2db7e1d6 100644
--- a/src/nf_modules/kallisto/indexing.config
+++ b/src/nf_modules/kallisto/indexing.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: index_fasta {
         container = "kallisto:0.44.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: index_fasta {
+        container = "file://bin/kallisto:0.44.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "kallisto/0.44.0"
         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/kallisto/indexing.nf b/src/nf_modules/kallisto/indexing.nf
index 9e38260f..ea153569 100644
--- a/src/nf_modules/kallisto/indexing.nf
+++ b/src/nf_modules/kallisto/indexing.nf
@@ -9,7 +9,6 @@ Channel
 
 process index_fasta {
   tag "$fasta.baseName"
-  cpus 4
   publishDir "results/mapping/index/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/kallisto/mapping_paired.config b/src/nf_modules/kallisto/mapping_paired.config
index a0ec051d..3a26a4fe 100644
--- a/src/nf_modules/kallisto/mapping_paired.config
+++ b/src/nf_modules/kallisto/mapping_paired.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "kallisto:0.44.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        container = "file://bin/kallisto:0.44.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "kallisto/0.44.0"
         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/kallisto/mapping_paired.nf b/src/nf_modules/kallisto/mapping_paired.nf
index 4f4ad3d1..455e70cd 100644
--- a/src/nf_modules/kallisto/mapping_paired.nf
+++ b/src/nf_modules/kallisto/mapping_paired.nf
@@ -15,7 +15,6 @@ Channel
 
 process mapping_fastq {
   tag "$reads"
-  cpus 4
   publishDir "results/mapping/quantification/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/kallisto/mapping_single.config b/src/nf_modules/kallisto/mapping_single.config
index a0ec051d..3a26a4fe 100644
--- a/src/nf_modules/kallisto/mapping_single.config
+++ b/src/nf_modules/kallisto/mapping_single.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "kallisto:0.44.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        container = "file://bin/kallisto:0.44.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "kallisto/0.44.0"
         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/kallisto/mapping_single.nf b/src/nf_modules/kallisto/mapping_single.nf
index 97861e76..95bed864 100644
--- a/src/nf_modules/kallisto/mapping_single.nf
+++ b/src/nf_modules/kallisto/mapping_single.nf
@@ -20,7 +20,6 @@ Channel
 
 process mapping_fastq {
   tag "$file_id"
-  cpus 4
   publishDir "results/mapping/quantification/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/kallisto/tests.sh b/src/nf_modules/kallisto/tests.sh
index 299c8dd5..f8816f0a 100755
--- a/src/nf_modules/kallisto/tests.sh
+++ b/src/nf_modules/kallisto/tests.sh
@@ -18,3 +18,24 @@
   --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" \
   -resume
 
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/kallisto/indexing.nf \
+  -c src/nf_modules/kallisto/indexing.config \
+  -profile docker \
+  --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" \
+  -resume
+
+./nextflow src/nf_modules/kallisto/mapping_single.nf \
+  -c src/nf_modules/kallisto/mapping_single.config \
+  -profile docker \
+  --index "results/mapping/index/tiny_v2.index" \
+  --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" \
+  -resume
+
+./nextflow src/nf_modules/kallisto/mapping_paired.nf \
+  -c src/nf_modules/kallisto/mapping_paired.config \
+  -profile docker \
+  --index "results/mapping/index/tiny_v2.index" \
+  --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" \
+  -resume
+fi
diff --git a/src/nf_modules/multiqc/multiqc_paired.config b/src/nf_modules/multiqc/multiqc_paired.config
index 323e81d2..9e16c674 100644
--- a/src/nf_modules/multiqc/multiqc_paired.config
+++ b/src/nf_modules/multiqc/multiqc_paired.config
@@ -6,9 +6,24 @@ profiles {
     process {
       withName: fastqc_fastq {
         container = "fastqc:0.11.5"
+        cpus = 1
       }
       withName: multiqc {
         container = "multiqc:1.0"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: fastqc_fastq {
+        container = "file://bin/fastqc:0.11.5.sif"
+        cpus = 1
+      }
+      withName: multiqc {
+        container = "file://bin/multiqc:1.0.sif"
+        cpus = 1
       }
     }
   }
@@ -19,6 +34,7 @@ profiles {
         module = "fastqc/0.11.5"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "5GB"
         time = "6h"
         queueSize = 1000
@@ -30,6 +46,7 @@ profiles {
         module = "multiqc/1.0"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "5GB"
         time = "6h"
         queueSize = 1000
diff --git a/src/nf_modules/multiqc/multiqc_single.config b/src/nf_modules/multiqc/multiqc_single.config
index a7f3e82e..56a734c8 100644
--- a/src/nf_modules/multiqc/multiqc_single.config
+++ b/src/nf_modules/multiqc/multiqc_single.config
@@ -5,9 +5,24 @@ profiles {
     process {
       withName: fastqc_fastq {
         container = "fastqc:0.11.5"
+        cpus = 1
       }
       withName: multiqc {
         container = "multiqc:1.0"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: fastqc_fastq {
+        container = "file://bin/fastqc:0.11.5.sif"
+        cpus = 1
+      }
+      withName: multiqc {
+        container = "file://bin/multiqc:1.0.sif"
+        cpus = 1
       }
     }
   }
@@ -18,6 +33,7 @@ profiles {
         module = "fastqc/0.11.5"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "5GB"
         time = "6h"
         queueSize = 1000
@@ -29,6 +45,7 @@ profiles {
         module = "multiqc/1.0"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "5GB"
         time = "6h"
         queueSize = 1000
diff --git a/src/nf_modules/multiqc/tests.sh b/src/nf_modules/multiqc/tests.sh
index b323f300..0ba60764 100755
--- a/src/nf_modules/multiqc/tests.sh
+++ b/src/nf_modules/multiqc/tests.sh
@@ -9,3 +9,17 @@
   -profile docker \
   --fastq "data/tiny_dataset/fastq/tiny_S.fastq" \
   -resume
+
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/multiqc/multiqc_paired.nf \
+  -c src/nf_modules/multiqc/multiqc_paired.config \
+  -profile docker \
+  --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" \
+  -resume
+
+./nextflow src/nf_modules/multiqc/multiqc_single.nf \
+  -c src/nf_modules/multiqc/multiqc_single.config \
+  -profile docker \
+  --fastq "data/tiny_dataset/fastq/tiny_S.fastq" \
+  -resume
+fi
diff --git a/src/nf_modules/music/peak_calling_single.config b/src/nf_modules/music/peak_calling_single.config
index f9a1d799..713c2e7a 100644
--- a/src/nf_modules/music/peak_calling_single.config
+++ b/src/nf_modules/music/peak_calling_single.config
@@ -5,12 +5,32 @@ profiles {
     process {
       withName: compute_mappability {
         container = "music:6613c53"
+        cpus = 1
       }
       withName: music_preprocessing {
         container = "music:6613c53"
+        cpus = 1
       }
       withName: music_computation {
         container = "music:6613c53"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: compute_mappability {
+        container = "file://bin/music:6613c53.sif"
+        cpus = 1
+      }
+      withName: music_preprocessing {
+        container = "file://bin/music:6613c53.sif"
+        cpus = 1
+      }
+      withName: music_computation {
+        container = "file://bin/music:6613c53.sif"
+        cpus = 1
       }
     }
   }
@@ -21,6 +41,7 @@ profiles {
         module = "music/6613c53"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
@@ -30,6 +51,7 @@ profiles {
         module = "music/6613c53"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
@@ -39,6 +61,7 @@ profiles {
         module = "music/6613c53"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
diff --git a/src/nf_modules/rsem/indexing.config b/src/nf_modules/rsem/indexing.config
index 059dbbaa..f7265d65 100644
--- a/src/nf_modules/rsem/indexing.config
+++ b/src/nf_modules/rsem/indexing.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: index_fasta {
         container = "rsem:1.3.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: index_fasta {
+        container = "file://bin/rsem:1.3.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "rsem/1.3.0: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/rsem/indexing.nf b/src/nf_modules/rsem/indexing.nf
index 0f5473ac..4b95622a 100644
--- a/src/nf_modules/rsem/indexing.nf
+++ b/src/nf_modules/rsem/indexing.nf
@@ -14,7 +14,6 @@ Channel
 
 process index_fasta {
   tag "$fasta.baseName"
-  cpus 4
   publishDir "results/mapping/index/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/rsem/quantification_paired.config b/src/nf_modules/rsem/quantification_paired.config
index 16de29e8..520a7064 100644
--- a/src/nf_modules/rsem/quantification_paired.config
+++ b/src/nf_modules/rsem/quantification_paired.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "rsem:1.3.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        container = "file://bin/rsem:1.3.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "rsem/1.3.0: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/rsem/quantification_paired.nf b/src/nf_modules/rsem/quantification_paired.nf
index a22950fd..c9e23ac8 100644
--- a/src/nf_modules/rsem/quantification_paired.nf
+++ b/src/nf_modules/rsem/quantification_paired.nf
@@ -15,7 +15,6 @@ Channel
 
 process mapping_fastq {
   tag "$pair_id"
-  cpus 4
   publishDir "results/mapping/quantification/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/rsem/quantification_single.config b/src/nf_modules/rsem/quantification_single.config
index 16de29e8..520a7064 100644
--- a/src/nf_modules/rsem/quantification_single.config
+++ b/src/nf_modules/rsem/quantification_single.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: mapping_fastq {
         container = "rsem:1.3.0"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: mapping_fastq {
+        container = "file://bin/rsem:1.3.0.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "rsem/1.3.0: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/rsem/quantification_single.nf b/src/nf_modules/rsem/quantification_single.nf
index d52b7f44..fe635ca8 100644
--- a/src/nf_modules/rsem/quantification_single.nf
+++ b/src/nf_modules/rsem/quantification_single.nf
@@ -20,7 +20,6 @@ Channel
 
 process mapping_fastq {
   tag "$file_id"
-  cpus 4
   publishDir "results/mapping/quantification/", mode: 'copy'
 
   input:
diff --git a/src/nf_modules/rsem/tests.sh b/src/nf_modules/rsem/tests.sh
index fdf0aa30..13256a52 100755
--- a/src/nf_modules/rsem/tests.sh
+++ b/src/nf_modules/rsem/tests.sh
@@ -19,3 +19,26 @@
   --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" \
   -resume
 
+
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/rsem/indexing.nf \
+  -c src/nf_modules/rsem/indexing.config \
+  -profile docker \
+  --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" \
+  --annotation "data/tiny_dataset/annot/tiny.gff" \
+  -resume
+
+./nextflow src/nf_modules/rsem/quantification_single.nf \
+  -c src/nf_modules/rsem/quantification_single.config \
+  -profile docker \
+  --index "results/mapping/index/tiny_v2.index*" \
+  --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" \
+  -resume
+
+./nextflow src/nf_modules/rsem/quantification_paired.nf \
+  -c src/nf_modules/rsem/quantification_paired.config \
+  -profile docker \
+  --index "results/mapping/index/tiny_v2.index*" \
+  --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" \
+  -resume
+fi
diff --git a/src/nf_modules/samblaster/dedup_sams.config b/src/nf_modules/samblaster/dedup_sams.config
index 42e3757c..f98a94ca 100644
--- a/src/nf_modules/samblaster/dedup_sams.config
+++ b/src/nf_modules/samblaster/dedup_sams.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: dedup_sam {
         container = "samblaster:0.1.24"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: split_bam {
+        container = "file://bin/sambamba:0.6.7.sif"
+        cpus = 4
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "samblaster/0.1.24"
         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/samblaster/dedup_sams.nf b/src/nf_modules/samblaster/dedup_sams.nf
index ae07c975..24f4fc5a 100644
--- a/src/nf_modules/samblaster/dedup_sams.nf
+++ b/src/nf_modules/samblaster/dedup_sams.nf
@@ -10,7 +10,6 @@ Channel
 
 process dedup_sam {
   tag "$file_id"
-  cpus 4
 
   input:
     set file_id, file(bam) from bam_files
diff --git a/src/nf_modules/samblaster/tests.sh b/src/nf_modules/samblaster/tests.sh
index 962f2b8b..10ad93d7 100755
--- a/src/nf_modules/samblaster/tests.sh
+++ b/src/nf_modules/samblaster/tests.sh
@@ -3,3 +3,11 @@
   -profile docker \
   --bam "data/tiny_dataset/map/tiny_v2.bam" \
   -resume
+
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/samblaster/dedup_sams.nf \
+  -c src/nf_modules/samblaster/dedup_sams.config \
+  -profile docker \
+  --bam "data/tiny_dataset/map/tiny_v2.bam" \
+  -resume
+fi
diff --git a/src/nf_modules/samtools/filter_bams.config b/src/nf_modules/samtools/filter_bams.config
index 36d191dc..0d411c50 100644
--- a/src/nf_modules/samtools/filter_bams.config
+++ b/src/nf_modules/samtools/filter_bams.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: filter_bam {
         container = "samtools:1.7"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: filter_bam {
+        container = "file://bin/samtools:1.7.sif"
+        cpus = 4
       }
     }
   }
@@ -15,9 +25,11 @@ profiles {
         module = "samtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
-        memory = "20GB"
-        time = "12h"
-        queue = 'monointeldeb128'
+        cpus = 16
+        memory = "30GB"
+        time = "24h"
+        queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
+        penv = 'openmp16'
       }
     }
   }
diff --git a/src/nf_modules/samtools/filter_bams.nf b/src/nf_modules/samtools/filter_bams.nf
index 0812a19b..6e81b758 100644
--- a/src/nf_modules/samtools/filter_bams.nf
+++ b/src/nf_modules/samtools/filter_bams.nf
@@ -16,7 +16,6 @@ Channel
 
 process filter_bam {
   tag "$file_id"
-  cpus 4
 
   input:
     set file_id, file(bam) from bam_files
diff --git a/src/nf_modules/samtools/index_bams.config b/src/nf_modules/samtools/index_bams.config
index fc6122c9..3f70dc27 100644
--- a/src/nf_modules/samtools/index_bams.config
+++ b/src/nf_modules/samtools/index_bams.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: index_bam {
         container = "samtools:1.7"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: index_bam {
+        container = "file://bin/samtools:1.7.sif"
+        cpus = 1
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "samtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
diff --git a/src/nf_modules/samtools/sort_bams.config b/src/nf_modules/samtools/sort_bams.config
index 0071ca2c..8a84a222 100644
--- a/src/nf_modules/samtools/sort_bams.config
+++ b/src/nf_modules/samtools/sort_bams.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: sort_bam {
         container = "samtools:1.7"
+        cpus = 4
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: sort_bam {
+        container = "file://bin/samtools:1.7.sif"
+        cpus = 4
       }
     }
   }
@@ -15,9 +25,11 @@ profiles {
         module = "samtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
-        memory = "20GB"
-        time = "12h"
-        queue = 'monointeldeb128'
+        cpus = 16
+        memory = "30GB"
+        time = "24h"
+        queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
+        penv = 'openmp16'
       }
     }
   }
diff --git a/src/nf_modules/samtools/sort_bams.nf b/src/nf_modules/samtools/sort_bams.nf
index ab5c7e51..db1b30d1 100644
--- a/src/nf_modules/samtools/sort_bams.nf
+++ b/src/nf_modules/samtools/sort_bams.nf
@@ -10,7 +10,6 @@ Channel
 
 process sort_bam {
   tag "$file_id"
-  cpus 4
 
   input:
     set file_id, file(bam) from bam_files
diff --git a/src/nf_modules/samtools/split_bams.config b/src/nf_modules/samtools/split_bams.config
index e2d521ce..8b285ac9 100644
--- a/src/nf_modules/samtools/split_bams.config
+++ b/src/nf_modules/samtools/split_bams.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: split_bam {
         container = "samtools:1.7"
+        cpus = 2
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: split_bam {
+        container = "file://bin/samtools:1.7.sif"
+        cpus = 2
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "samtools/1.7"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
diff --git a/src/nf_modules/samtools/split_bams.nf b/src/nf_modules/samtools/split_bams.nf
index f8ba6a50..0d02a5d1 100644
--- a/src/nf_modules/samtools/split_bams.nf
+++ b/src/nf_modules/samtools/split_bams.nf
@@ -10,7 +10,6 @@ Channel
 
 process split_bam {
   tag "$file_id"
-  cpus 2
 
   input:
     set file_id, file(bam) from bam_files
diff --git a/src/nf_modules/samtools/tests.sh b/src/nf_modules/samtools/tests.sh
index e9bd50d0..256fa058 100755
--- a/src/nf_modules/samtools/tests.sh
+++ b/src/nf_modules/samtools/tests.sh
@@ -22,3 +22,30 @@
   --bam "data/tiny_dataset/map/tiny_v2.bam" \
   --bed "data/tiny_dataset/OLD/2genes.bed" \
   -resume
+
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/samtools/sort_bams.nf \
+  -c src/nf_modules/samtools/sort_bams.config \
+  -profile docker \
+  --bam "data/tiny_dataset/map/tiny_v2.bam" \
+  -resume
+
+./nextflow src/nf_modules/samtools/index_bams.nf \
+  -c src/nf_modules/samtools/index_bams.config \
+  -profile docker \
+  --bam "data/tiny_dataset/map/tiny_v2.sort.bam" \
+  -resume
+
+./nextflow src/nf_modules/samtools/split_bams.nf \
+  -c src/nf_modules/samtools/split_bams.config \
+  -profile docker \
+  --bam "data/tiny_dataset/map/tiny_v2.bam" \
+  -resume
+
+./nextflow src/nf_modules/samtools/filter_bams.nf \
+  -c src/nf_modules/samtools/filter_bams.config \
+  -profile docker \
+  --bam "data/tiny_dataset/map/tiny_v2.bam" \
+  --bed "data/tiny_dataset/OLD/2genes.bed" \
+  -resume
+fi
diff --git a/src/nf_modules/sratoolkit/fastqdump.config b/src/nf_modules/sratoolkit/fastqdump.config
index ef335129..9a0a30cf 100644
--- a/src/nf_modules/sratoolkit/fastqdump.config
+++ b/src/nf_modules/sratoolkit/fastqdump.config
@@ -5,6 +5,16 @@ profiles {
     process {
       withName: fastq_dump {
         container = "sratoolkit:2.8.2"
+        cpus = 1
+      }
+    }
+  }
+  singularity {
+    singularity.enabled = true
+    process {
+      withName: split_bam {
+        container = "file://bin/sambamba:0.6.7.sif"
+        cpus = 1
       }
     }
   }
@@ -15,6 +25,7 @@ profiles {
         module = "sratoolkit/2.8.2"
         executor = "sge"
         clusterOptions = "-m e -cwd -V"
+        cpus = 1
         memory = "20GB"
         time = "12h"
         queue = 'monointeldeb128'
diff --git a/src/nf_modules/sratoolkit/tests.sh b/src/nf_modules/sratoolkit/tests.sh
index 97d8026b..1747137d 100755
--- a/src/nf_modules/sratoolkit/tests.sh
+++ b/src/nf_modules/sratoolkit/tests.sh
@@ -3,3 +3,11 @@
   -profile docker \
   --list_srr "src/nf_modules/sratoolkit/list-srr.txt" \
   -resume
+
+if [ -x "$(command -v singularity)" ]; then
+./nextflow src/nf_modules/sratoolkit/fastqdump.nf \
+  -c src/nf_modules/sratoolkit/fastqdump.config \
+  -profile docker \
+  --list_srr "src/nf_modules/sratoolkit/list-srr.txt" \
+  -resume
+fi
-- 
GitLab