diff --git a/src/RNAseq_sen1D.nf b/src/RNAseq_sen1D.nf
index f9353bd0104d5668cfb434d5c7d228be058eaa77..fd1858df5dd97f9ad4dc5e3704216e99ce105c33 100644
--- a/src/RNAseq_sen1D.nf
+++ b/src/RNAseq_sen1D.nf
@@ -155,3 +155,54 @@ if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
 fi
 """
 }
+
+/*                      bams sorting                                    */
+process sort_bam {
+  tag "$bam.baseName"
+  cpus 4
+
+  input:
+    file bam from bam_files
+
+  output:
+    file "*_sorted.bam" into sorted_bam_files
+
+  script:
+"""
+samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam}
+"""
+}
+
+/*                      bams indexing                                     */
+
+process index_bam {
+  tag "$bam.baseName"
+  input:
+    file bam from sorted_bam_files
+  output:
+    file "*bam*" into indexed_bam_file
+  script:
+"""
+samtools index ${bam}
+"""
+}
+
+
+/*                      bams spliting                                     */
+
+process split_bam {
+  tag "$bam.baseName"
+  cpus 2
+
+  input:
+    file bam from indexed_bam_files
+
+  output:
+    file "*_forward.bam*" into forward_bam_files
+    file "*_reverse.bam*" into reverse_bam_files
+  script:
+"""
+samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam &
+samtools view -hb -f 0x10 ${bam} > ${bam}_reverse.bam
+"""
+}