-
Notifications
You must be signed in to change notification settings - Fork 1
/
compare.nf
77 lines (54 loc) · 1.7 KB
/
compare.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
#! /usr/bin/env nextflow
/*
nextflow run compare.nf -profile docker (use all default parameters)
nextflow run compare.nf -profile docker \
--ref /data/test_suite/reference/ref.fa \
--refindex /data/test_suite/reference/ref.fa.fai \
--refvcf /data/test_suite/truth_set.vcf \
--input /data/test_suite/vcfs/all/ \
--pattern *.vcf
*/
params.ref = "tests/ref/NC_000962_3.fasta"
ref = file(params.ref)
params.refindex = "tests/ref/NC_000962_3.fasta.fai"
refindex = file(params.refindex)
params.refvcf = "tests/ref/snps.vcf"
refvcf = file(params.refvcf)
params.input = "tests/input/"
params.pattern = "*.vcf"
params.output = "tests/output"
vcf_path = params.input + params.pattern
if (params.pattern.endsWith(".gz")){
gzip_files_channel = Channel.fromPath(vcf_path)
process unzip_vcf {
tag {gzip_file.getBaseName()}
input:
file gzip_file from gzip_files_channel
output:
file("${gzip_file.getBaseName()}.vcf") into vcf_files_channel
"""
gunzip -c ${gzip_file} > ${gzip_file.getBaseName()}.vcf
"""
}
}
if (params.pattern.endsWith(".vcf")){
vcf_files_channel = Channel.fromPath(vcf_path)
}
process process_vcf {
echo true
scratch true
label "happy"
//errorStrategy 'ignore'
publishDir "${params.output}/${vcf_file.getBaseName()}/", mode: "copy"
tag {vcf_file.getBaseName()}
input:
file ref
file refvcf
file refindex
file vcf_file from vcf_files_channel
output:
set val("${vcf_file.getBaseName()}"), file("${vcf_file.getBaseName()}.*")
"""
/opt/hap.py/bin/hap.py --preprocess-truth --engine=vcfeval -r ${ref} ${refvcf} ${vcf_file} -o ${vcf_file.getBaseName()}
"""
}