-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
81 lines (65 loc) · 1.71 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
nextflow.enable.dsl = 2
process combineFasta {
publishDir "${params.outdir}/combined_sequences", mode: "${params.publish_dir_mode}"
input:
path sequences
output:
path "combined_sequences.fa"
"""
cat $sequences > combined_sequences.fa
sed -i.bak '/^\$/d' combined_sequences.fa
"""
}
process alignSequences {
publishDir "${params.outdir}/aligned_sequences", mode: "${params.publish_dir_mode}"
input:
path combined_sequences
output:
path "aligned_sequences.fa"
"""
mafft --thread ${params.threads} --auto --reorder $combined_sequences > aligned_sequences.fa
"""
}
process callVariants {
publishDir "${params.outdir}/variants", mode: "${params.publish_dir_mode}"
input:
path aligned_sequences
output:
path "variants.vcf.gz"
"""
snp-sites $aligned_sequences -v -o variants.vcf
bgzip -c variants.vcf > variants.vcf.gz
tabix -p vcf variants.vcf.gz
"""
}
process createGraph {
publishDir "${params.outdir}/graph", mode: "${params.publish_dir_mode}"
input:
path aligned_sequences
path variants
output:
path "graph.vg"
"""
vg construct --msa $aligned_sequences -v $variants > graph.vg
"""
}
process visualizeGraph {
publishDir "${params.outdir}/visualization", mode: "${params.publish_dir_mode}"
input:
path graph
output:
path "graph.gfa"
path "graph.dot"
"""
vg view $graph > graph.gfa
vg view -d $graph > graph.dot
"""
}
workflow {
Channel.fromPath(params.input).collect()
| combineFasta
| alignSequences
| callVariants
createGraph(alignSequences.out, callVariants.out)
| visualizeGraph
}