-
Notifications
You must be signed in to change notification settings - Fork 1k
Centrifuger quant #11234
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
base: master
Are you sure you want to change the base?
Centrifuger quant #11234
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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::centrifuger=1.1.0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| process CENTRIFUGER_CENTRIFUGER { | ||
| 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/centrifuger:1.1.0--hf426362_0': | ||
| 'quay.io/biocontainers/centrifuger:1.1.0--hf426362_0' }" | ||
|
|
||
| input: | ||
| tuple val(meta), path(reads) | ||
| path db | ||
| val save_unclassified | ||
| val save_classified | ||
| path barcode | ||
| path umi | ||
|
|
||
|
|
||
| output: | ||
| tuple val(meta), path("${meta.id}.tsv"), emit: classification_file | ||
| tuple val(meta), path("${meta.id}.classified*"), optional: true, emit: fastq_classified | ||
| tuple val(meta), path("${meta.id}.unclassified*"), optional: true, emit: fastq_unclassified | ||
| tuple val("${task.process}"), val('centrifuger'), eval("centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2 | sed 's/^v//'"),emit: versions_centrifuger, topic: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| def paired = meta.single_end ? "-u ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}" | ||
|
haris18s marked this conversation as resolved.
|
||
| // Optional outputs | ||
| def unclassified_arg = save_unclassified ? "--un ${prefix}.unclassified" : "" | ||
| def classified_arg = save_classified ? "--cl ${prefix}.classified" : "" | ||
| def barcode_arg = barcode ? "--barcode ${barcode}" : "" | ||
| def umi_arg = umi ? "--UMI ${umi}" : "" | ||
|
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 might be needed too.
Contributor
Author
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. i think they can pass through args right? is a STR not a file. |
||
|
|
||
|
|
||
| """ | ||
| db_name=`find -L ${db} -name "*.1.cfr" -not -name "._*" | sed 's/\\.1.cfr\$//'` | ||
|
|
||
| centrifuger \\ | ||
| -x \$db_name \\ | ||
| ${paired} \\ | ||
| ${unclassified_arg} \\ | ||
| ${classified_arg} \\ | ||
| ${barcode_arg} \\ | ||
| ${umi_arg} \\ | ||
| -t ${task.cpus} \\ | ||
| ${args} > ${prefix}.tsv | ||
|
|
||
| """ | ||
|
|
||
| stub: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
|
||
| """ | ||
| echo ${args} | ||
| #main output | ||
|
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. Do you need this line? |
||
| touch ${prefix}.tsv | ||
|
|
||
| #Optional outputs | ||
| if ${save_unclassified}; then | ||
|
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. Maybe the optional outputs can be moved after |
||
| if ${meta.single_end}; then | ||
| echo "" | gzip > ${prefix}.unclassified.fq.gz | ||
| else | ||
| echo "" | gzip > ${prefix}.unclassified_1.fq.gz | ||
| echo "" | gzip > ${prefix}.unclassified_2.fq.gz | ||
| fi | ||
| fi | ||
|
|
||
| if ${save_classified}; then | ||
| if ${meta.single_end}; then | ||
| echo "" | gzip > ${prefix}.classified.fq.gz | ||
| else | ||
| echo "" | gzip > ${prefix}.classified_1.fq.gz | ||
| echo "" | gzip > ${prefix}.classified_2.fq.gz | ||
| fi | ||
| fi | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| centrifuger: \$(centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2) | ||
| END_VERSIONS | ||
|
haris18s marked this conversation as resolved.
|
||
| """ | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: "centrifuger_centrifuger" | ||
| description: Classification of sequencing reads using the Centrifuger tool. | ||
| keywords: | ||
| - metagenomics | ||
| - classification | ||
| - centrifuger | ||
| tools: | ||
| - "centrifuger": | ||
| description: "Lossless compression of microbial genomes for efficient and accurate | ||
| metagenomic sequence classification." | ||
| homepage: "https://github.com/mourisl/centrifuger" | ||
| documentation: "https://github.com/mourisl/centrifuger" | ||
| tool_dev_url: "https://github.com/mourisl/centrifuger" | ||
| doi: "10.1186/s13059-024-03244-4" | ||
| licence: | ||
| - "MIT" | ||
| identifier: biotools:centrifuger | ||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: Groovy Map containing sample information. e.g. `[ | ||
| id:'sample1', single_end:false ]` | ||
| - reads: | ||
| type: file | ||
| description: | | ||
| List of input FastQ files of size 1 and 2 for single-end and paired-end, respectively. | ||
| pattern: "*.{fastq,fq,fastq.gz,fq.gz}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1930 #FASTQ | ||
| - db: | ||
| type: directory | ||
| description: Path to directory containing Centrifuger database files. | ||
| - save_unclassified: | ||
| type: boolean | ||
| description: | | ||
| Optional - if true, output unclassified reads. | ||
| - save_classified: | ||
| type: boolean | ||
| description: | | ||
| Optional - if true, output classified reads. | ||
| - barcode: | ||
| type: file | ||
| description: | | ||
| Optional barcode file. | ||
| - umi: | ||
| type: file | ||
| description: | | ||
| Optional UMI file. | ||
| output: | ||
| classification_file: | ||
| - - meta: | ||
| type: map | ||
| description: Groovy Map containing sample information. e.g. `[ | ||
| id:'sample1', single_end:false ]` | ||
| - ${meta.id}.tsv: | ||
| type: file | ||
| description: | | ||
| File contαining classification results | ||
| pattern: "${prefix}.tsv" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3475 #TSV | ||
|
|
||
| fastq_classified: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - ${meta.id}.classified*: | ||
| type: file | ||
| description: FASTQ file(s) containing classified reads | ||
| pattern: "*.{fastq,fq,fastq.gz,fq.gz}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1930 | ||
|
|
||
| fastq_unclassified: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - ${meta.id}.unclassified*: | ||
| type: file | ||
| description: FASTQ file(s) containing unclassified reads | ||
| pattern: "*.{fastq,fq,fastq.gz,fq.gz}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1930 | ||
| versions_centrifuger: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - centrifuger: | ||
| type: string | ||
| description: The name of the tool | ||
| - centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2 | sed 's/^v//': | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - centrifuger: | ||
| type: string | ||
| description: The name of the tool | ||
| - centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2 | sed 's/^v//': | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
| authors: | ||
| - "@haris18s" | ||
| maintainers: | ||
| - "@haris18s" | ||
| - "@sofstam" | ||
| - "@jfy133" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| nextflow_process { | ||
|
|
||
| name "Test Process CENTRIFUGER_CENTRIFUGER" | ||
| script "../main.nf" | ||
| process "CENTRIFUGER_CENTRIFUGER" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "centrifuger" | ||
| tag "centrifuger/centrifuger" | ||
| tag "untar" | ||
|
|
||
| setup { | ||
| run("UNTAR") { | ||
| script "../../../untar/main.nf" | ||
| process { | ||
| """ | ||
| input[0] = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/cfr_files_short.tar.gz', checkIfExists: true) ] | ||
| """ | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test("sarscov2 - fastq_single_end") { | ||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [[ id:'test', single_end: true ], | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) | ||
| ] | ||
| input[1] = UNTAR.out.untar.map{ it[1] } | ||
| input[2] = true | ||
| input[3] = true | ||
| input[4] = [] | ||
|
haris18s marked this conversation as resolved.
|
||
| input[5] = [] | ||
| """ | ||
| } | ||
| } | ||
| then { | ||
| assertAll( | ||
| {assert process.success }, | ||
| { assert snapshot( | ||
| file(process.out.classification_file[0][1]).name, | ||
| file(process.out.fastq_classified[0][1]).name, | ||
| file(process.out.fastq_unclassified[0][1]).name, | ||
| process.out.findAll { key, val -> key.startsWith('versions') } | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
| test("sarscov2 - fastq_paired_end") { | ||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test', single_end: false ], | ||
| [ | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) | ||
| ] | ||
| ] | ||
| input[1] = UNTAR.out.untar.map{ it[1] } | ||
| input[2] = true | ||
| input[3] = true | ||
| input[4] = [] | ||
| input[5] = [] | ||
| """ | ||
| } | ||
| } | ||
| then { | ||
| assertAll( | ||
| {assert process.success }, | ||
| { assert snapshot( | ||
| file(process.out.classification_file[0][1]).name, | ||
| process.out.fastq_classified[0][1].collect { file(it).name }, | ||
| process.out.fastq_unclassified[0][1].collect {file (it).name }, | ||
| process.out.findAll { key, val -> key.startsWith('versions') } | ||
| ).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
| test("sarscov2 - fastq_single_end_stub") { | ||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [[ id:'test', single_end: true ], | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) | ||
| ] | ||
| input[1] = UNTAR.out.untar.map{ it[1] } | ||
| input[2] = true | ||
| input[3] = true | ||
| input[4] = [] | ||
| input[5] = [] | ||
| """ | ||
| } | ||
| } | ||
| then { | ||
| assertAll( | ||
| {assert process.success }, | ||
| { assert snapshot( | ||
| file(process.out.classification_file[0][1]).name, | ||
| file(process.out.fastq_classified[0][1]).name, | ||
| file(process.out.fastq_unclassified[0][1]).name, | ||
| process.out.findAll { key, val -> key.startsWith('versions') } | ||
|
haris18s marked this conversation as resolved.
|
||
| ).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.