forked from IARCbioinfo/gama_annot-nf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmutspec_annot.nf
101 lines (76 loc) · 3.16 KB
/
mutspec_annot.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
94
95
params.help = null
params.input = null
params.extension = "vcf"
params.annovarDBlist = null
params.annovarDBpath = "/data/databases/annovar/hg38db/"
params.annovarBinPath = "/data/mca/mca_share/work/annovar/"
params.output = "mutspec_annotation"
params.thread = 1
params.VAF = true
params.caller = "strelka2"
params.pass = "'PASS,clustered_events,clustered_events;homologous_mapping_event,tiers1,tiers2,tiers3'"
if (params.help) {
log.info ''
log.info '--------------------------------------------------'
log.info ' TABLE ANNOVAR '
log.info '--------------------------------------------------'
log.info ''
log.info 'Usage: '
log.info 'nextflow run mutspec_annot.nf --input vcfFolder/ --annovarDBpath /data/annovar/mm10db/'
log.info ''
log.info 'Mandatory arguments:'
log.info ''
log.info ' --input FOLDER Folder containing vcf to process.'
log.info ' --annovarDBlist FILE File with two columns : protocols and operations.'
log.info ''
log.info 'Optional arguments:'
log.info ''
log.info ' --extention STRING input files extension'
log.info ' --annovarDBpath PATH Path to annovarDB.'
log.info ' --annovarBinPath PATH Path to table_annovar.pl.'
log.info ' --output FOLDER Output Folder name.'
log.info ' --thread INTEGER Number of thread for table_annovar.pl.'
log.info ' --caller PATH Software used for calling (strelka2, mutect2 or haplotypecaller)'
log.info ' --pass STRING filter tags, comma separated list'
log.info ''
log.info 'Flags'
log.info ''
log.info ' --vaf Add columns with VAF and coverage.'
log.info ' --help Display this message.'
exit 1
}
//vcf=Channel.fromFilePairs( params.input + '*{snvs,indels}*' + params.extension )
//System.exit(0)
tsize=2
Channel.fromPath( params.input + '*indels*' + params.extension ).ifEmpty { tsize=1 }
allvcf = Channel.fromPath( params.input + '*' + params.extension ).ifEmpty { error "empty table folder, please verify your input." }
process mutspec_annot {
publishDir params.output, mode: 'copy'
cpus params.thread
tag { sample_tag }
input:
file vcf from allvcf
output:
set val(sample_tag), file("*tab") into annotated
shell:
sample_tag = vcf.baseName.replaceFirst(/(snvs|indels).*/,"")
'''
echo !{tsize}
echo !{sample_tag}
echo mutspec_annot.r -i !{vcf} -l !{params.annovarDBlist} -a !{params.annovarDBpath} -b !{params.annovarBinPath} -t !{params.thread} -p "!{params.pass}"
mutspec_annot.r -i !{vcf} -l !{params.annovarDBlist} -a !{params.annovarDBpath} -b !{params.annovarBinPath} -t !{params.thread} -p "!{params.pass}"
'''
}
if (params.VAF){
process mutspec_VAF {
publishDir params.output, mode: 'move'
input:
set val(sample_tag), file(tab) from annotated.groupTuple(size: tsize )
output:
file "*tab" into table
shell:
'''
getAllelicFraction.r -c !{params.caller}
'''
}
}