diff --git a/modules/gatk4/collectsvevidence/main.nf b/modules/gatk4/collectsvevidence/main.nf new file mode 100644 index 00000000..5aac95a6 --- /dev/null +++ b/modules/gatk4/collectsvevidence/main.nf @@ -0,0 +1,56 @@ +process GATK4_COLLECTSVEVIDENCE { + tag "$meta.id" + label 'process_low' + + 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(allele_count_vcf), path(allele_count_vcf_tbi) + path fasta + path fasta_fai + path dict + + output: + tuple val(meta), path("*.sr.txt.gz") , emit: split_read_evidence + tuple val(meta), path("*.sr.txt.gz.tbi"), emit: split_read_evidence_index + tuple val(meta), path("*.pe.txt.gz") , emit: paired_end_evidence + tuple val(meta), path("*.pe.txt.gz.tbi"), emit: paired_end_evidence_index + tuple val(meta), path("*.ld.txt.gz") , emit: allele_counts, optional:true + tuple val(meta), path("*.ld.txt.gz.tbi"), emit: allele_counts_index, optional:true + 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 allele_vcf = allele_count_vcf ? "--allele-count-file ${prefix}.ld.txt.gz --allele-count-vcf ${allele_count_vcf}" : "" + def reference = fasta ? "--reference ${fasta}" : "" + + def avail_mem = 3 + if (!task.memory) { + log.info '[GATK COLLECTSVEVIDENCE] 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" CollectSVEvidence \\ + ${args} \\ + --input ${input} \\ + --sr-file ${prefix}.sr.txt.gz \\ + --pe-file ${prefix}.pe.txt.gz \\ + ${allele_vcf} \\ + ${reference} \\ + --tmp-dir . \\ + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') + END_VERSIONS + """ +} diff --git a/modules/gatk4/collectsvevidence/meta.yml b/modules/gatk4/collectsvevidence/meta.yml new file mode 100644 index 00000000..9d8588cc --- /dev/null +++ b/modules/gatk4/collectsvevidence/meta.yml @@ -0,0 +1,88 @@ +name: "gatk4_collectsvevidence" +description: Gathers paired-end and split read evidence files for use in the GATK-SV pipeline. Output files are a file containing the location of and orientation of read pairs marked as discordant, and a file containing the clipping location of all soft clipped reads and the orientation of the clipping. +keywords: + - gatk4 + - collectsvevidence + - structural variants + - metrics +tools: + - "gatk4": + description: "Genome Analysis Toolkit (GATK4)" + homepage: "https://gatk.broadinstitute.org/hc/en-us" + documentation: "None" + tool_dev_url: "https://github.com/broadinstitute/gatk" + doi: "10.1158/1538-7445.AM2017-3590" + licence: "['BSD-3-clause']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - input: + type: file + description: BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + - input_index: + type: file + description: Index of the BAM/CRAM/SAM file + pattern: "*.{bai,crai,sai}" + - allele_count_vcf: + type: file + description: Optional - input VCF of SNPs marking loci for allele counts, needed for the allele counts output + pattern: "*.vcf.gz" + - allele_count_vcf_index: + type: file + description: Optional - index of the VCF file, needed for the allele counts output + pattern: "*.tbi" + - fasta: + type: file + description: Optional - reference FASTA file needed when the input is a CRAM file + pattern: "*.{fasta,fa}" + - fasta_fai: + type: file + description: Optional - index of the reference FASTA file needed when the input is a CRAM file + pattern: "*.fai" + - dict: + type: file + description: Optional - sequence dictionary of the reference FASTA file needed when the input is a CRAM 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" + - split_read_evidence: + type: file + description: Output file for split read evidence + pattern: "*.sr.txt.gz" + - split_read_evidence_index: + type: file + description: Index of the output file for split read evidence + pattern: "*.sr.txt.gz.tbi" + - paired_end_evidence: + type: file + description: Output file for paired end evidence + pattern: "*.pe.txt.gz" + - paired_end_evidence_index: + type: file + description: Index of the output file for paired end evidence + pattern: "*.pe.txt.gz.tbi" + - allele_counts: + type: file + description: Output file for allele counts + pattern: "*.ld.txt.gz" + - allele_counts_index: + type: file + description: Index of the output file for allele counts + pattern: "*.ld.txt.gz.tbi" + +authors: + - "@nvnieuwk" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index ec5a62c2..e918cc22 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -871,6 +871,10 @@ gatk4/collectreadcounts: - modules/gatk4/collectreadcounts/** - tests/modules/gatk4/collectreadcounts/** +gatk4/collectsvevidence: + - modules/gatk4/collectsvevidence/** + - tests/modules/gatk4/collectsvevidence/** + gatk4/combinegvcfs: - modules/gatk4/combinegvcfs/** - tests/modules/gatk4/combinegvcfs/** diff --git a/tests/modules/gatk4/collectsvevidence/main.nf b/tests/modules/gatk4/collectsvevidence/main.nf new file mode 100644 index 00000000..21761d6a --- /dev/null +++ b/tests/modules/gatk4/collectsvevidence/main.nf @@ -0,0 +1,56 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GATK4_COLLECTSVEVIDENCE } from '../../../../modules/gatk4/collectsvevidence/main.nf' + +workflow test_gatk4_collectsvevidence_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), + [], + [] + ] + + 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) + dict = file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true) + + GATK4_COLLECTSVEVIDENCE ( input, fasta, fasta_fai, dict ) +} + +workflow test_gatk4_collectsvevidence_bam { + + 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), + [], + [] + ] + + fasta = [] + fasta_fai = [] + dict = [] + + GATK4_COLLECTSVEVIDENCE ( input, fasta, fasta_fai, dict ) +} + +workflow test_gatk4_collectsvevidence_allele_count { + + 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']['illumina']['test_haplotc_cnn_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_haplotc_cnn_vcf_gz_tbi'], checkIfExists: true) + ] + + fasta = [] + fasta_fai = [] + dict = [] + + GATK4_COLLECTSVEVIDENCE ( input, fasta, fasta_fai, dict ) +} diff --git a/tests/modules/gatk4/collectsvevidence/nextflow.config b/tests/modules/gatk4/collectsvevidence/nextflow.config new file mode 100644 index 00000000..08bbbe32 --- /dev/null +++ b/tests/modules/gatk4/collectsvevidence/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: GATK4_COLLECTSVEVIDENCE { + ext.args = "--sample-name normal" + } + +} \ No newline at end of file diff --git a/tests/modules/gatk4/collectsvevidence/test.yml b/tests/modules/gatk4/collectsvevidence/test.yml new file mode 100644 index 00000000..e08104cb --- /dev/null +++ b/tests/modules/gatk4/collectsvevidence/test.yml @@ -0,0 +1,48 @@ +- name: gatk4 collectsvevidence test_gatk4_collectsvevidence_cram + command: nextflow run ./tests/modules/gatk4/collectsvevidence -entry test_gatk4_collectsvevidence_cram -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectsvevidence/nextflow.config + tags: + - gatk4 + - gatk4/collectsvevidence + files: + - path: output/gatk4/test.pe.txt.gz + md5sum: 19f13dd0408204590b40239d14acbdde + - path: output/gatk4/test.pe.txt.gz.tbi + md5sum: 876170d2727a467263cbacecbd9979ee + - path: output/gatk4/test.sr.txt.gz + md5sum: fb9ce52193a0db3a084890bd6bbf6a64 + - path: output/gatk4/test.sr.txt.gz.tbi + md5sum: 3e7b04492c53765e3c84d76b59e1f2c5 + +- name: gatk4 collectsvevidence test_gatk4_collectsvevidence_bam + command: nextflow run ./tests/modules/gatk4/collectsvevidence -entry test_gatk4_collectsvevidence_bam -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectsvevidence/nextflow.config + tags: + - gatk4 + - gatk4/collectsvevidence + files: + - path: output/gatk4/test.pe.txt.gz + md5sum: 19f13dd0408204590b40239d14acbdde + - path: output/gatk4/test.pe.txt.gz.tbi + md5sum: 876170d2727a467263cbacecbd9979ee + - path: output/gatk4/test.sr.txt.gz + md5sum: fb9ce52193a0db3a084890bd6bbf6a64 + - path: output/gatk4/test.sr.txt.gz.tbi + md5sum: 3e7b04492c53765e3c84d76b59e1f2c5 + +- name: gatk4 collectsvevidence test_gatk4_collectsvevidence_allele_count + command: nextflow run ./tests/modules/gatk4/collectsvevidence -entry test_gatk4_collectsvevidence_allele_count -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/collectsvevidence/nextflow.config + tags: + - gatk4 + - gatk4/collectsvevidence + files: + - path: output/gatk4/test.ld.txt.gz + md5sum: c07747510deb2c2c886ee4e34d0a9c97 + - path: output/gatk4/test.ld.txt.gz.tbi + md5sum: d1479eeb2217c2b8b4a84cf7237aca45 + - path: output/gatk4/test.pe.txt.gz + md5sum: 19f13dd0408204590b40239d14acbdde + - path: output/gatk4/test.pe.txt.gz.tbi + md5sum: 876170d2727a467263cbacecbd9979ee + - path: output/gatk4/test.sr.txt.gz + md5sum: fb9ce52193a0db3a084890bd6bbf6a64 + - path: output/gatk4/test.sr.txt.gz.tbi + md5sum: 3e7b04492c53765e3c84d76b59e1f2c5