-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlandscape.nf
100 lines (72 loc) · 1.54 KB
/
landscape.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
96
97
98
99
100
#!/usr/bin/env nextflow
/*
*params.input = "data/sequences.fasta"
*params.db = "ref/MN908947.3.coronavirus.Wuhan-1.fasta"
*params.out = "results/"
*params.kmer = 20
*/
/* INPUT PARAMETERS
*
*/
db = file(params.db)
input_file = file(params.input)
/* JELLYFISH PARAMETERS
*
*/
params.s = "DEF"
hash_value = params.s
params.t = "DEF"
threads_value = params.t
/* PLOTTIN SCRIPT
*
*/
path_r = params.pipeline
plotR = "${path_r}/bin/plot_landscape.R"
fasta_datasets = Channel.fromPath(input_file)
/*
* Run jellyfish
*/
process countKmers {
input:
file fasta_file from fasta_datasets
val hash from hash_value
val threads from threads_value
output:
file 'count_file' into counts
script:
def s = hash != "DEF" ? "-s $hash" : '-s 100M'
def t = hash != "DEF" ? "-t $threads" : ''
"""
jellyfish count --mer ${params.kmer} $s $t --canonical -o db $fasta_file
jellyfish dump db > count_file
"""
}
/*
* Run kmer_cov_plot
*/
process cov_plot{
publishDir params.out, overwrite:true, mode:'copy'
input:
file count_file from counts
output:
file "kmer_frequency.txt" into cov
script:
"""
kmer-cov-plot $count_file < $db > kmer_frequency.txt
"""
}
/*
* Plot landscape
*/
process plot{
publishDir params.out, overwrite:true, mode:'move'
input:
file cov_file from cov
output:
file "conservationLandscape.pdf" into output
script:
"""
Rscript $plotR $cov_file "conservationLandscape.pdf"
"""
}
output.subscribe { println it }