-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: parsnp module #11196
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
emmcauley
wants to merge
14
commits into
nf-core:master
Choose a base branch
from
fulcrumgenomics:em_parsnp_module
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
feat: parsnp module #11196
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a2aff07
feat: parsnp module
emmcauley 6cbf00c
Merge branch 'master' into em_parsnp_module
emmcauley 811e177
tests: remove redundant params
emmcauley 7fd07f3
fix: reviewer comments and update tests
emmcauley fe0f60a
fix: reviewer comments
emmcauley b359944
Merge branch 'master' into em_parsnp_module
emmcauley 7051840
fix: https breaks singularity image, need to use oras
emmcauley 806eddb
fix: reviewer comments
emmcauley 8c58345
Merge branch 'master' into em_parsnp_module
emmcauley bebcfad
fix: reviewer comments, partition outputs
emmcauley ce83f20
Merge branch 'master' into em_parsnp_module
emmcauley 25fb13f
fix: more fixes
emmcauley 9edf167
Merge branch 'master' into em_parsnp_module
emmcauley 88eadad
Merge branch 'master' into em_parsnp_module
emmcauley 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
Some comments aren't visible on the classic Files Changed page.
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,7 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - "bioconda::parsnp=2.1.5" |
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,58 @@ | ||
| process PARSNP { | ||
| tag "${meta.id}" | ||
| label 'process_high' | ||
|
|
||
| conda "${moduleDir}/environment.yml" | ||
| container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container | ||
| ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/78/78d7fff752adf0b7ff156545536bbe58f8e6e8c5e1b1513f9a726747ee686900/data' | ||
| : 'community.wave.seqera.io/library/parsnp:2.1.5--2c7f64ad14a79523'}" | ||
|
|
||
| input: | ||
| tuple val(meta), path(genomes, stageAs: "genomes/*") | ||
| path reference | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.xmfa"), emit: xmfa | ||
| tuple val(meta), path("*.ggr"), emit: ggr | ||
| tuple val(meta), path("*.snps.mblocks"), emit: snps_mblocks, optional: true | ||
| tuple val(meta), path("*.tree"), emit: tree | ||
| tuple val(meta), path("partition"), emit: partition, optional: true | ||
| tuple val("${task.process}"), val('parsnp'), eval("parsnp --version 2>/dev/null | tail -n 1 | sed 's/parsnp //'"), topic: versions, emit: versions_parsnp | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| parsnp \\ | ||
| -r "${reference}" \\ | ||
| -d genomes/ \\ | ||
| -o parsnp_out \\ | ||
| -p ${task.cpus} \\ | ||
| ${args} | ||
|
|
||
| mv parsnp_out/parsnp.xmfa ${prefix}.xmfa | ||
| mv parsnp_out/parsnp.ggr ${prefix}.ggr | ||
| if [ -f parsnp_out/parsnp.snps.mblocks ]; then | ||
| mv parsnp_out/parsnp.snps.mblocks "${prefix}.snps.mblocks" | ||
| fi | ||
| mv parsnp_out/parsnp.tree ${prefix}.tree | ||
| if [ -d parsnp_out/partition ]; then | ||
| mv parsnp_out/partition . | ||
| fi | ||
| """ | ||
|
|
||
| stub: | ||
|
famosab marked this conversation as resolved.
|
||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
emmcauley marked this conversation as resolved.
|
||
| def partition_cmd = args.contains("partition") ? "mkdir partition" : "" | ||
| """ | ||
| touch ${prefix}.xmfa | ||
| touch ${prefix}.ggr | ||
| touch ${prefix}.snps.mblocks | ||
| touch ${prefix}.tree | ||
| ${partition_cmd} | ||
| """ | ||
| } | ||
|
emmcauley marked this conversation as resolved.
|
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,120 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
| name: "parsnp" | ||
| description: "Parsnp is a command-line-tool for efficient microbial core genome alignment and SNP detection." | ||
| keywords: | ||
| - alignment | ||
| - bacteria | ||
| - phylogeny | ||
| - microbial genomics | ||
| - core genome | ||
| - SNP | ||
|
|
||
| tools: | ||
| - "parsnp": | ||
| description: "Parsnp is a command-line-tool for efficient microbial core genome alignment and SNP detection." | ||
| homepage: "https://harvest.readthedocs.io/en/latest/content/parsnp/tutorial.html" | ||
| documentation: "https://harvest.readthedocs.io/en/latest/content/parsnp/tutorial.html" | ||
| tool_dev_url: "https://github.com/marbl/parsnp" | ||
| doi: "10.1093/bioinformatics/btae311" | ||
| licence: ["custom; see https://raw.githubusercontent.com/marbl/parsnp/master/LICENSE"] | ||
| identifier: biotools:parsnp | ||
|
|
||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - genomes: | ||
| type: directory | ||
| description: Directory containing genome assemblies in FASTA format to be aligned | ||
| - reference: | ||
| type: file | ||
| description: Reference genome in FASTA format | ||
| pattern: "*.{fasta,fa,fna}" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_1929" # FASTA | ||
|
|
||
| output: | ||
| xmfa: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.xmfa": | ||
| type: file | ||
| description: Core-genome multiple sequence alignment in XMFA format | ||
| pattern: "*.xmfa" | ||
|
emmcauley marked this conversation as resolved.
|
||
| ontologies: [] | ||
| ggr: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.ggr": | ||
| type: file | ||
| description: Compressed binary representation of the alignment generated by the Harvest toolkit, used for visualization with Gingr | ||
| pattern: "*.ggr" | ||
|
emmcauley marked this conversation as resolved.
|
||
| ontologies: [] | ||
| snps_mblocks: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.snps.mblocks": | ||
| type: file | ||
| description: Core-SNP signature of each sequence in FASTA format, used to generate the phylogeny. Absent when no SNPs are detected. | ||
| pattern: "*.snps.mblocks" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_1929" # FASTA | ||
| tree: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.tree": | ||
| type: file | ||
| description: Resulting phylogeny in Newick format | ||
| pattern: "*.tree" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_1910" # Newick | ||
| partition: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "partition": | ||
| type: directory | ||
| description: Output directory from partition mode containing results of each partitioned run. Only present when --partition is specified. | ||
|
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. can we add a |
||
| pattern: "partition" | ||
| versions_parsnp: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - parsnp: | ||
| type: string | ||
| description: The name of the tool | ||
| - "parsnp --version 2>/dev/null | tail -n 1 | sed 's/parsnp //'": | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
|
|
||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process | ||
| - parsnp: | ||
| type: string | ||
| description: The tool name | ||
| - parsnp --version 2>/dev/null | tail -n 1 | sed 's/parsnp //': | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
| authors: | ||
| - "@emmcauley" | ||
| maintainers: | ||
| - "@emmcauley" | ||
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,120 @@ | ||
| nextflow_process { | ||
|
|
||
| name "Test Process PARSNP" | ||
| script "../main.nf" | ||
| process "PARSNP" | ||
| config "./nextflow.config" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "parsnp" | ||
|
|
||
| test("candidatus_portiera_aleyrodidarum - fasta") { | ||
| when { | ||
| params { | ||
| module_args = '' | ||
| } | ||
| process { | ||
| """ | ||
| def genome = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/genome/genome.fasta', checkIfExists: true) | ||
| def genome2 = genome.copyTo('portiera_2.fa') | ||
|
famosab marked this conversation as resolved.
|
||
|
|
||
| input[0] = [[ id:'test' ], [genome, genome2]] | ||
| input[1] = genome | ||
| """ | ||
| } | ||
| } | ||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(sanitizeOutput(process.out)).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("candidatus_portiera_aleyrodidarum - fasta - stub") { | ||
| options "-stub" | ||
|
|
||
| when { | ||
| params { | ||
| module_args = '' | ||
| } | ||
| process { | ||
| """ | ||
| def genome = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/genome/genome.fasta', checkIfExists: true) | ||
| def genome2 = genome.copyTo('portiera_2.fa') | ||
| input[0] = [[ id:'test' ], [genome, genome2]] | ||
| input[1] = genome | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(sanitizeOutput(process.out)).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| test("candidatus_portiera_aleyrodidarum - fasta - partition") { | ||
| when { | ||
| params { | ||
| module_args = '--min-partition-size 1' | ||
| } | ||
| process { | ||
| """ | ||
| def genome = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/genome/genome.fasta', checkIfExists: true) | ||
| def genome2 = genome.copyTo('portiera_2.fa') | ||
| def genome3 = genome.copyTo('portiera_3.fa') | ||
| input[0] = [[ id:'test' ], [genome, genome2, genome3]] | ||
| input[1] = genome | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot( | ||
| process.out.xmfa, | ||
| process.out.ggr, | ||
| process.out.snps_mblocks, | ||
| process.out.tree, | ||
|
emmcauley marked this conversation as resolved.
|
||
| process.out.versions_parsnp, | ||
| file(process.out.partition[0][1]).name | ||
| ).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| test("candidatus_portiera_aleyrodidarum - fasta - partition - stub") { | ||
| options "-stub" | ||
|
|
||
| when { | ||
| params { | ||
| module_args = '--min-partition-size 1' | ||
| } | ||
| process { | ||
| """ | ||
| def genome = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/genome/genome.fasta', checkIfExists: true) | ||
| def genome2 = genome.copyTo('portiera_2.fa') | ||
| def genome3 = genome.copyTo('portiera_3.fa') | ||
| input[0] = [[ id:'test' ], [genome, genome2, genome3]] | ||
| input[1] = genome | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(sanitizeOutput(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.
Uh oh!
There was an error while loading. Please reload this page.