-
Notifications
You must be signed in to change notification settings - Fork 956
Add ViralConsensus module #9655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lucaspatel
wants to merge
4
commits into
nf-core:master
Choose a base branch
from
lucaspatel:new-module-viralconsensus
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| # renovate: datasource=conda depName=bioconda/viral_consensus | ||
| - bioconda::viral_consensus=1.0.0 |
This file contains hidden or 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,52 @@ | ||
| process VIRALCONSENSUS { | ||
| tag "$meta.id" | ||
| label 'process_low' | ||
|
|
||
| conda "${moduleDir}/environment.yml" | ||
| container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
| 'https://depot.galaxyproject.org/singularity/viral_consensus:1.0.0--hcf1f8c1_0': | ||
| 'biocontainers/viral_consensus:1.0.0--hcf1f8c1_0' }" | ||
|
|
||
| input: | ||
| tuple val(meta), path(bam) | ||
| path fasta | ||
| path primer_bed | ||
| val save_pos_counts | ||
| val save_ins_counts | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.consensus.fa"), emit: fasta | ||
| tuple val(meta), path("*.pos_counts.tsv"), optional: true, emit: pos_counts | ||
| tuple val(meta), path("*.ins_counts.json"), optional: true, emit: ins_counts | ||
| tuple val("${task.process}"), val('viralconsensus'), eval("viral_consensus --version 2>&1 | head -n1 | sed 's/ViralConsensus //'"), topic: versions, emit: versions_viralconsensus | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| def primer_arg = primer_bed ? "-p ${primer_bed}" : '' | ||
| def pos_counts_arg = save_pos_counts ? "-op ${prefix}.pos_counts.tsv" : '' | ||
| def ins_counts_arg = save_ins_counts ? "-oi ${prefix}.ins_counts.json" : '' | ||
| """ | ||
| viral_consensus \\ | ||
| -i $bam \\ | ||
| -r $fasta \\ | ||
| -o ${prefix}.consensus.fa \\ | ||
| $primer_arg \\ | ||
| $pos_counts_arg \\ | ||
| $ins_counts_arg \\ | ||
| $args | ||
| """ | ||
|
|
||
| stub: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| def touch_pos_counts = save_pos_counts ? "touch ${prefix}.pos_counts.tsv" : '' | ||
| def touch_ins_counts = save_ins_counts ? "touch ${prefix}.ins_counts.json" : '' | ||
| """ | ||
| touch ${prefix}.consensus.fa | ||
| $touch_pos_counts | ||
| $touch_ins_counts | ||
| """ | ||
| } | ||
This file contains hidden or 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,121 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
| name: "viralconsensus" | ||
| description: Fast and memory-efficient viral consensus genome sequence | ||
| generation from read alignments | ||
| keywords: | ||
| - virus | ||
| - genomics | ||
| - consensus | ||
| - bam | ||
| - fasta | ||
| tools: | ||
| - "viralconsensus": | ||
| description: "ViralConsensus is a fast and memory-efficient tool for calling viral | ||
| consensus genome sequences directly from read alignment data." | ||
| homepage: "https://github.com/niemasd/ViralConsensus" | ||
| documentation: "https://github.com/niemasd/ViralConsensus#usage" | ||
| tool_dev_url: "https://github.com/niemasd/ViralConsensus" | ||
| doi: "10.1093/bioinformatics/btad317" | ||
| licence: ["GPL-3.0-or-later"] | ||
| identifier: biotools:viralconsensus | ||
|
|
||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - bam: | ||
| type: file | ||
| description: BAM/SAM/CRAM file containing aligned reads | ||
| pattern: "*.{bam,sam,cram}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_2572 | ||
| - fasta: | ||
| type: file | ||
| description: Reference genome sequence in FASTA format | ||
| pattern: "*.{fa,fasta,fna}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1929 | ||
| - primer_bed: | ||
| type: file | ||
| description: Optional BED file with primer coordinates for trimming | ||
| pattern: "*.bed" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3003 | ||
| - save_pos_counts: | ||
| type: boolean | ||
| description: | | ||
| Save per-position counts to a TSV file | ||
| - save_ins_counts: | ||
| type: boolean | ||
| description: | | ||
| Save insertion counts to a JSON file | ||
|
|
||
| output: | ||
| fasta: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - "*.consensus.fa": | ||
| type: file | ||
| description: Consensus genome sequence in FASTA format | ||
| pattern: "*.consensus.fa" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1929 | ||
| pos_counts: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - "*.pos_counts.tsv": | ||
| type: file | ||
| description: Per-position base counts (optional, enabled via | ||
| save_pos_counts input) | ||
| pattern: "*.pos_counts.tsv" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3475 | ||
| ins_counts: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - "*.ins_counts.json": | ||
| type: file | ||
| description: Insertion counts (optional, enabled via | ||
| save_ins_counts input) | ||
| pattern: "*.ins_counts.json" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3464 | ||
| versions_viralconsensus: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - viralconsensus: | ||
| type: string | ||
| description: The name of the tool | ||
| - "viral_consensus --version 2>&1 | head -n1 | sed 's/ViralConsensus //'": | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
|
|
||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - viralconsensus: | ||
| type: string | ||
| description: The name of the tool | ||
| - "viral_consensus --version 2>&1 | head -n1 | sed 's/ViralConsensus //'": | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
|
|
||
| authors: | ||
| - "@niemasd" | ||
| maintainers: | ||
| - "@niemasd" | ||
| - "@lucaspatel" |
This file contains hidden or 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,127 @@ | ||||||||||||
| nextflow_process { | ||||||||||||
|
|
||||||||||||
| name "Test Process VIRALCONSENSUS" | ||||||||||||
| script "../main.nf" | ||||||||||||
| process "VIRALCONSENSUS" | ||||||||||||
|
|
||||||||||||
| tag "modules" | ||||||||||||
| tag "modules_nfcore" | ||||||||||||
| tag "viralconsensus" | ||||||||||||
|
|
||||||||||||
| test("sarscov2 - bam - basic") { | ||||||||||||
|
|
||||||||||||
| when { | ||||||||||||
| process { | ||||||||||||
| """ | ||||||||||||
| input[0] = [ | ||||||||||||
| [ id:'test' ], | ||||||||||||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) | ||||||||||||
| ] | ||||||||||||
| input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||||||||||||
| input[2] = [] | ||||||||||||
| input[3] = false | ||||||||||||
| input[4] = false | ||||||||||||
| """ | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| then { | ||||||||||||
| assertAll( | ||||||||||||
| { assert process.success }, | ||||||||||||
| { assert snapshot( | ||||||||||||
| process.out.fasta, | ||||||||||||
| process.out.findAll { key, val -> key.startsWith("versions") } | ||||||||||||
| ).match() } | ||||||||||||
|
Comment on lines
+31
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could probably just be
Suggested change
i.e. you are just testing everything that is generated. |
||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| test("sarscov2 - bam - with primer bed") { | ||||||||||||
|
|
||||||||||||
| when { | ||||||||||||
| process { | ||||||||||||
| """ | ||||||||||||
| input[0] = [ | ||||||||||||
| [ id:'test' ], | ||||||||||||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) | ||||||||||||
| ] | ||||||||||||
| input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||||||||||||
| input[2] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) | ||||||||||||
| input[3] = false | ||||||||||||
| input[4] = false | ||||||||||||
| """ | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| then { | ||||||||||||
| assertAll( | ||||||||||||
| { assert process.success }, | ||||||||||||
| { assert snapshot( | ||||||||||||
| process.out.fasta, | ||||||||||||
| process.out.findAll { key, val -> key.startsWith("versions") } | ||||||||||||
| ).match() } | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| test("sarscov2 - bam - with optional outputs") { | ||||||||||||
|
|
||||||||||||
| config "./nextflow.config" | ||||||||||||
|
|
||||||||||||
| when { | ||||||||||||
| params { | ||||||||||||
| module_args = '-q 30 -d 5 -f 0.6' | ||||||||||||
| } | ||||||||||||
| process { | ||||||||||||
| """ | ||||||||||||
| input[0] = [ | ||||||||||||
| [ id:'test' ], | ||||||||||||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) | ||||||||||||
| ] | ||||||||||||
| input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||||||||||||
| input[2] = [] | ||||||||||||
| input[3] = true | ||||||||||||
| input[4] = true | ||||||||||||
| """ | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| then { | ||||||||||||
| assertAll( | ||||||||||||
| { assert process.success }, | ||||||||||||
| { assert snapshot( | ||||||||||||
| process.out.fasta, | ||||||||||||
| process.out.pos_counts, | ||||||||||||
| process.out.ins_counts, | ||||||||||||
| process.out.findAll { key, val -> key.startsWith("versions") } | ||||||||||||
| ).match() } | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| test("sarscov2 - bam - stub") { | ||||||||||||
| options '-stub' | ||||||||||||
|
|
||||||||||||
| when { | ||||||||||||
| process { | ||||||||||||
| """ | ||||||||||||
| input[0] = [ | ||||||||||||
| [ id:'test' ], | ||||||||||||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) | ||||||||||||
| ] | ||||||||||||
| input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||||||||||||
| input[2] = [] | ||||||||||||
| input[3] = false | ||||||||||||
| input[4] = false | ||||||||||||
| """ | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| then { | ||||||||||||
| assertAll( | ||||||||||||
| { assert process.success }, | ||||||||||||
| { assert snapshot(process.out).match() } | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We generally add a meta map to the fasta, to help for pipelines that want to consider multiple genomes.