forked from nf-core/chipseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
61 lines (56 loc) · 2.1 KB
/
main.nf
File metadata and controls
61 lines (56 loc) · 2.1 KB
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
process STAR_GENOMEGENERATE {
tag "$fasta"
label 'process_high'
// Note: 2.7X indices incompatible with AWS iGenomes.
conda "bioconda::star=2.6.1d bioconda::samtools=1.10 conda-forge::gawk=5.1.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-1fa26d1ce03c295fe2fdcf85831a92fbcbd7e8c2:59cdd445419f14abac76b31dd0d71217994cbcc9-0' :
'biocontainers/mulled-v2-1fa26d1ce03c295fe2fdcf85831a92fbcbd7e8c2:59cdd445419f14abac76b31dd0d71217994cbcc9-0' }"
input:
path fasta
path gtf
output:
path "star" , emit: index
path "versions.yml", emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = (task.ext.args ?: '').tokenize()
def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : ''
if (args.contains('--genomeSAindexNbases')) {
"""
mkdir star
STAR \\
--runMode genomeGenerate \\
--genomeDir star/ \\
--genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\
--runThreadN $task.cpus \\
$memory \\
${args.join(' ')}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
star: \$(STAR --version | sed -e "s/STAR_//g")
END_VERSIONS
"""
} else {
"""
samtools faidx $fasta
NUM_BASES=`gawk '{sum = sum + \$2}END{if ((log(sum)/log(2))/2 - 1 > 14) {printf "%.0f", 14} else {printf "%.0f", (log(sum)/log(2))/2 - 1}}' ${fasta}.fai`
mkdir star
STAR \\
--runMode genomeGenerate \\
--genomeDir star/ \\
--genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\
--runThreadN $task.cpus \\
--genomeSAindexNbases \$NUM_BASES \\
$memory \\
${args.join(' ')}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
star: \$(STAR --version | sed -e "s/STAR_//g")
END_VERSIONS
"""
}
}