-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
76 lines (65 loc) · 2.36 KB
/
Copy pathmain.nf
File metadata and controls
76 lines (65 loc) · 2.36 KB
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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// Validate mandatory parameters
def validateParams() {
def errors = []
if (!params.input) { errors << "Missing required parameter: --input" }
if (!params.outdir_base) { errors << "Missing required parameter: --outdir_base" }
if (!params.hg38_fasta) { errors << "Missing required parameter: --hg38_fasta" }
if (!params.nsg_fasta) { errors << "Missing required parameter: --nsg_fasta" }
if (errors) {
log.error "Parameter validation failed:"
errors.each { log.error " - ${it}" }
System.exit(1)
}
if (!file(params.input).exists()) {
log.error "Input samplesheet does not exist: ${params.input}"
System.exit(1)
}
if (!file(params.hg38_fasta).exists()) {
log.error "Human genome FASTA does not exist: ${params.hg38_fasta}"
System.exit(1)
}
if (!file(params.nsg_fasta).exists()) {
log.error "NSG genome FASTA does not exist: ${params.nsg_fasta}"
System.exit(1)
}
}
// Import modules
include { FASTP } from './modules/fastp.nf'
include { XENGSORT_INDEX } from './modules/xengsort_index.nf'
include { XENGSORT_CLASSIFY } from './modules/xengsort_classify.nf'
include { XENGSORT_SUMMARY } from './modules/xengsort_summary.nf'
include { MULTIQC } from './modules/multiqc.nf'
workflow {
validateParams()
ch_samplesheet = Channel
.fromPath(params.input)
.splitCsv(header:true)
.map { row ->
def meta = [ sample: row.sample ]
def reads = [ file(row.fastq1), file(row.fastq2) ]
tuple(meta, reads)
}
FASTP(ch_samplesheet)
ch_human_fa = channel.fromPath(params.hg38_fasta)
ch_nsg_fa = channel.fromPath(params.nsg_fasta)
XENGSORT_INDEX(ch_human_fa, ch_nsg_fa)
ch_xengsort_index = XENGSORT_INDEX.out.index_files.first()
XENGSORT_CLASSIFY(
FASTP.out.trimmed_reads,
ch_xengsort_index
)
XENGSORT_SUMMARY(
XENGSORT_CLASSIFY.out.classification
.map { meta, classification_file -> classification_file }
.collect()
)
// Start with minimal MultiQC - just FASTP outputs
ch_multiqc_files = Channel.empty()
ch_multiqc_files = ch_multiqc_files.mix(FASTP.out.json_report)
ch_multiqc_files = ch_multiqc_files.mix(FASTP.out.html_report)
MULTIQC(
ch_multiqc_files.collect()
)
}