diff --git a/src/RibosomeProfiling.nf b/src/RibosomeProfiling.nf index e8545196e799ab58afba195231d16d74e7714fe8..a145b80c27b7378975cee891ee9df9154f84ac14 100644 --- a/src/RibosomeProfiling.nf +++ b/src/RibosomeProfiling.nf @@ -276,6 +276,9 @@ hisat2 -x ${index_id} \ --un-gz ${file_id}_notaligned.fastq.gz \ --rna-strandness ${params.strand} \ --dta \ + --no-softclip \ + --trim5 1\ + --trim3 1\ 2> ${file_id}_genome.txt \ | samtools view -bS -F 4 - \ | samtools sort -@ ${task.cpus} -o ${file_id}.bam \ @@ -316,29 +319,29 @@ process fastqc_genome { /* Deduplication of reads */ //////////////////////////// -process dedup_genome { - tag "$file_id" - publishDir "${params.output}/03_hisat2/dedup/", mode: 'copy' +if (params.do_dedup) { + process dedup_genome { + tag "$file_id" + publishDir "${params.output}/03_hisat2/dedup/", mode: 'copy' - input: - set file_id, file(bam) from HISAT_ALIGNED_DEDUP + input: + set file_id, file(bam) from HISAT_ALIGNED_DEDUP - output: - set file_id, "*.{bam, bai}" into DEDUP_GENOME - file "*.log" into DEDUP_LOG + output: + set file_id, "*.{bam, bai}" into DEDUP_GENOME + file "*.log" into DEDUP_LOG - when: - params.do_dedup + when: + params.do_dedup - """ - umi_tools dedup -I ${bam[0]} \ - -S ${file_id}.dedup.bam \ - > ${file_id}_dedup.log - """ -} - -if (! params.do_dedup) { - HISAT_ALIGNED_DEDUP.into{DEDUP_GENOME} + """ + umi_tools dedup -I ${bam[0]} \ + -S ${file_id}.dedup.bam \ + > ${file_id}_dedup.log + """ + } +} else { + HISAT_ALIGNED_DEDUP.set{DEDUP_GENOME} } DEDUP_GENOME.into{DEDUP_GENOME_HTSEQ; @@ -456,7 +459,7 @@ hisat2 -x ${index2_id} \ --rna-strandness ${params.strand} \ --dta\ 2> ${file_id}_postgenome.txt \ -| samtools view -bS -F 4 - \ +| samtools view -bS -F 4 -F 256 - \ | samtools sort -@ ${task.cpus} -o ${file_id}.bam \ && samtools index ${file_id}.bam @@ -473,25 +476,29 @@ POSTGENOME_ALIGNED.into{POSTGENOME_ALIGNED_FASTQC; /* Deduplication of reads */ //////////////////////////// -process dedup_postgenome { - tag "$file_id" - publishDir "${params.output}/05_post_genome_hisat2/dedup/", mode: 'copy' +if (params.do_dedup){ + process dedup_postgenome { + tag "$file_id" + publishDir "${params.output}/05_post_genome_hisat2/dedup/", mode: 'copy' - input: - set file_id, file(bam) from POSTGENOME_ALIGNED_DEDUP + input: + set file_id, file(bam) from POSTGENOME_ALIGNED_DEDUP - output: - set file_id, "*.{bam, bai}" into DEDUP_POSTGENOME - file "*.log" into DEDUP_POSTGENOME_LOG + output: + set file_id, "*.{bam, bai}" into DEDUP_POSTGENOME + file "*.log" into DEDUP_POSTGENOME_LOG - when: - params.do_dedup + when: + params.do_dedup + + """ + umi_tools dedup -I ${bam[0]} \ + -S ${file_id}.dedup.bam \ + > ${file_id}_dedup.log + """ + } +} else { - """ - umi_tools dedup -I ${bam[0]} \ - -S ${file_id}.dedup.bam \ - > ${file_id}_dedup.log - """ } process fastqc_postgenome {