Skip to content

Commit

Permalink
Merge branch 'master' into add_new_module_vt_decompose_blocksub
Browse files Browse the repository at this point in the history
  • Loading branch information
kubranarci authored Dec 4, 2024
2 parents 0fa76cd + 6aed502 commit 14aaf9e
Show file tree
Hide file tree
Showing 30 changed files with 597 additions and 265 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/coptr/estimate/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::coptr=1.1.4"
47 changes: 47 additions & 0 deletions modules/nf-core/coptr/estimate/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process COPTR_ESTIMATE {
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/coptr:1.1.4--pyhdfd78af_3':
'biocontainers/coptr:1.1.4--pyhdfd78af_3' }"

input:
tuple val(meta), path(pkl, stageAs: "coverage_maps/*")

output:
tuple val(meta), path("*.csv"), emit: ptr
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}"
"""
coptr \\
estimate \\
$args \\
coverage_maps/ \\
ptrs.csv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.csv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/')
END_VERSIONS
"""
}
56 changes: 56 additions & 0 deletions modules/nf-core/coptr/estimate/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "coptr_estimate"
description: Calculates peak-to-through ratio (PTR) from metagenomic sequence data
keywords:
- coptr
- mapping
- ptr
tools:
- "coptr":
description: "Accurate and robust inference of microbial growth dynamics from
metagenomic sequencing reads."
homepage: "https://github.com/tyjo/coptr"
documentation: "https://coptr.readthedocs.io/"
tool_dev_url: "https://github.com/tyjo/coptr"
doi: "10.1101/gr.275533.121"
licence: ["GPL v3"]
identifier: biotools:coptr

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- pkl:
type: file
description: Python pickle file containing coverage maps
pattern: "*.pkl"
ontologies:
- edam: "http://edamontology.org/format_4002"

