-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.nf
75 lines (66 loc) · 2.27 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
process MAPSPLICE_ALIGN {
tag "$meta.id"
label 'process_high'
conda "bioconda::mapsplice=2.2.1"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mapsplice:2.2.1--py27h07887db_0':
'quay.io/biocontainers/mapsplice:2.2.1--py27h07887db_0' }"
input:
tuple val(meta), path(reads)
path bowtie_index
path chromosomes
path gtf
output:
tuple val(meta), path("${prefix}/fusions_raw.txt"), emit: raw_fusions
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = 'v2.2.1'
def gtf_prefix = gtf.toString() - ~/.gtf/
if(meta.single_end){
def handleGzip_R1 = reads[0].getExtension() == 'gz' ? "gzip -d -f ${reads[0]}" : ''
def read1 = reads[0].getExtension() == 'gz' ? reads[0].toString() - ~/.gz/ : reads[0]
"""
$handleGzip_R1
mapsplice.py \\
-c $chromosomes \\
-x $gtf_prefix \\
-1 ${read1} \\
-p ${task.cpus} \\
--bam \\
--gene-gtf $gtf \\
-o $prefix \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mapsplice: $VERSION
END_VERSIONS
"""
}else{
def handleGzip_R1 = reads[0].getExtension() == 'gz' ? "gzip -d -f ${reads[0]}" : ''
def handleGzip_R2 = reads[1].getExtension() == 'gz' ? "gzip -d -f ${reads[1]}" : ''
def read1 = reads[0].getExtension() == 'gz' ? reads[0].toString() - ~/.gz/ : reads[0]
def read2 = reads[1].getExtension() == 'gz' ? reads[1].toString() - ~/.gz/ : reads[1]
"""
$handleGzip_R1
$handleGzip_R2
mapsplice.py \\
-c $chromosomes \\
-x $gtf_prefix \\
-1 ${read1} \\
-2 ${read2} \\
-p ${task.cpus} \\
--bam \\
--gene-gtf $gtf \\
-o $prefix \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mapsplice: $VERSION
END_VERSIONS
"""
}
}