mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
changed container + add cram2bam conversion
This commit is contained in:
parent
95e8afe627
commit
a21cfb666e
4 changed files with 82 additions and 24 deletions
|
@ -2,13 +2,15 @@ process DEEPTOOLS_BAMCOVERAGE {
|
|||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::deeptools=3.5.1" : null)
|
||||
conda (params.enable_conda ? "bioconda::deeptools=3.5.1 bioconda::samtools=1.15.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/deeptools:3.5.1--py_0':
|
||||
'quay.io/biocontainers/deeptools:3.5.1--py_0' }"
|
||||
'https://depot.galaxyproject.org/singularity/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:2c687053c0252667cca265c9f4118f2c205a604c-0':
|
||||
'quay.io/biocontainers/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:2c687053c0252667cca265c9f4118f2c205a604c-0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(input), path(input_index)
|
||||
path(fasta)
|
||||
path(fasta_fai)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bigWig") , emit: bigwig, optional: true
|
||||
|
@ -22,16 +24,44 @@ process DEEPTOOLS_BAMCOVERAGE {
|
|||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}.bigWig"
|
||||
|
||||
"""
|
||||
bamCoverage \\
|
||||
--bam $input \\
|
||||
$args \\
|
||||
--numberOfProcessors ${task.cpus} \\
|
||||
--outFileName ${prefix}
|
||||
// cram_input is currently not working with deeptools
|
||||
// therefore it's required to convert cram to bam first
|
||||
def is_cram = input.Extension == "cram" ? true : false
|
||||
def input_out = is_cram ? input.BaseName + ".bam" : "${input}"
|
||||
def fai_reference = fasta_fai ? "--fai-reference ${fasta_fai}" : ""
|
||||
|
||||
if (is_cram){
|
||||
"""
|
||||
samtools view -T $fasta $input $fai_reference -@ $task.cpus -o $input_out
|
||||
samtools index -b $input_out -@ $task.cpus
|
||||
|
||||
bamCoverage \\
|
||||
--bam $input_out \\
|
||||
$args \\
|
||||
--numberOfProcessors ${task.cpus} \\
|
||||
--outFileName ${prefix}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
||||
deeptools: \$(bamCoverage --version | sed -e "s/bamCoverage //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
|
||||
}
|
||||
else {
|
||||
"""
|
||||
bamCoverage \\
|
||||
--bam $input_out \\
|
||||
$args \\
|
||||
--numberOfProcessors ${task.cpus} \\
|
||||
--outFileName ${prefix}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
deeptools: \$(bamCoverage --version | sed -e "s/bamCoverage //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
deeptools: \$(bamCoverage --version | sed -e "s/bamCoverage //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@ input:
|
|||
type: file
|
||||
description: BAM/CRAM index file
|
||||
pattern: "*.{bai,crai}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: Reference file the CRAM file was created with (required with CRAM input)
|
||||
pattern: "*.{fasta,fa}"
|
||||
- fasta_fai:
|
||||
type: file
|
||||
description: Index of the reference file (optional, but recommended)
|
||||
pattern: "*.{fai}"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
|
@ -47,3 +55,4 @@ output:
|
|||
|
||||
authors:
|
||||
- "@FriederikeHanssen"
|
||||
- "@SusiJo"
|
||||
|
|
|
@ -12,7 +12,7 @@ workflow test_deeptools_bamcoverage_bam {
|
|||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
|
||||
]
|
||||
|
||||
DEEPTOOLS_BAMCOVERAGE ( input )
|
||||
DEEPTOOLS_BAMCOVERAGE ( input, [], [] )
|
||||
}
|
||||
|
||||
workflow test_deeptools_bamcoverage_cram {
|
||||
|
@ -22,6 +22,20 @@ workflow test_deeptools_bamcoverage_cram {
|
|||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true)
|
||||
]
|
||||
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
|
||||
fasta_fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
|
||||
|
||||
DEEPTOOLS_BAMCOVERAGE ( input )
|
||||
DEEPTOOLS_BAMCOVERAGE ( input, fasta, fasta_fai)
|
||||
}
|
||||
|
||||
workflow test_deeptools_bamcoverage_cram_no_fasta_fai {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true)
|
||||
]
|
||||
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
|
||||
|
||||
DEEPTOOLS_BAMCOVERAGE ( input, fasta, [])
|
||||
}
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
- name: deeptools bamcoverage test_deeptools_bamcoverage_bam
|
||||
command: nextflow run tests/modules/deeptools/bamcoverage -entry test_deeptools_bamcoverage_bam -c tests/config/nextflow.config
|
||||
command: nextflow run ./tests/modules/deeptools/bamcoverage -entry test_deeptools_bamcoverage_bam -c ./tests/config/nextflow.config -c ./tests/modules/deeptools/bamcoverage/nextflow.config
|
||||
tags:
|
||||
- deeptools
|
||||
- deeptools/bamcoverage
|
||||
- deeptools
|
||||
files:
|
||||
- path: output/deeptools/test.bigWig
|
||||
md5sum: 95fe9383a9e6c02aea6b785cf074274f
|
||||
- path: output/deeptools/versions.yml
|
||||
md5sum: 68c94e73b7a8c0935578bad61fea54c1
|
||||
|
||||
- name: deeptools bamcoverage test_deeptools_bamcoverage_cram
|
||||
command: nextflow run tests/modules/deeptools/bamcoverage -entry test_deeptools_bamcoverage_cram -c tests/config/nextflow.config
|
||||
command: nextflow run ./tests/modules/deeptools/bamcoverage -entry test_deeptools_bamcoverage_cram -c ./tests/config/nextflow.config -c ./tests/modules/deeptools/bamcoverage/nextflow.config
|
||||
tags:
|
||||
- deeptools
|
||||
- deeptools/bamcoverage
|
||||
- deeptools
|
||||
files:
|
||||
- path: output/deeptools/test.bigWig
|
||||
md5sum: 95fe9383a9e6c02aea6b785cf074274f
|
||||
|
||||
- name: deeptools bamcoverage test_deeptools_bamcoverage_cram_no_fasta_fai
|
||||
command: nextflow run ./tests/modules/deeptools/bamcoverage -entry test_deeptools_bamcoverage_cram_no_fasta_fai -c ./tests/config/nextflow.config -c ./tests/modules/deeptools/bamcoverage/nextflow.config
|
||||
tags:
|
||||
- deeptools/bamcoverage
|
||||
- deeptools
|
||||
files:
|
||||
- path: output/deeptools/test.bigWig
|
||||
md5sum: 95fe9383a9e6c02aea6b785cf074274f
|
||||
- path: output/deeptools/versions.yml
|
||||
md5sum: 665bbd2979c49bf3974a24bd44a88e94
|
||||
|
|
Loading…
Reference in a new issue