Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/skip_nf_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@
"subworkflows/nf-core/fastq_align_bwa"
],
"docker": [
"modules/nf-core/canvas/germline",
"modules/nf-core/parabricks",
"modules/nf-core/sparsesignatures",
"subworkflows/nf-core/deepvariant/tests/equality"
],
"singularity": [
"modules/nf-core/numorph/3dunet",
"modules/nf-core/bases2fastq",
"modules/nf-core/canvas/germline",
"modules/nf-core/deepsomatic",
"modules/nf-core/deepvariant/rundeepvariant",
"modules/nf-core/deepvariant/vcfstatsreport",
Expand Down
7 changes: 7 additions & 0 deletions modules/nf-core/canvas/germline/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::canvas=1.40.0.1613
73 changes: 38 additions & 35 deletions modules/nf-core/canvas/germline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,59 @@ process CANVAS_GERMLINE {
container "quay.io/nf-core/canvas:1.40.0"

input:
tuple val(meta), path(bam), path(bai)
path germline_snv_vcf
tuple val(sex), path(male_ploidy_vcf), path(female_ploidy_vcf)
path genomedir
path reference
path filter13
tuple val(meta) , path(bam), path(bai)
tuple val(meta2), path(kmer_fasta, stageAs: 'Sequence/WholeGenomeFasta/genome.fa')
tuple val(meta3), path(genomesize, stageAs: 'Sequence/WholeGenomeFasta/GenomeSize.xml')
tuple val(meta4), path(filter_bed)
tuple val(meta5), path(sample_snv_vcf)
tuple val(meta6), path(population_snv_vcf)
tuple val(meta7), path(ploidy_vcf)
tuple val(meta8), path(common_cnvs_bed)

output:
tuple val(meta), path("${prefix}.vcf.gz"), emit: vcf
tuple val(meta), path("${prefix}.CoverageAndVariantFrequency.txt"), emit: covandvarfreq
tuple val("${task.process}"), val('canvas'), val('1.40.0'), topic: versions, emit: versions_canvas
// --version not supported by CLI, please update this manually when updating the tool
tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf
tuple val(meta), path("${prefix}.CoverageAndVariantFrequency.txt") , emit: covandvarfreq
tuple val("${task.process}"), val('canvas'), eval('Canvas --version'), topic: versions, emit: versions_canvas

when:
task.ext.when == null || task.ext.when

script:
prefix = task.ext.prefix ?: "${meta.id}"
def ploidy_vcf = (sex == 'male') ? male_ploidy_vcf : female_ploidy_vcf
"""
PLOIDYVCF=\$(mod_sex_vcf.py ${ploidy_vcf} ${prefix} ./)

SNV_VCF=${germline_snv_vcf}
if [[ ${germline_snv_vcf} == *.gz ]]; then
gunzip -c ${germline_snv_vcf} > snv_input.vcf
SNV_VCF=snv_input.vcf
fi
if (!(sample_snv_vcf || population_snv_vcf)) {
error("Either sample_snv_vcf or population_snv_vcf must be supplied")
}

mkdir -p Sequence
ln -s \$(realpath ${genomedir}) Sequence/WholeGenomeFasta
prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ""
def sample_vcf_arg = sample_snv_vcf ? "--sample-b-allele-vcf ${sample_snv_vcf}" : ""
def population_vcf_arg = population_snv_vcf ? "--population-b-allele-vcf ${population_snv_vcf}" : ""
def ploidy_arg = ploidy_vcf ? "--ploidy-vcf $ploidy_vcf" : ""
def common_cnvs_arg = common_cnvs_bed ? "--common-cnvs-bed ${common_cnvs_bed}" : ""

"""
Canvas SmallPedigree-WGS \\
--bam=${bam} \\
--sample-b-allele-vcf=\$SNV_VCF \\
--ploidy-vcf=\$PLOIDYVCF \\
-g ./Sequence/WholeGenomeFasta \\
-r ${reference} \\
-f ${filter13} \\
-o ./
--bam ${bam} \\
--genome-folder ./Sequence/WholeGenomeFasta \\
--reference ${kmer_fasta} \\
--filter-bed ${filter_bed} \\
--output ./ \\
${sample_vcf_arg} \\
${population_vcf_arg} \\
${ploidy_arg} \\
${common_cnvs_arg} \\
${args}

if [ -f CNV.vcf.gz ]; then
gunzip CNV.vcf.gz
fi

grep -v 'Canvas:REF' CNV.vcf | bgzip > ${prefix}.vcf.gz

find . -name "CNV.CoverageAndVariantFrequency.txt" | head -1 | xargs -I{} cp {} ./${prefix}.CoverageAndVariantFrequency.txt
mv CNV.vcf.gz ${prefix}.vcf.gz
mv TempCNV_*/CNV.CoverageAndVariantFrequency.txt ${prefix}.CoverageAndVariantFrequency.txt
"""

stub:

if (!(sample_snv_vcf || population_snv_vcf)) {
error("Either sample_snv_vcf or population_snv_vcf must be supplied")
}

prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.vcf.gz
Expand Down
155 changes: 67 additions & 88 deletions modules/nf-core/canvas/germline/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,111 +25,91 @@ tools:
input:
- - meta:
type: map
description: |
Groovy Map containing sample information.
e.g. `[ id:'sample1' ]`
ontologies: []
description: Groovy map containing sample information
- bam:
type: file
description: Sorted BAM file of aligned WGS reads.
description: BAM file for the sample
pattern: "*.bam"
ontologies:
- edam: "http://edamontology.org/format_2572"
- bai:
type: file
description: BAM index file.
description: BAM index file for the sample
pattern: "*.bai"
ontologies:
- edam: "http://edamontology.org/format_3327"
- germline_snv_vcf:
type: file
description: |
VCF (or gzipped VCF) containing germline SNV b-allele sites (PASS filter only).
Typically produced by a variant caller such as DNAscope or DeepVariant.
pattern: "*.{vcf,vcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3016"
- - sex:
type: string
description: |
Sample sex. Must be either "male" or "female". Used to select the
appropriate ploidy VCF for sex chromosomes.
- male_ploidy_vcf:
- - meta2:
type: map
description: Groovy map containing reference information
- kmer_fasta:
type: file
description: |
VCF defining expected ploidy for sex chromosomes in male samples.
Both ploidy VCFs (male and female) must always be provided. The module
automatically selects the correct one based on the sex value.
The sample name in the VCF header is automatically updated to match the SM tag in the BAM header.
Expected format (hg38 example):

```
##fileformat=VCFv4.1
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number genotype for imprecise events">
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
chrX 0 . N <CNV> . PASS END=10001 CN 1
chrX 2781479 . N <CNV> . PASS END=155701383 CN 1
chrX 156030895 . N <CNV> . PASS END=156040895 CN 1
chrY 0 . N <CNV> . PASS END=57227415 CN 1
```
pattern: "*.vcf"
description: Canvas-ready reference FASTA file with softmasked non-unique 35-mers
pattern: "*.{fa,fna,fasta}"
ontologies:
- edam: "http://edamontology.org/format_1929"
- - meta3:
type: map
description: Groovy map containing reference information
- genomesize:
type: file
description: Illumina-style Genome size XML file (GenomeSize.xml)
pattern: "*.xml"
ontologies:
- edam: "http://edamontology.org/format_2332"
- - meta4:
type: map
description: Groovy map containing reference information
- filter_bed:
type: file
description: BED file of regions to skip
pattern: "*.bed"
ontologies:
- edam: "http://edamontology.org/format_3003"
- - meta5:
type: map
description: Groovy map containing sample information
- sample_snv_vcf:
type: file
description: Multisample VCF file containing SNV b-allele sites (sample-specific). Either this or `population_snv_vcf` must be provided.
pattern: "*.vcf(.gz)?"
ontologies:
- edam: "http://edamontology.org/format_3016"
- female_ploidy_vcf:
- - meta6:
type: map
description: Groovy map containing meta information for population SNV VCF
- population_snv_vcf:
type: file
description: |
VCF defining expected ploidy for sex chromosomes in female samples.
Both ploidy VCFs (male and female) must always be provided. The module
automatically selects the correct one based on the sex value.
The sample name in the VCF header is automatically updated to match the SM tag in the BAM header.
Expected format (hg38 example):

```
##fileformat=VCFv4.1
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number genotype for imprecise events">
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
chrY 0 . N <CNV> . PASS END=57227415 CN 0
```
pattern: "*.vcf"
description: VCF file containing SNV b-allele sites in the population. Either this or `sample_snv_vcf` must be provided.
pattern: "*.vcf(.gz)?"
ontologies:
- edam: "http://edamontology.org/format_3016"
- genomedir:
type: directory
description: |
Canvas genome reference directory containing genome.fa and GenomeSize.xml.
Available for GRCh37/hg19/GRCh38 from s3://canvas-cnv-public.
- reference:
type: file
description: |
Canvas-ready kmer reference file (kmer.fa).
Available from s3://canvas-cnv-public.
pattern: "*.fa"
ontologies:
- edam: "http://edamontology.org/format_1929"
- filter13:
type: file
description: |
BED file of regions to exclude from CNV calling (e.g. centromeres, telomeres).
Named filter13 following Canvas reference package conventions.
Available from s3://canvas-cnv-public.
pattern: "*.bed"
ontologies:
- edam: "http://edamontology.org/format_3003"
- - meta7:
type: map
description: Groovy map containing for ploidy VCF
- ploidy_vcf:
type: file
description: Multisample VCF file containing regions with expected ploidy different from 2. (See https://github.com/Illumina/canvas/wiki for an example)
pattern: "*.vcf(.gz)?"
ontologies:
- edam: "http://edamontology.org/format_3016"
- - meta8:
type: map
description: Groovy map containing reference information
- common_cnvs_bed:
type: file
description: BED file containing regions of known common CNVs
pattern: "*.bed"
ontologies:
- edam: "http://edamontology.org/format_3003"
output:
vcf:
- - meta:
type: map
description: |
Groovy Map containing sample information.
e.g. `[ id:'sample1' ]`
ontologies: []
- ${prefix}.vcf.gz:
type: file
description: |
Bgzipped VCF file containing germline CNV calls. Canvas:REF entries (non-variant regions)
are excluded. Requires further annotation for standard SV ALT notation.
description: Bgzipped VCF file containing germline CNV calls.
pattern: "*.vcf.gz"
ontologies:
- edam: "http://edamontology.org/format_3016"
Expand All @@ -138,13 +118,10 @@ output:
type: map
description: |
Groovy Map containing sample information.
e.g. `[ id:'sample1' ]`
ontologies: []
- ${prefix}.CoverageAndVariantFrequency.txt:
type: file
description: |
Tab-separated file with per-bin coverage and variant allele frequency values.
Used as input for CANVAS_CREATESEG to generate segmentation files.
pattern: "*.CoverageAndVariantFrequency.txt"
ontologies:
- edam: "http://edamontology.org/format_3475"
Expand All @@ -155,10 +132,10 @@ output:
- canvas:
type: string
description: The name of the tool
- 1.40.0:
- Canvas --version:
type: string
description: The version of the tool (hardcoded as Canvas is an archived
tool)
description: The version of the tool

topics:
versions:
- - ${task.process}:
Expand All @@ -167,11 +144,13 @@ topics:
- canvas:
type: string
description: The name of the tool
- 1.40.0:
- Canvas --version:
type: string
description: The version of the tool (hardcoded as Canvas is an archived
tool)
authors:
- "@ktruve"
- "@Schmytzi"
maintainers:
- "@ktruve"
- "@Schmytzi"
Loading