forked from porchard/2020-sn-muscle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fimo.nf
62 lines (42 loc) · 1.34 KB
/
fimo.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
#!/usr/bin/env nextflow
explain_channel = Channel.fromPath(params.snp_file)
FIMO_BACKGROUND = params.fimo_background
MEME_GLOB = params.meme_glob
process make_fastas {
container "${params.containers.mkfasta}"
input:
file(snps) from explain_channel
output:
set file("ref.fa"), file("alt.fa") into fastas
file("*.fa") into fastas_for_fimo
"""
make_ref_alt_flanking_fastas.py $snps ${params.fasta['hg19']} --flank_size 50
"""
}
process fimo_scan {
publishDir "${params.results}/fimo/scan"
maxForks 50
input:
file(bg) from Channel.fromPath(FIMO_BACKGROUND)
each file(fasta) from fastas_for_fimo.flatten()
each file(motif) from Channel.fromPath(MEME_GLOB)
output:
set val("${ref_or_alt}"), file("${ref_or_alt}.${motif_name}.fimo.txt") into concat_in
script:
ref_or_alt = fasta.getName().replaceAll('.fa', '')
motif_name = motif.getName().replaceAll('.meme', '').replaceAll('::', '_')
"""
fimo --text --bgfile $bg $motif $fasta > ${ref_or_alt}.${motif_name}.fimo.txt
"""
}
process fimo_concat {
publishDir "${params.results}/concat"
executor 'local'
input:
set val(ref_or_alt), file(fimo) from concat_in.groupTuple()
output:
file("${ref_or_alt}.fimo.txt") into fimo_out
"""
cat ${fimo.join(' ')} > ${ref_or_alt}.fimo.txt
"""
}