-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.nf
More file actions
78 lines (67 loc) · 3.5 KB
/
main.nf
File metadata and controls
78 lines (67 loc) · 3.5 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
77
78
include { PARSE_SAMPLESHEET } from './subworkflows/parse_samplesheet'
include { VALIDATE_PARAMETERS } from './subworkflows/parameter_validation'
include { VARIANTMEDIUM_PREPARE_INPUTS } from './workflows/variantmedium_prepare_inputs'
include { VARIANTMEDIUM_STAGE_DATA } from './workflows/variantmedium_stage_data'
include { VARIANTMEDIUM_FILTER_CANDIDATES } from './workflows/variantmedium_filter_candidates.nf'
include { VARIANTMEDIUM_CALL_VARIANTS } from './workflows/variantmedium_call_variants.nf'
workflow {
// ----------------------------------------
// Parameter validation
// ----------------------------------------
VALIDATE_PARAMETERS()
// ----------------------------------------
// Samplesheet validation
// ----------------------------------------
ch_samplesheet = channel.empty()
def samplesheetFile = file(params.samplesheet)
if( !samplesheetFile.exists() ) {
log.error "ERROR: Samplesheet filepath does not exist: ${params.samplesheet}"
} else {
ch_samplesheet = channel.fromPath("${params.samplesheet}")
}
log.info "[INFO] Samplesheet -> [${samplesheetFile}]"
PARSE_SAMPLESHEET(ch_samplesheet)
// ----------------------------------------
// Variantmedium prepare input tsv files (step - 1)
// ----------------------------------------
if (params.execution_step == "generate_tsv_files") {
VARIANTMEDIUM_PREPARE_INPUTS(
ch_samplesheet,
"${params.outdir}"
)
}
// ----------------------------------------
// Variantmedium stage ref data & models (step - 2)
// ----------------------------------------
if (params.execution_step == "data_staging") {
VARIANTMEDIUM_STAGE_DATA()
}
// ----------------------------------------
// Run variantmedium candidate filtering (step - 5)
// ----------------------------------------
if (params.execution_step == "candidate_filtering") {
ch_tsv_input = channel.fromPath("${params.outdir}/${params.prepare_tsv_outs}/samples_w_cands.tsv", checkIfExists: true)
ch_outdir = channel.fromPath("${params.outdir}/${params.candidate_filtering_outs}/{}/{}_{}.tsv")
ch_model_extra_trees_snv = channel.fromPath("${params.outdir}/${params.data_staging_outs}/${params.models_dir}/extra_trees.snv.joblib", checkIfExists: true)
ch_model_extra_trees_indel = channel.fromPath("${params.outdir}/${params.data_staging_outs}/${params.models_dir}/extra_trees.indel.joblib", checkIfExists: true)
VARIANTMEDIUM_FILTER_CANDIDATES (
ch_tsv_input,
ch_outdir,
ch_model_extra_trees_snv,
ch_model_extra_trees_indel
)
}
// ----------------------------------------
// Run variantmedium variant calling (step - 8)
// ----------------------------------------
if (params.execution_step == "variant_calling") {
ch_home_folder = channel.fromPath("${params.outdir}/${params.bam2tensor_outs}", checkIfExists: true)
ch_pretrained_model_snv = channel.fromPath("${params.outdir}/${params.data_staging_outs}/${params.models_dir}/3ddensenet_snv.pt", checkIfExists: true)
ch_pretrained_model_indel = channel.fromPath("${params.outdir}/${params.data_staging_outs}/${params.models_dir}/3ddensenet_indel.pt", checkIfExists: true)
VARIANTMEDIUM_CALL_VARIANTS (
ch_home_folder,
ch_pretrained_model_snv,
ch_pretrained_model_indel
)
}
}