-
Notifications
You must be signed in to change notification settings - Fork 421
/
Copy pathbuild_indices.nf
65 lines (52 loc) · 2.53 KB
/
build_indices.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
/*
================================================================================
BUILDING INDEXES
================================================================================
*/
// And then initialize channels based on params or indexes that were just built
include { BUILD_INTERVALS } from '../local/build_intervals.nf'
include { BWAMEM2_INDEX as BWAMEM2_INDEX } from '../nf-core/bwamem2_index.nf'
include { GATK_CREATE_SEQUENCE_DICTIONARY as GATK_CREATE_SEQUENCE_DICTIONARY } from '../local/gatk_dict.nf'
include {
HTSLIB_TABIX as HTSLIB_TABIX_DBSNP;
HTSLIB_TABIX as HTSLIB_TABIX_GERMLINE_RESOURCE;
HTSLIB_TABIX as HTSLIB_TABIX_KNOWN_INDELS;
HTSLIB_TABIX as HTSLIB_TABIX_PON;
} from '../nf-core/htslib_tabix'
include { SAMTOOLS_FAIDX as SAMTOOLS_FAIDX } from '../nf-core/samtools_faidx.nf'
workflow BUILD_INDICES{
take:
ch_dbsnp
ch_fasta
ch_germline_resource
ch_known_indels
ch_pon
step
main:
if (!(params.bwa) && params.fasta && 'mapping' in step)
BWAMEM2_INDEX(ch_fasta)
if (!(params.dict) && params.fasta && !('annotate' in step) && !('controlfreec' in step))
GATK_CREATE_SEQUENCE_DICTIONARY(ch_fasta)
if (!(params.fasta_fai) && params.fasta && !('annotate' in step))
SAMTOOLS_FAIDX(ch_fasta)
if (!(params.dbsnp_index) && params.dbsnp && ('mapping' in step || 'preparerecalibration' in step || 'controlfreec' in tools || 'haplotypecaller' in tools || 'mutect2' in tools || 'tnscope' in tools))
HTSLIB_TABIX_DBSNP(ch_dbsnp)
if (!(params.germline_resource_index) && params.germline_resource && 'mutect2' in tools)
HTSLIB_TABIX_GERMLINE_RESOURCE(ch_germline_resource)
if (!(params.known_indels_index) && params.known_indels && ('mapping' in step || 'preparerecalibration' in step))
HTSLIB_TABIX_KNOWN_INDELS(ch_known_indels)
if (!(params.pon_index) && params.pon && ('tnscope' in tools || 'mutect2' in tools))
HTSLIB_TABIX_PON(ch_pon)
if (!(params.intervals) && !('annotate' in step) && !('controlfreec' in step)) {
BUILD_INTERVALS(SAMTOOLS_FAIDX.out)
}
emit:
bwa_built = BWAMEM2_INDEX.out
dbsnp_tbi = HTSLIB_TABIX_DBSNP.out
dictBuilt = GATK_CREATE_SEQUENCE_DICTIONARY.out
fai_built = SAMTOOLS_FAIDX.out
germline_resource_tbi = HTSLIB_TABIX_GERMLINE_RESOURCE.out
intervalBuilt = BUILD_INTERVALS.out
known_indels_tbi = HTSLIB_TABIX_KNOWN_INDELS.out
pon_tbi = HTSLIB_TABIX_PON.out
}