mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Added the rtgtools/vcfeval module
This commit is contained in:
parent
3c07602443
commit
84b354ab6a
5 changed files with 113 additions and 76 deletions
|
@ -1,46 +1,18 @@
|
|||
// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :)
|
||||
// https://github.com/nf-core/modules/tree/master/modules
|
||||
// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace:
|
||||
// https://nf-co.re/join
|
||||
// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters.
|
||||
// All other parameters MUST be provided using the "task.ext" directive, see here:
|
||||
// https://www.nextflow.io/docs/latest/process.html#ext
|
||||
// where "task.ext" is a string.
|
||||
// Any parameters that need to be evaluated in the context of a particular sample
|
||||
// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately.
|
||||
// TODO nf-core: Software that can be piped together SHOULD be added to separate module files
|
||||
// unless there is a run-time, storage advantage in implementing in this way
|
||||
// e.g. it's ok to have a single module for bwa to output BAM instead of SAM:
|
||||
// bwa mem | samtools view -B -T ref.fasta
|
||||
// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty
|
||||
// list (`[]`) instead of a file can be used to work around this issue.
|
||||
|
||||
process RTGTOOLS_VCFEVAL {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
// TODO nf-core: List required Conda package(s).
|
||||
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
|
||||
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
|
||||
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
|
||||
conda (params.enable_conda ? "bioconda::rtg-tools=3.12.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/rtg-tools:3.12.1--hdfd78af_0':
|
||||
'quay.io/biocontainers/rtg-tools:3.12.1--hdfd78af_0' }"
|
||||
|
||||
input:
|
||||
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
|
||||
// MUST be provided as an input via a Groovy Map called "meta".
|
||||
// This information may not be required in some instances e.g. indexing reference genome files:
|
||||
// https://github.com/nf-core/modules/blob/master/modules/bwa/index/main.nf
|
||||
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
|
||||
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
|
||||
tuple val(meta), path(bam)
|
||||
tuple val(meta), path(truth_vcf), path(truth_vcf_tbi), path(query_vcf), path(query_vcf_tbi), path(bed)
|
||||
path(sdf)
|
||||
|
||||
output:
|
||||
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
// TODO nf-core: List additional required output channels/values here
|
||||
tuple val(meta), path("*.txt"), emit: results
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
when:
|
||||
|
@ -49,19 +21,35 @@ process RTGTOOLS_VCFEVAL {
|
|||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
|
||||
// If the software is unable to output a version number on the command-line then it can be manually specified
|
||||
// e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf
|
||||
// Each software used MUST provide the software name and version number in the YAML version file (versions.yml)
|
||||
// TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive
|
||||
// TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter
|
||||
// using the Nextflow "task" variable e.g. "--threads $task.cpus"
|
||||
// TODO nf-core: Please replace the example samtools command below with your module's command
|
||||
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
|
||||
def regions = bed ? "--bed-regions=$bed" : ""
|
||||
def truth_index = truth_vcf_tbi ? "" : "rtg index $truth_vcf"
|
||||
def query_index = query_vcf_tbi ? "" : "rtg index $query_vcf"
|
||||
|
||||
sdf_basename = sdf.getBaseName().replace(".tar","")
|
||||
tar_decomp = ""
|
||||
if((sdf =~ /.tar.gz\b/).find() == true) {
|
||||
tar_decomp = "tar -xzf $sdf"
|
||||
}
|
||||
|
||||
"""
|
||||
$tar_decomp
|
||||
|
||||
$truth_index
|
||||
$query_index
|
||||
|
||||
rtg vcfeval \\
|
||||
$args \\
|
||||
--baseline=$truth_vcf \\
|
||||
$regions \\
|
||||
--calls=$query_vcf \\
|
||||
--output=$prefix \\
|
||||
--template=$sdf_basename \\
|
||||
--threads=$task.cpus \\
|
||||
> ${prefix}_results.txt
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
rtgtools: \$(echo \$(rtg version | head -n 1 | awk '{print \$4}'))
|
||||
rtg-tools: \$(echo \$(rtg version | head -n 1 | awk '{print \$4}'))
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -1,51 +1,63 @@
|
|||
name: "rtgtools_vcfeval"
|
||||
## TODO nf-core: Add a description of the module and list keywords
|
||||
description: write your description here
|
||||
description: The VCFeval tool of RTG tools. It is used to evaluate called variants for agreement with a baseline variant set
|
||||
keywords:
|
||||
- sort
|
||||
- benchmarking
|
||||
- vcf
|
||||
- rtg-tools
|
||||
tools:
|
||||
- "rtgtools":
|
||||
## TODO nf-core: Add a description and other details for the software below
|
||||
description: "RealTimeGenomics Tools -- Utilities for accurate VCF comparison and manipulation"
|
||||
homepage: "None"
|
||||
documentation: "None"
|
||||
tool_dev_url: "None"
|
||||
homepage: "https://www.realtimegenomics.com/products/rtg-tools"
|
||||
documentation: "https://github.com/RealTimeGenomics/rtg-tools"
|
||||
tool_dev_url: "https://github.com/RealTimeGenomics/rtg-tools"
|
||||
doi: ""
|
||||
licence: "['BSD']"
|
||||
|
||||
## TODO nf-core: Add a description of all of the variables used as input
|
||||
input:
|
||||
# Only when we have meta
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
#
|
||||
## TODO nf-core: Delete / customise this example input
|
||||
- bam:
|
||||
- truth_vcf:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
description: A standard VCF to compare against
|
||||
pattern: "*.{vcf,vcf.gz}"
|
||||
- truth_vcf_index:
|
||||
type: file
|
||||
description: The index of the standard VCF (optional)
|
||||
pattern: "*.tbi"
|
||||
- query_vcf:
|
||||
type: file
|
||||
description: A VCF with called variants to benchmark against the standard
|
||||
pattern: "*.{vcf,vcf.gz}"
|
||||
- query_vcf_index:
|
||||
type: file
|
||||
description: The index of the called VCF (optional)
|
||||
pattern: "*.tbi"
|
||||
- bed:
|
||||
type: file
|
||||
description: The BED file of the called VCF
|
||||
pattern: "*.bed"
|
||||
- sdf:
|
||||
type: folder/file
|
||||
description: The SDF (RTG Sequence Data File) of the reference genome. Can be a folder or a tar-zipped folder.
|
||||
pattern: "*.{,tar.gz}"
|
||||
|
||||
## TODO nf-core: Add a description of all of the variables used as output
|
||||
output:
|
||||
#Only when we have meta
|
||||
- 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"
|
||||
## TODO nf-core: Delete / customise this example output
|
||||
- bam:
|
||||
- results:
|
||||
type: file
|
||||
description: Sorted BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
description: A text file containing the results of the benchmark
|
||||
pattern: "*.txt"
|
||||
|
||||
authors:
|
||||
- "@nvnieuwk"
|
||||
|
|
|
@ -132,6 +132,7 @@ params {
|
|||
transcriptome_fasta = "${test_data_dir}/genomics/homo_sapiens/genome/transcriptome.fasta"
|
||||
genome2_fasta = "${test_data_dir}/genomics/homo_sapiens/genome/genome2.fasta"
|
||||
genome_chain_gz = "${test_data_dir}/genomics/homo_sapiens/genome/genome.chain.gz"
|
||||
genome_21_sdf = "${test_data_dir}/genomics/homo_sapiens/genome/genome_sdf.tar.gz"
|
||||
genome_21_fasta = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta"
|
||||
genome_21_fasta_fai = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai"
|
||||
genome_21_dict = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/genome.dict"
|
||||
|
@ -263,6 +264,9 @@ params {
|
|||
test2_haplotc_ann_vcf_gz = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz"
|
||||
test2_haplotc_ann_vcf_gz_tbi = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi"
|
||||
|
||||
test2_haplotc_vcf_gz = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz"
|
||||
test2_haplotc_vcf_gz_tbi = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi"
|
||||
|
||||
test2_recal = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal"
|
||||
test2_recal_idx = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal.idx"
|
||||
test2_tranches = "${test_data_dir}/genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.tranches"
|
||||
|
|
|
@ -7,9 +7,35 @@ include { RTGTOOLS_VCFEVAL } from '../../../../modules/rtgtools/vcfeval/main.nf'
|
|||
workflow test_rtgtools_vcfeval {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||
[ id:'test' ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_ann_vcf_gz'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_ann_vcf_gz_tbi'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz_tbi'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true)
|
||||
]
|
||||
|
||||
RTGTOOLS_VCFEVAL ( input )
|
||||
sdf = Channel.value(
|
||||
file(params.test_data['homo_sapiens']['genome']['genome_21_sdf'])
|
||||
)
|
||||
|
||||
RTGTOOLS_VCFEVAL ( input, sdf )
|
||||
}
|
||||
|
||||
workflow test_rtgtools_vcfeval_no_index {
|
||||
|
||||
input = [
|
||||
[ id:'test' ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_ann_vcf_gz'], checkIfExists: true),
|
||||
[],
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true),
|
||||
[],
|
||||
file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true)
|
||||
]
|
||||
|
||||
sdf = Channel.value(
|
||||
file(params.test_data['homo_sapiens']['genome']['genome_21_sdf'])
|
||||
)
|
||||
|
||||
RTGTOOLS_VCFEVAL ( input, sdf )
|
||||
}
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
## TODO nf-core: Please run the following command to build this file:
|
||||
# nf-core modules create-test-yml rtgtools/vcfeval
|
||||
- name: "rtgtools vcfeval"
|
||||
command: nextflow run ./tests/modules/rtgtools/vcfeval -entry test_rtgtools_vcfeval -c ./tests/config/nextflow.config -c ./tests/modules/rtgtools/vcfeval/nextflow.config
|
||||
- name: rtgtools vcfeval test_rtgtools_vcfeval
|
||||
command: nextflow run tests/modules/rtgtools/vcfeval -entry test_rtgtools_vcfeval -c tests/config/nextflow.config
|
||||
tags:
|
||||
- "rtgtools"
|
||||
#
|
||||
- "rtgtools/vcfeval"
|
||||
#
|
||||
- rtgtools
|
||||
- rtgtools/vcfeval
|
||||
files:
|
||||
- path: "output/rtgtools/test.bam"
|
||||
md5sum: e667c7caad0bc4b7ac383fd023c654fc
|
||||
- path: output/rtgtools/test_results.txt
|
||||
md5sum: 2e011aa6e54d258fcc3b45b2dda02ae4
|
||||
- path: output/rtgtools/versions.yml
|
||||
md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b
|
||||
md5sum: 270ed7a5a8e347b251eb4aa2198f98e8
|
||||
|
||||
- name: rtgtools vcfeval test_rtgtools_vcfeval_no_index
|
||||
command: nextflow run tests/modules/rtgtools/vcfeval -entry test_rtgtools_vcfeval_no_index -c tests/config/nextflow.config
|
||||
tags:
|
||||
- rtgtools
|
||||
- rtgtools/vcfeval
|
||||
files:
|
||||
- path: output/rtgtools/test_results.txt
|
||||
md5sum: 2e011aa6e54d258fcc3b45b2dda02ae4
|
||||
- path: output/rtgtools/versions.yml
|
||||
md5sum: 8d0407000988c78fa43fe5cfe3d4449d
|
||||
|
|
Loading…
Reference in a new issue