new module gatk4/collectreadcounts (#1998)

* added the module

* updated test.yml

* Update modules/gatk4/collectreadcounts/main.nf

Co-authored-by: FriederikeHanssen <Friederike.hanssen@qbic.uni-tuebingen.de>

* small fix

* tests update

* linting

* tests update (again)

Co-authored-by: FriederikeHanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
This commit is contained in:
nvnieuwk 2022-09-05 10:49:13 +02:00 committed by GitHub
parent 57b43ed3de
commit 09acfad211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 225 additions and 0 deletions

View file

@ -0,0 +1,53 @@
process GATK4_COLLECTREADCOUNTS {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0':
'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }"
input:
tuple val(meta), path(input), path(input_index), path(intervals)
path(fasta)
path(fai)
path(dict)
output:
tuple val(meta), path("*.hdf5"), optional: true, emit: hdf5
tuple val(meta), path("*.tsv") , optional: true, emit: tsv
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def reference = fasta ? "--reference $fasta" : ""
def extension = args.contains("--format HDF5") ? "hdf5" :
args.contains("--format TSV") ? "tsv" :
"hdf5"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK COLLECTREADCOUNTS] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk --java-options "-Xmx${avail_mem}g" CollectReadCounts \\
--input $input \\
--intervals $intervals \\
--output ${prefix}.$extension \\
$reference \\
--tmp-dir . \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,72 @@
name: "gatk4_collectreadcounts"
description: Collects read counts at specified intervals. The count for each interval is calculated by counting the number of read starts that lie in the interval.
keywords:
- bam
- cram
- CollectReadCounts
- gatk
- gatk4
tools:
- gatk4:
description:
Genome Analysis Toolkit (GATK4). Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools
with a primary focus on variant discovery and genotyping. Its powerful processing engine
and high-performance computing features make it capable of taking on projects of any size.
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/articles/360037593911-CombineGVCFs
tool_dev_url: https://github.com/broadinstitute/gatk
doi: 10.1158/1538-7445.AM2017-3590
licence: ["Apache-2.0"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- bai:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}"
- intervals:
type: file
description: A file containing the specified intervals
pattern: "*.{bed,intervals}"
- fasta:
type: file
description: Optional - Reference FASTA
pattern: "*.{fasta,fa}"
- fai:
type: file
description: Optional - Index of the reference FASTA file
pattern: "*.fai"
- dict:
type: file
description: Optional - Sequence dictionary of the reference FASTA file
pattern: "*.dict"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- hdf5:
type: file
description: The read counts in hdf5 format
pattern: "*.hdf5"
- tsv:
type: file
description: The read counts in TSV format
pattern: "*.tsv"
authors:
- "@nvnieuwk"

View file

@ -843,6 +843,10 @@ gatk4/cnnscorevariants:
- modules/gatk4/cnnscorevariants/**
- tests/modules/gatk4/cnnscorevariants/**
gatk4/collectreadcounts:
- modules/gatk4/collectreadcounts/**
- tests/modules/gatk4/collectreadcounts/**
gatk4/combinegvcfs:
- modules/gatk4/combinegvcfs/**
- tests/modules/gatk4/combinegvcfs/**

View file

@ -0,0 +1,54 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { GATK4_COLLECTREADCOUNTS } from '../../../../modules/gatk4/collectreadcounts/main.nf'
workflow test_gatk4_collectreadcounts_hdf5 {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true),
]
fasta = []
fai = []
dict = []
GATK4_COLLECTREADCOUNTS ( input, fasta, fai, dict )
}
workflow test_gatk4_collectreadcounts_tsv {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true),
]
fasta = []
fai = []
dict = []
GATK4_COLLECTREADCOUNTS ( input, fasta, fai, dict )
}
workflow test_gatk4_collectreadcounts_cram {
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),
file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true),
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
dict = file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)
GATK4_COLLECTREADCOUNTS ( input, fasta, fai, dict )
}

View file

@ -0,0 +1,17 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: 'test_gatk4_collectreadcounts_hdf5:GATK4_COLLECTREADCOUNTS'{
ext.args = "--interval-merging-rule OVERLAPPING_ONLY"
}
withName: 'test_gatk4_collectreadcounts_tsv:GATK4_COLLECTREADCOUNTS' {
ext.args = "--format TSV --interval-merging-rule OVERLAPPING_ONLY"
}
withName: 'test_gatk4_collectreadcounts_cram:GATK4_COLLECTREADCOUNTS' {
ext.args = "--format TSV --interval-merging-rule OVERLAPPING_ONLY"
}
}

View file

@ -0,0 +1,25 @@
- name: gatk4 collectreadcounts test_gatk4_collectreadcounts_hdf5
command: nextflow run ./tests/modules/gatk4/collectreadcounts -entry test_gatk4_collectreadcounts_hdf5 -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectreadcounts/nextflow.config
tags:
- gatk4/collectreadcounts
- gatk4
files:
- path: output/gatk4/test.hdf5
- name: gatk4 collectreadcounts test_gatk4_collectreadcounts_tsv
command: nextflow run ./tests/modules/gatk4/collectreadcounts -entry test_gatk4_collectreadcounts_tsv -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectreadcounts/nextflow.config
tags:
- gatk4/collectreadcounts
- gatk4
files:
- path: output/gatk4/test.tsv
md5sum: 8e45a6164916c303387f39f02ce45841
- name: gatk4 collectreadcounts test_gatk4_collectreadcounts_cram
command: nextflow run ./tests/modules/gatk4/collectreadcounts -entry test_gatk4_collectreadcounts_cram -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectreadcounts/nextflow.config
tags:
- gatk4/collectreadcounts
- gatk4
files:
- path: output/gatk4/test.tsv
md5sum: d9a32039b7a84f5bb74e8382e5427670