2020-09-10 15:45:11 +00:00
|
|
|
process STAR_GENOMEGENERATE {
|
|
|
|
tag "$fasta"
|
|
|
|
label 'process_high'
|
|
|
|
|
2022-05-27 10:35:04 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::star=2.7.10a bioconda::samtools=1.15.1 conda-forge::gawk=5.1.0" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-05-27 10:35:04 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/mulled-v2-1fa26d1ce03c295fe2fdcf85831a92fbcbd7e8c2:afaaa4c6f5b308b4b6aa2dd8e99e1466b2a6b0cd-0' :
|
|
|
|
'quay.io/biocontainers/mulled-v2-1fa26d1ce03c295fe2fdcf85831a92fbcbd7e8c2:afaaa4c6f5b308b4b6aa2dd8e99e1466b2a6b0cd-0' }"
|
2020-09-10 15:45:11 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
path fasta
|
|
|
|
path gtf
|
|
|
|
|
|
|
|
output:
|
2022-05-27 10:35:04 +00:00
|
|
|
path "star" , emit: index
|
|
|
|
path "versions.yml", emit: versions
|
2020-09-10 15:45:11 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2020-09-10 15:45:11 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
|
|
|
def args_list = args.tokenize()
|
2022-05-27 10:35:04 +00:00
|
|
|
def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : ''
|
2021-11-26 07:58:40 +00:00
|
|
|
if (args_list.contains('--genomeSAindexNbases')) {
|
2021-04-16 07:56:47 +00:00
|
|
|
"""
|
|
|
|
mkdir star
|
|
|
|
STAR \\
|
|
|
|
--runMode genomeGenerate \\
|
|
|
|
--genomeDir star/ \\
|
|
|
|
--genomeFastaFiles $fasta \\
|
|
|
|
--sjdbGTFfile $gtf \\
|
|
|
|
--runThreadN $task.cpus \\
|
|
|
|
$memory \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args
|
2021-04-16 07:56:47 +00:00
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
star: \$(STAR --version | sed -e "s/STAR_//g")
|
2021-09-28 13:37:47 +00:00
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-04-16 07:56:47 +00:00
|
|
|
"""
|
|
|
|
} 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 \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args
|
2021-04-16 07:56:47 +00:00
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
star: \$(STAR --version | sed -e "s/STAR_//g")
|
2021-09-28 13:37:47 +00:00
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-04-16 07:56:47 +00:00
|
|
|
"""
|
|
|
|
}
|
2022-08-09 07:42:19 +00:00
|
|
|
|
|
|
|
stub:
|
|
|
|
"""
|
|
|
|
mkdir star
|
|
|
|
touch star/Genome
|
|
|
|
touch star/Log.out
|
|
|
|
touch star/SA
|
|
|
|
touch star/SAindex
|
|
|
|
touch star/chrLength.txt
|
|
|
|
touch star/chrName.txt
|
|
|
|
touch star/chrNameLength.txt
|
|
|
|
touch star/chrStart.txt
|
|
|
|
touch star/exonGeTrInfo.tab
|
|
|
|
touch star/exonInfo.tab
|
|
|
|
touch star/geneInfo.tab
|
|
|
|
touch star/genomeParameters.txt
|
|
|
|
touch star/sjdbInfo.txt
|
|
|
|
touch star/sjdbList.fromGTF.out.tab
|
|
|
|
touch star/sjdbList.out.tab
|
|
|
|
touch star/transcriptInfo.tab
|
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
star: \$(STAR --version | sed -e "s/STAR_//g")
|
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
2020-09-10 15:45:11 +00:00
|
|
|
}
|