-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.nf
93 lines (70 loc) · 2.86 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
include {
mixcr_analyze; mixcr_qc;
data_filtering; dataset_overview; correlations; overlap;
diversity; kmers; network; ddbb; report
} from './processes.nf'
log.info """\
RNASeq - TCR Pipeline
===================================
Project parameters:
- Project Name : ${params.project_name}
- Sample List : ${params.readsfile}
- Specie : ${params.specie}
- Selected TCR chain : ${params.chain}
- Output Directory : ${params.outdir}
"""
workflow {
// Input validation
def valid_species = ['HomoSapiens','MusMusculus']
is_valid_specie = params.specie in valid_species
if (!is_valid_specie) {
log.error "`params.specie` must be one of ${valid_species}"
exit 1, "`params.specie` must be one of ${valid_species}"
}
Channel.fromPath("${params.readsfile}")
.ifEmpty { exit 1, "File not foud: ${params.readsfile}" }
.set { sampleInfoChannel }
Channel.fromPath("${params.mcpas}")
.ifEmpty { exit 1, "File not foud: ${params.mcpas}" }
.set { mcpasChannel }
Channel.fromPath("${params.vdjdb}")
.ifEmpty { exit 1, "File not foud: ${params.vdjdb}" }
.set { vdjdbChannel }
/*
* Create a channel that emits tuples containing three elements:
* the SampleID, the first read-pair file and the second read-pair file
*/
samples_channel = sampleInfoChannel
.splitCsv(header:true)
.map { row -> tuple (row.SampleID,
file(row.R1.trim()),
file(row.R2.trim()))}
/*
* Workflow functions
*/
mixcr_analyze(samples_channel)
mixcr_qc(mixcr_analyze.out.full_report_chunks.collect(), sampleInfoChannel)
data_filtering(mixcr_analyze.out.all_clonotypes.collect(), sampleInfoChannel)
dataset_overview(mixcr_qc.out.qc_bookdown.collect(), data_filtering.out.filt_bookdown.collect(), sampleInfoChannel)
correlations(dataset_overview.out.overview_bookdown.collect(), sampleInfoChannel)
overlap(data_filtering.out.filt_clones.collect(), sampleInfoChannel)
diversity(data_filtering.out.filt_clones.collect(), sampleInfoChannel)
kmers(data_filtering.out.filt_clones.collect(), sampleInfoChannel)
network(data_filtering.out.filt_clones.collect(), sampleInfoChannel)
ddbb(data_filtering.out.filt_clones.collect(), sampleInfoChannel, mcpasChannel, vdjdbChannel)
report(
mixcr_qc.out.qc_bookdown
.mix(data_filtering.out.filt_bookdown)
.mix(dataset_overview.out.overview_bookdown)
.mix(correlations.out.corr_bookdown)
.mix(overlap.out.overlap_bookdown)
.mix(diversity.out.diversity_bookdown)
.mix(kmers.out.kmers_bookdown)
.mix(network.out.network_bookdown)
.mix(ddbb.out.ddbb_bookdown)
.collect(),
file('scripts/10_report.Rmd')
)
}