-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
79 lines (54 loc) · 1.63 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
process get_images {
stageInMode 'symlink'
stageOutMode 'move'
script:
"""
if [[ "${params.containers}" == "singularity" ]] ;
then
cd ${params.image_folder}
if [[ ! -f drugz-eb15d34.sif ]] ;
then
singularity pull drugz-eb15d34.sif docker://index.docker.io/mpgagebioinformatics/drugz:eb15d34
fi
fi
if [[ "${params.containers}" == "docker" ]] ;
then
docker pull mpgagebioinformatics/drugz:eb15d34
fi
"""
}
process prodrugz {
stageInMode 'symlink'
stageOutMode 'move'
input:
val label
val paired
val control
val treatment
val paired
script:
"""
if [[ "${paired}" == "paired" ]] ; then paired="" ; else paired="-unpaired" ; fi
python3 /drugz/drugz.py -i ${params.output_mageck_count}/counts.count.txt -o ${params.output_drugz}/${label}.txt -c ${control} -x ${treatment} \${paired}
"""
}
workflow images {
main:
get_images()
}
workflow {
if ( ! file("${params.output_drugz}").isDirectory() ) {
file("${params.output_drugz}").mkdirs()
}
rows=Channel.fromPath("${params.samples_tsv}", checkIfExists:true).splitCsv(sep:';')
rows=rows.filter{ ! file( "${params.output_drugz}/${it[0]}.txt" ).exists() }
label=rows.flatMap { n -> n[0] }
paired=rows.flatMap { n -> n[1] }
control=rows.flatMap { n -> n[2] }
control=control.map{ "$it".replace(".fastq.gz","") }
treatment=rows.flatMap { n -> n[3] }
treatment=treatment.map{ "$it".replace(".fastq.gz","") }
prodrugz( label, paired, control, treatment, paired)
}