-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
96 lines (78 loc) · 1.99 KB
/
main.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* pipeline input parameters
*/
params.reads = "$projectDir/gut_{1,2}.fq"
params.transcriptome_file = "$projectDir/transcriptome.fa"
params.multiqc = "$projectDir/multiqc"
params.outdir = "results"
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome_file}
reads : ${params.reads}
outdir : ${params.outdir}
"""
.stripIndent()
/*
* define the `index` process that creates a binary index
* given the transcriptome file
*/
process INDEX {
input:
path transcriptome
output:
path 'salmon_index'
script:
"""
salmon index --threads $task.cpus -t $transcriptome -i salmon_index
"""
}
process QUANTIFICATION {
tag "Salmon on $sample_id"
publishDir params.outdir, mode:'copy'
input:
path salmon_index
tuple val(sample_id), path(reads)
output:
path "$sample_id"
script:
"""
salmon quant --threads $task.cpus --libType=U -i $salmon_index -1 ${reads[0]} -2 ${reads[1]} -o $sample_id
"""
}
process FASTQC {
tag "FASTQC on $sample_id"
input:
tuple val(sample_id), path(reads)
output:
path "fastqc_${sample_id}_logs"
script:
"""
mkdir fastqc_${sample_id}_logs
fastqc -o fastqc_${sample_id}_logs -f fastq -q ${reads}
"""
}
process MULTIQC {
errorStrategy 'retry' maxRetries 5
publishDir params.outdir, mode:'copy'
input:
path '*'
output:
path 'multiqc_report.html'
script:
"""
multiqc .
"""
}
workflow {
Channel
.fromFilePairs(params.reads, checkIfExists: true)
.set { read_pairs_ch }
index_ch = INDEX(params.transcriptome_file)
quant_ch = QUANTIFICATION(index_ch, read_pairs_ch)
fastqc_ch = FASTQC(read_pairs_ch)
MULTIQC(quant_ch.mix(fastqc_ch).collect())
}
workflow.onComplete {
log.info ( workflow.success ? "Abra o seu report no navegador --> $params.outdir/multiqc_report.html\n" : "Oops .. something went wrong" )
}