From fb686f830aae8b9fee26dfbac5d963cabbddd824 Mon Sep 17 00:00:00 2001
From: Emmanuel Labaronne <emmanuel.labaronne@ens-lyon.fr>
Date: Mon, 28 Sep 2020 11:21:11 +0200
Subject: [PATCH] src/RNAseq.nf : cosmetic changes

---
 src/RNAseq.nf | 110 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 78 insertions(+), 32 deletions(-)

diff --git a/src/RNAseq.nf b/src/RNAseq.nf
index 2b940d89..54064704 100644
--- a/src/RNAseq.nf
+++ b/src/RNAseq.nf
@@ -2,18 +2,41 @@
 *	RNAseq Analysis pipeline
 */
 
+//////////////////////////////////////////////////////
+//                    PARAMETERS                    //
+//////////////////////////////////////////////////////
+
+///////////////////////
+// PARMS : FILE PATH //
+///////////////////////
+
 params.fastq_raw = "data/fastq/*{_R1,_R2}.fastq.gz"
 params.output = "results"
-params.do_fastqc = true
-//params.script_cov = "src/norm_coverage.sh"
 params.filter = "data/filter/human_rRNA_tRNA/*.bt2"
 params.index_genome = "data/genome/*.ht2"
-params.do_dedup = true
 params.gtf = "data/annotation/*.gtf"
 params.gtf_collapse = "data/annotation/*.gtf"
 params.index_postgenome = "data/post_genome/*.ht2"
+
+/////////////////////
+// PARMS : OPTIONS //
+/////////////////////
+
+params.do_fastqc = true
+params.do_dedup = true
 params.do_postgenome = true
 
+////////////////////////
+// ADAPTORS SEQUENCES //
+////////////////////////
+
+params.adaptorR1 = "AGATCGGAAGAGCACACGTCTGAACTCCAGTCA"
+params.adaptorR2 = "AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT"
+
+//////////////
+// LOG INFO //
+//////////////
+
 log.info "input raw : ${params.fastq_raw}"
 log.info "outut directory : ${params.output}"
 log.info "filter index files : ${params.filter}"
@@ -27,6 +50,10 @@ log.info "do deduplication ? : ${params.do_dedup}"
 log.info "do post genome alignement ? : ${params.do_postgenome}"
 log.info ""
 
+//////////////
+// CHANNELS //
+//////////////
+
 Channel
    .fromFilePairs(params.fastq_raw)
    .ifEmpty { error "Cannot find any file matching: ${params.fastq_raw}" }
@@ -58,7 +85,18 @@ Channel
    .ifEmpty { error "Cannot find any index files matching: ${params.index_postgenome}" }
    .set { POSTGENOME_INDEX }
 
+//////////////////////////////////////////////////////
+//                     PROCESS                      //
+//////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+//////////////////////////// PRE PROCESS ///////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////
 /* Fastqc of raw input */
+/////////////////////////
 
 process fastqc_raw {
   tag "$file_id"
@@ -77,7 +115,10 @@ process fastqc_raw {
     fastqc ${file_id}* -t ${task.cpus}
     """
 }
+
+///////////////////////
 /* Trimming adaptors */
+///////////////////////
 
 process trimming {
   tag "$file_id"
@@ -119,7 +160,10 @@ process trimming {
 
 CUTADAPT_OUTPUT.into{CUTADAPT_OUTPUT_FASTQC;
                      CUTADAPT_OUTPUT_FILTER}
+
+/////////////////////////
 /* Fastqc of raw input */
+/////////////////////////
 
 process fastqc_cut {
   tag "$file_id"
@@ -139,7 +183,9 @@ process fastqc_cut {
     """
 }
 
+/////////////////////////////
 /* rRNA and tRNA filtering */
+/////////////////////////////
 
 process rRNA_removal {
   tag "$file_id"
@@ -181,7 +227,9 @@ FILTER_FASTQ.into{FILTER_FASTQ_FASTQC;
                   FILTER_FASTQ_POSTGENOME
                 }
 
+/////////////////////////////
 /* Fastqc of filtred reads */
+/////////////////////////////
 
 process fastqc_filter {
   tag "$file_id"
@@ -201,7 +249,15 @@ process fastqc_filter {
     """
 }
 
+
+///////////////////////////////////////////////////////////////////
+//////////////////////////// GENOME ///////////////////////////////
+///////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////
 /*	mapping against human genome with hisat2 */
+///////////////////////////////////////////////
 
 process hisat2_human {
   tag "$file_id"
@@ -245,8 +301,9 @@ fi
 HISAT_ALIGNED.into{HISAT_ALIGNED_FASTQC;
                    HISAT_ALIGNED_DEDUP}
 
-
+////////////////////////////
 /* Fastqc of genome reads */
+////////////////////////////
 
 process fastqc_genome {
   tag "$file_id"
@@ -266,7 +323,9 @@ process fastqc_genome {
     """
 }
 
+////////////////////////////
 /* Deduplication of reads */
+////////////////////////////
 
 process dedup_genome {
   tag "$file_id"
@@ -297,7 +356,9 @@ DEDUP_GENOME.into{DEDUP_GENOME_HTSEQ;
                   DEDUP_GENOME_RNASEQC
                 }
 
-/*                   HTseq */
+///////////
+/* HTseq */
+///////////
 
 process sort_bam {
   tag "$file_id"
@@ -348,7 +409,9 @@ htseq-count ${bam[0]} ${gtf} \
 """
 }
 
-/*                   HTseq */
+///////////////
+/* RNASEQ QC */
+///////////////
 
 process rnaseq_qc {
   tag "$file_id"
@@ -372,8 +435,9 @@ rnaseqc ${gtf} ${bam[0]} -s ${file_id} ./ \
 //////////////////////////// POST GENOME ///////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 
-
+/////////////////////////
 /* HISAT2 POST_GENOMIC */
+/////////////////////////
 
 process hisat2_postGenomic {
   tag "$file_id"
@@ -418,7 +482,9 @@ fi
 POSTGENOME_ALIGNED.into{POSTGENOME_ALIGNED_FASTQC;
                    POSTGENOME_ALIGNED_DEDUP}
 
+////////////////////////////
 /* Deduplication of reads */
+////////////////////////////
 
 process dedup_postgenome {
   tag "$file_id"
@@ -459,34 +525,14 @@ process fastqc_postgenome {
     """
 }
 
-/*
-Channel
-   .fromFilePairs(params.script_cov)
-   .ifEmpty { error "Cannot find any file matching: ${params.script_cov}" }
-   .set {script_channel}
-
-process coverage {
-  tag "$file_id"
-  publishDir "${params.output}/05_coverage/", mode: 'copy'
-
-  input:
-  set file_id, file(bam) from sorted_bam_coverage
-  set script from script_channel.collect()
-
-  output:
-  file "*.bw" into coverage_files
+////////////////////////////////////////////////////////////////////////
+//////////////////////////// POST PROCESS //////////////////////////////
+////////////////////////////////////////////////////////////////////////
 
-  script:
-"""
-bash ${script} -b ${bam} \
-                          -o {file_id}.bw \
-                          --binSize 1 \
-                          -p ${cpus} 8
-"""
-}
-*/
 
+/////////////
 /* MultiQC */
+/////////////
 
 
 process multiqc {
-- 
GitLab