output:
- ptr:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.csv":
type: file
description: CSV table with rows as reference genomes, columns samples and entries as log2 PTR
pattern: "*.csv"
ontologies:
- edam: "http://edamontology.org/format_3752"

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@ramirobarrantes"
maintainers:
- "@ramirobarrantes"
71 changes: 71 additions & 0 deletions modules/nf-core/coptr/estimate/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
nextflow_process {

name "Test Process COPTR_ESTIMATE"
script "../main.nf"
process "COPTR_ESTIMATE"

tag "modules"
tag "modules_nfcore"
tag "coptr"
tag "coptr/extract"
tag "coptr/estimate"

setup {
run("COPTR_EXTRACT") {
script "../../extract/main.nf"
process {
"""
input[0] = [
[id:'test_0'],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true)
]
]
"""
}
}
}

test("coptr estimate from coverage maps file") {

when {
process {
"""
input[0] = COPTR_EXTRACT.out.coverage
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match()
}
)
}

}

test("coptr estimate from coverage maps file - stub") {

options "-stub"

when {
process {
"""
input[0] = COPTR_EXTRACT.out.coverage
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match()
}
)
}

}


}
68 changes: 68 additions & 0 deletions modules/nf-core/coptr/estimate/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"coptr estimate from coverage maps file - stub": {
"content": [
{
"0": [
[
{
"id": "test_0"
},
"test_0.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,5400eb14b9d1287f174065acd6c0c6a4"
],
"ptr": [
[
{
"id": "test_0"
},
"test_0.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,5400eb14b9d1287f174065acd6c0c6a4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-03T13:46:59.155895"
},
"coptr estimate from coverage maps file": {
"content": [
{
"0": [
[
{
"id": "test_0"
},
"ptrs.csv:md5,e94546e830fd9fdcd50e0e6c459f78e5"
]
],
"1": [
"versions.yml:md5,5400eb14b9d1287f174065acd6c0c6a4"
],
"ptr": [
[
{
"id": "test_0"
},
"ptrs.csv:md5,e94546e830fd9fdcd50e0e6c459f78e5"
]
],
"versions": [
"versions.yml:md5,5400eb14b9d1287f174065acd6c0c6a4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-11-29T18:28:40.680244"
}
}
3 changes: 1 addition & 2 deletions modules/nf-core/coptr/extract/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ process COPTR_EXTRACT {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
"${task.process}":
coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/')
coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/')
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/nf-core/coptr/extract/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
]
],
"1": [
"versions.yml:md5,578f185b99f7f5ba27eb2a9f44c1d6a9"
"versions.yml:md5,c6fcaf8fb6aa9c10a3192d81f9623d4f"
],
"coverage": [
[
Expand All @@ -94,14 +94,14 @@
]
],
"versions": [
"versions.yml:md5,578f185b99f7f5ba27eb2a9f44c1d6a9"
"versions.yml:md5,c6fcaf8fb6aa9c10a3192d81f9623d4f"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-02T19:26:21.856688"
"timestamp": "2024-12-03T13:50:47.572605"
}
}
1 change: 0 additions & 1 deletion modules/nf-core/coptr/merge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ process COPTR_MERGE {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
"${task.process}":
coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/')
END_VERSIONS
"""
Expand Down
8 changes: 4 additions & 4 deletions modules/nf-core/coptr/merge/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
]
],
"1": [
"versions.yml:md5,65562945dc1e8f43bfa9a6e244bbcdf2"
"versions.yml:md5,86e7803a1ea080ab5b7911c540dd1370"
],
"bam": [
[
Expand All @@ -22,15 +22,15 @@
]
],
"versions": [
"versions.yml:md5,65562945dc1e8f43bfa9a6e244bbcdf2"
"versions.yml:md5,86e7803a1ea080ab5b7911c540dd1370"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nextflow": "24.10.2"
},
"timestamp": "2024-11-23T14:54:29.748785"
"timestamp": "2024-12-03T13:52:20.557882"
},
"coptr merge single bam file": {
"content": [
Expand Down
30 changes: 17 additions & 13 deletions modules/nf-core/glimpse2/concordance/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ process GLIMPSE2_CONCORDANCE {

input:
tuple val(meta), path(estimate), path(estimate_index), path(truth), path(truth_index), path(freq), path(freq_index), path(samples), val(region)
tuple val(meta2), path(groups), val(bins), val(ac_bins), val(allele_counts)
val(min_val_gl)
val(min_val_dp)
tuple val(meta2), path(groups), val(bins), val(ac_bins), val(allele_counts), val(min_val_gl), val(min_val_dp)

output:
tuple val(meta), path("*.error.cal.txt.gz") , emit: errors_cal
Expand All @@ -26,17 +24,23 @@ process GLIMPSE2_CONCORDANCE {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def samples_cmd = samples ? "--samples ${samples}" : ""
def groups_cmd = groups ? "--groups ${groups}" : ""
def bins_cmd = bins ? "--bins ${bins}" : ""
def ac_bins_cmd = ac_bins ? "--ac-bins ${ac_bins}" : ""
def ale_ct_cmd = allele_counts ? "--allele-counts ${allele_counts}" : ""
def region_str = region instanceof List ? region.join('\\n') : region
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def samples_cmd = samples ? "--samples ${samples}" : ""
def groups_cmd = groups ? "--groups ${groups}" : ""
def bins_cmd = bins ? "--bins ${bins}" : ""
def ac_bins_cmd = ac_bins ? "--ac-bins ${ac_bins}" : ""
def ale_ct_cmd = allele_counts ? "--allele-counts ${allele_counts}" : ""
def min_val_gl_cmd = min_val_gl ? "--min-val-gl ${min_val_gl}" : ""
def min_val_dp_cmd = min_val_dp ? "--min-val-dp ${min_val_dp}" : ""
def region_str = region instanceof List ? region.join('\\n') : region

if (((groups ? 1:0) + (bins ? 1:0) + (ac_bins ? 1:0) + (allele_counts ? 1:0)) != 1) error "One and only one argument should be selected between groups, bins, ac_bins, allele_counts"

if (args.contains("--gt-val")) {
assert !(min_val_gl || min_val_dp) : "If --gt-val is set, --min-val-gl nor --min-val-dp must be set"
}

"""
printf '$region_str' > regions.txt
sed 's/\$/ $freq $truth $estimate/' regions.txt > input.txt
Expand All @@ -47,8 +51,8 @@ process GLIMPSE2_CONCORDANCE {
$bins_cmd \\
$ac_bins_cmd \\
$ale_ct_cmd \\
--min-val-gl $min_val_gl \\
--min-val-dp $min_val_dp \\
$min_val_gl_cmd \\
$min_val_dp_cmd \\
--input input.txt \\
--thread $task.cpus \\
--output ${prefix}
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/glimpse2/concordance/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ input:
description: |
Default allele count bins used for rsquared computations.
AN field must be defined in the frequency file.
- - min_val_gl:
- min_val_gl:
type: float
description: |
Minimum genotype likelihood probability P(G|R) in validation data.
Set to zero to have no filter of if using –gt-validation
- - min_val_dp:
- min_val_dp:
type: integer
description: |
Minimum coverage in validation data.
Expand Down
Loading

0 comments on commit 14aaf9e

Please sign in to comment.