diff --git a/src/nf_modules/deepTools/bam_to_bigwig.config b/src/nf_modules/deepTools/bam_to_bigwig.config
index 6ecf0ac2681286bad98b0677f29f44c399b0d1cd..90eada5d007b43584fedb80f9ba650befde65739 100644
--- a/src/nf_modules/deepTools/bam_to_bigwig.config
+++ b/src/nf_modules/deepTools/bam_to_bigwig.config
@@ -3,6 +3,9 @@ profiles {
     docker.temp = 'auto'
     docker.enabled = true
     process {
+      withName: index_bam {
+        container = "sambamba:0.6.7"
+      }
       withName: bam_to_bigwig {
         container = "deeptools:3.0.2"
       }
@@ -10,6 +13,16 @@ profiles {
   }
   psmn {
     process{
+      withName: index_bam {
+        beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
+        module = "sambamba/0.6.7"
+        executor = "sge"
+        clusterOptions = "-m e -cwd -V"
+        memory = "30GB"
+        time = "24h"
+        queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
+        penv = 'openmp16'
+      }
       withName: bam_to_bigwig {
         beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
         module = "deepTools/3.0.2"
diff --git a/src/nf_modules/deepTools/bam_to_bigwig.nf b/src/nf_modules/deepTools/bam_to_bigwig.nf
new file mode 100644
index 0000000000000000000000000000000000000000..012de76a849e5e0e189c012207244525ce574533
--- /dev/null
+++ b/src/nf_modules/deepTools/bam_to_bigwig.nf
@@ -0,0 +1,51 @@
+params.bam = "$baseDir/data/bam/*.bam"
+params.bamidx = "$baseDir/data/bam/*.idx"
+
+log.info "bams files : ${params.bam}"
+
+Channel
+  .fromPath( params.bam )
+  .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" }
+  .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
+  .set { bam_files }
+
+bam_files.into{
+  bam_files_index;
+  bam_files_bigwig
+  }
+
+process index_bam {
+  tag "$file_id"
+  cpus 4
+
+  input:
+    set file_id, file(bam) from bam_files_index
+
+  output:
+    set file_id, "*.bam*" into indexed_bam_file
+
+  script:
+"""
+sambamba index -t ${task.cpus} ${bam}
+"""
+}
+
+bam_files_indexed = bam_files_bigwig.join(indexed_bam_file, by: 0)
+
+process bam_to_bigwig {
+  tag "$file_id"
+  cpus 4
+  publishDir "results/mapping/bigwig/", mode: 'copy'
+
+  input:
+    set file_id, file(bam), file(idx) from bam_files_indexed
+
+  output:
+    set file_id, "*.bw" into sorted_bam_files
+
+  script:
+"""
+bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} -o ${file_id}.bw
+"""
+}
+