Skip to content
Snippets Groups Projects
Verified Commit 8b70de28 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

update solution_RNASeq.nf to match CONTRIBUTING.md

parent bc81c837
No related branches found
No related tags found
No related merge requests found
...@@ -19,19 +19,18 @@ process adaptor_removal { ...@@ -19,19 +19,18 @@ process adaptor_removal {
path "*_report.txt", emit: report path "*_report.txt", emit: report
script: script:
if (reads instanceof List) { if (reads instanceof List)
""" """
cutadapt ${params.adaptor_removal} \ cutadapt ${params.adaptor_removal} \
-o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \ -o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt ${reads[0]} ${reads[1]} > ${pair_id}_report.txt
""" """
} else { else
""" """
cutadapt ${params.adaptor_removal} \ cutadapt ${params.adaptor_removal} \
-o ${file_id}_cut.fastq.gz \ -o ${file_id}_cut.fastq.gz \
${reads} > ${file_id}_report.txt ${reads} > ${file_id}_report.txt
""" """
}
} }
params.adaptor_removal_pairedend = "-a ${adapter_3_prim} -g ${adapter_5_prim} -A ${adapter_3_prim} -G ${adapter_5_prim}" params.adaptor_removal_pairedend = "-a ${adapter_3_prim} -g ${adapter_5_prim} -A ${adapter_3_prim} -G ${adapter_5_prim}"
...@@ -76,7 +75,7 @@ process adaptor_removal_singleend { ...@@ -76,7 +75,7 @@ process adaptor_removal_singleend {
""" """
} }
process trimming_pairedend { process trimming {
container = "${container_url}" container = "${container_url}"
label "big_mem_mono_cpus" label "big_mem_mono_cpus"
tag "$pair_id" tag "$pair_id"
...@@ -89,13 +88,13 @@ process trimming_pairedend { ...@@ -89,13 +88,13 @@ process trimming_pairedend {
path "*_report.txt", emit: report path "*_report.txt", emit: report
script: script:
if (reads instanceof List) if (reads instanceof List)
""" """
cutadapt -q ${trim_quality},${trim_quality} \ cutadapt -q ${trim_quality},${trim_quality} \
-o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \ -o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt ${reads[0]} ${reads[1]} > ${pair_id}_report.txt
""" """
else else
""" """
cutadapt -q ${trim_quality},${trim_quality} \ cutadapt -q ${trim_quality},${trim_quality} \
-o ${file_id}_trim.fastq.gz \ -o ${file_id}_trim.fastq.gz \
......
...@@ -44,27 +44,28 @@ process mapping_fastq { ...@@ -44,27 +44,28 @@ process mapping_fastq {
tuple val(file_id), path("*_report.txt"), emit: report tuple val(file_id), path("*_report.txt"), emit: report
script: script:
if (file_id instanceof List){ if (file_id instanceof List){
pair_id = file_id[0] pair_id = file_id[0]
} else { } else {
pair_id = file_id pair_id = file_id
} }
if (reads instanceof List) if (reads instanceof List) {
""" """
mkdir ${pair_id} mkdir ${pair_id}
kallisto quant -i ${index} -t ${task.cpus} \ kallisto quant -i ${index} -t ${task.cpus} \
${params.mapping_fastq} -o ${pair_id} \ ${params.mapping_fastq} -o ${pair_id} \
${reads[0]} ${reads[1]} &> ${pair_id}_kallisto_mapping_report.txt ${reads[0]} ${reads[1]} &> ${pair_id}_kallisto_mapping_report.txt
""" """
else } else {
""" """
mkdir ${pair_id} mkdir ${pair_id}
kallisto quant -i ${index} -t ${task.cpus} --single \ kallisto quant -i ${index} -t ${task.cpus} --single \
${params.mapping_fastq} -o ${pair_id} \ ${params.mapping_fastq} -o ${pair_id} \
-l ${params.mean} -s ${params.sd} \ -l ${params.mean} -s ${params.sd} \
${reads} &> ${reads.simpleName}_kallisto_mapping_report.txt ${reads} &> ${reads.simpleName}_kallisto_mapping_report.txt
""" """
}
} }
params.mapping_fastq_pairedend = "--bias --bootstrap-samples 100" params.mapping_fastq_pairedend = "--bias --bootstrap-samples 100"
......
...@@ -11,13 +11,15 @@ log.info "bed file : ${params.bed}" ...@@ -11,13 +11,15 @@ log.info "bed file : ${params.bed}"
Channel Channel
.fromPath( params.fasta ) .fromPath( params.fasta )
.ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" } .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" }
.map { it -> [it.simpleName, it]}
.set { fasta_files } .set { fasta_files }
Channel Channel
.fromPath( params.bed ) .fromPath( params.bed )
.ifEmpty { error "Cannot find any bed files matching: ${params.bed}" } .ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
.map { it -> [it.simpleName, it]}
.set { bed_files } .set { bed_files }
Channel Channel
.fromFilePairs( params.fastq ) .fromFilePairs( params.fastq, size: -1)
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files } .set { fastq_files }
...@@ -27,10 +29,10 @@ include { fasta_from_bed } from './nf_modules/bedtools/main' ...@@ -27,10 +29,10 @@ include { fasta_from_bed } from './nf_modules/bedtools/main'
include { index_fasta; mapping_fastq } from './nf_modules/kallisto/main' include { index_fasta; mapping_fastq } from './nf_modules/kallisto/main'
workflow { workflow {
adaptor_removal(fastq_files) adaptor_removal(fastq_files.view())
trimming(adaptor_removal.out.fastq) trimming(adaptor_removal.out.fastq.view())
fasta_from_bed(fasta_files, bed_files) fasta_from_bed(fasta_files, bed_files)
index_fasta(fasta_from_bed.out.fasta) index_fasta(fasta_from_bed.out.fasta)
mapping_fastq(index_fasta.out.index.collect(), trimming.out.fastq) mapping_fastq(index_fasta.out.index.collect(), trimming.out.fastq.view())
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment