forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New module svtypersso (nf-core#5311)
* Add module svtypersso * Adjust formatting - align equal signs
- Loading branch information
Showing
6 changed files
with
403 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "svtyper_svtypersso" | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- "bioconda::svtyper=0.7.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
process SVTYPER_SVTYPERSSO { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/svtyper:0.7.1--py_0': | ||
'biocontainers/svtyper:0.7.1--py_0' }" | ||
|
||
input: | ||
tuple val(meta), path(bam), path(bam_index), path(vcf) | ||
tuple val(meta2), path(fasta) | ||
|
||
output: | ||
tuple val(meta), path("*.vcf") , emit: gt_vcf | ||
tuple val(meta), path("*.json"), emit: json | ||
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 vcf = vcf ? "--input_vcf ${vcf}" : "" | ||
def fasta = fasta ? "--ref_fasta ${fasta}" : "" | ||
if ("$vcf" == "${prefix}.vcf") error "Input and output names are the same, set prefix in module configuration to disambiguate!" | ||
if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" | ||
""" | ||
svtyper-sso \\ | ||
--bam $bam \\ | ||
$vcf \\ | ||
$fasta \\ | ||
--output_vcf ${prefix}.vcf \\ | ||
--lib_info ${prefix}.json \\ | ||
--cores $task.cpus \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
svtyper: \$(echo \$(svtyper-sso -h 2>&1 | grep "version:" | sed 's/^version: v//')) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.json | ||
touch ${prefix}.vcf | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
svtyper: \$(echo \$(svtyper-sso -h 2>&1 | grep "version:" | sed 's/^version: v//')) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "svtyper_svtypersso" | ||
description: SVTyper-sso computes structural variant (SV) genotypes based on breakpoint depth on a SINGLE sample | ||
keywords: | ||
- sv | ||
- structural variants | ||
- genotyping | ||
- Bayesian | ||
tools: | ||
- "svtyper": | ||
description: "Bayesian genotyper for structural variants" | ||
homepage: "https://github.com/hall-lab/svtyper" | ||
documentation: "https://github.com/hall-lab/svtyper" | ||
tool_dev_url: "https://github.com/hall-lab/svtyper" | ||
doi: "10.1038/nmeth.3505" | ||
licence: ["MIT"] | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. [ id:'test'] | ||
- meta2: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information for reference FASTA file | ||
e.g. [ id:'fasta'] | ||
- bam: | ||
type: file | ||
description: BAM or CRAM file with alignments | ||
pattern: "*.{bam,cram}" | ||
- bam_index: | ||
type: file | ||
description: BAI file matching the BAM file | ||
pattern: "*.{bai}" | ||
- vcf: | ||
type: file | ||
description: Matching VCF of alignments | ||
pattern: "*.vcf" | ||
- fasta: | ||
type: file | ||
description: indexed reference FASTA file (recommended for reading CRAM files) | ||
pattern: "*.{fa,fasta}" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. [ id:'test' ] | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
- json: | ||
type: file | ||
description: JSON file including library information | ||
pattern: "*.json" | ||
- gt_vcf: | ||
type: file | ||
description: Genotyped SVs | ||
pattern: "*.vcf" | ||
authors: | ||
- "@tstoeriko" | ||
maintainers: | ||
- "@tstoeriko" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
nextflow_process { | ||
|
||
name "Test Process SVTYPER_SVTYPERSSO" | ||
script "../main.nf" | ||
process "SVTYPER_SVTYPERSSO" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "svtyper" | ||
tag "svtyper/svtypersso" | ||
|
||
test("homo_sapiens - bam - vcf - fasta") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf', checkIfExists: true) | ||
] | ||
input[1] = [ | ||
[ id:'reference' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out.gt_vcf, | ||
process.out.versions).match("bam_vcf_fasta") }, | ||
{ assert file(process.out.json.get(0).get(1)).exists() } | ||
) | ||
} | ||
} | ||
|
||
test("homo_sapiens - bam - vcf - fasta - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf', checkIfExists: true) | ||
] | ||
input[1] = [ | ||
[ id:'reference' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match("bam_vcf_fasta_stub") } | ||
) | ||
} | ||
} | ||
|
||
test("homo_sapiens - bam") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), | ||
[] | ||
] | ||
input[1] = [ | ||
[ id:'reference' ], // meta map | ||
[] | ||
] | ||
""" | ||
} | ||
} | ||
|
||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out.gt_vcf, | ||
process.out.versions).match("bam") }, | ||
{ assert file(process.out.json.get(0).get(1)).exists() } | ||
) | ||
} | ||
} | ||
|
||
test("homo_sapiens - bam - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), | ||
[] | ||
] | ||
input[1] = [ | ||
[ id:'reference' ], // meta map | ||
[] | ||
] | ||
""" | ||
} | ||
} | ||
|
||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match("bam_stub") } | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.