forked from wtsi-hgi/nf_deepvariant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
59 lines (51 loc) · 2.36 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
nextflow.enable.dsl=2
include { sort_cram } from './nf_deepvariant/modules/sort_cram.nf'
include { remap_cram } from './nf_deepvariant/modules/remap_cram.nf'
include { markDuplicates } from './nf_deepvariant/modules/markDuplicates.nf'
include { coord_sort_cram } from './nf_deepvariant/modules/coord_sort_cram.nf'
include { bam_to_cram } from './nf_deepvariant/modules/bam_to_cram.nf'
include { deepvariant } from './nf_deepvariant/modules/deepvariant.nf'
include { gatk_haplotypecaller } from './nf_deepvariant/modules/gatk_haplotypecaller.nf'
workflow {
main:
log.info "params: ${params}"
log.info "params.tsv_file: $params.tsv_file"
channel_inputs_bams = Channel
.fromPath(params.tsv_file)
.splitCsv(header: true, sep: '\t')
.map{row->tuple(row.sample, row.object, row.object_index)}
.take(params.samples_to_process)
// channel_inputs_bams.view()
if (params.run_mode == "remap_inputs") {
remap_cram(channel_inputs_bams)
markDuplicates(remap_cram.out.remapped_sample_bam)
coord_sort_cram(markDuplicates.out.markdup_sample_cram)
bam_to_cram(coord_sort_cram.out.markdup_sample_cram_crai)
deepvariant(coord_sort_cram.out.markdup_sample_cram_crai)
gatk_haplotypecaller(coord_sort_cram.out.markdup_sample_cram_crai)
}
else if (params.run_mode == "sort_inputs") {
sort_cram(channel_inputs_bams)
markDuplicates(sort_cram.out.sorted_sample_cram)
coord_sort_cram(markDuplicates.out.markdup_sample_cram)
bam_to_cram(coord_sort_cram.out.markdup_sample_cram_crai)
deepvariant(coord_sort_cram.out.markdup_sample_cram_crai)
gatk_haplotypecaller(coord_sort_cram.out.markdup_sample_cram_crai)
}
else if (params.run_mode == "no_remap_no_sort") {
deepvariant(channel_inputs_bams)
gatk_haplotypecaller(channel_inputs_bams)
}
else {
log.info "params.run_mode must be either \"remap_inputs\" \"sort_inputs\" or \"no_remap_no_sort\""
}
emit:
deepvariant_out = deepvariant.out
}
workflow.onError {
log.info "Pipeline execution stopped with the following message: ${workflow.errorMessage}" }
workflow.onComplete {
log.info "Pipeline completed at: $workflow.complete"
log.info "Command line: $workflow.commandLine"
log.info "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
}