Skip to content
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

new module - bamstats generalstats #4474

Merged
merged 36 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6a1faf9
initial commit
johnoooh Nov 28, 2023
bd7c19f
commit to test
johnoooh Nov 28, 2023
f40ad18
added ::
johnoooh Nov 28, 2023
3f8c220
changed md5
johnoooh Nov 28, 2023
7b880bd
back to :
johnoooh Nov 28, 2023
ff62c81
added comments and md5
johnoooh Nov 28, 2023
22ad7bd
removed .
johnoooh Nov 28, 2023
4536a7c
added bamstats to a line
johnoooh Nov 28, 2023
879e2a5
spaces after colons
johnoooh Nov 28, 2023
37054da
colon issues
johnoooh Nov 28, 2023
1cb4aec
sed tests
johnoooh Nov 28, 2023
c2fbaa6
sed changes
johnoooh Nov 28, 2023
60a90c9
sed fix
johnoooh Nov 28, 2023
a843784
' fix
johnoooh Nov 28, 2023
2f18750
sed fix
johnoooh Nov 28, 2023
d637b9f
uising back
johnoooh Nov 28, 2023
00e5ce4
fix removed
johnoooh Nov 28, 2023
ac6f215
sed fixed hopefully
johnoooh Nov 28, 2023
3eb4250
md5 fix
johnoooh Nov 28, 2023
21d3db4
removed todo
johnoooh Nov 28, 2023
e386a8a
documentation added to meta.yml
johnoooh Nov 28, 2023
d7dba9f
removed todos
johnoooh Nov 28, 2023
df8f588
removed todo
johnoooh Nov 28, 2023
f0842bc
fixed whitespace
johnoooh Nov 28, 2023
97a8f9d
fix licence
johnoooh Nov 28, 2023
b25b904
whitespace
johnoooh Nov 29, 2023
5c807fe
whitespace again
johnoooh Nov 29, 2023
f38bcda
para change
johnoooh Dec 1, 2023
c6f5201
para change
johnoooh Dec 1, 2023
be4a330
md5 change
johnoooh Dec 1, 2023
b094fee
Update modules/nf-core/bamstats/generalstats/main.nf
johnoooh Nov 29, 2023
8b30104
todo removed
johnoooh Dec 1, 2023
3b98706
nf-test conversion
johnoooh Dec 1, 2023
4db0374
Fix bamstats module test.yml
emi80 Mar 18, 2024
2bbc59b
Migrate bamstats tests to nf-test
emi80 Mar 19, 2024
bfb30ff
Update bamstats/generalstats module and tests
emi80 Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/nf-core/bamstats/generalstats/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "bamstats_generalstats"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::bamstats=0.3.5"
51 changes: 51 additions & 0 deletions modules/nf-core/bamstats/generalstats/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process BAMSTATS_GENERALSTATS {
tag "$meta.id"
label 'process_single'
conda "bioconda::bamstats=0.3.5"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bamstats:0.3.5--he881be0_0':
'biocontainers/bamstats:0.3.5--he881be0_0' }"

input:
tuple val(meta), path(bam)

output:
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}"
// Several ARGS are available.
// -a is a helpfu; one where you can add a BED file
// -u, --uniq outputs genomic coverage statistics for uniqely mapped reads
"""
bamstats \\
-i $bam \\
$args \\
-c $task.cpus \\
-o ${prefix}.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamstats: \$(echo \$(bamstats --version 2>&1) | sed 's/^.*bamstats == version://; s/Using.*\$//' | sed 's/built.*//' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${prefix}.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamstats: \$(echo \$(bamstats --version 2>&1) | sed 's/^.*bamstats == version://; s/Using.*\$//' | sed 's/built.*//' )
END_VERSIONS
"""
}

46 changes: 46 additions & 0 deletions modules/nf-core/bamstats/generalstats/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
name: "bamstats_generalstats"
description: write your description here
keywords:
- bam
- statistics
- genomics
tools:
- "bamstats":
description: "A command line tool to compute mapping statistics from a BAM file"
homepage: "https://github.com/guigolab/bamstats/"
documentation: "https://github.com/guigolab/bamstats/"
tool_dev_url: "https://github.com/guigolab"
licence: ["BSD-3-clause"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`

- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- json:
type: file
description: json containing bam statistics
pattern: "*.json"

authors:
- "@johnoooh"
60 changes: 60 additions & 0 deletions modules/nf-core/bamstats/generalstats/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "bamstats"
tag "bamstats/generalstats"

test("sarscov2 - bam") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.json.get(0)[1]).exists() },
{ assert snapshot(process.out.versions).match("versions") }
)
}

}

test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.json.get(0)[1]).exists() },
{ assert snapshot(process.out.versions).match("versions_stub") }
)
}

}

}
26 changes: 26 additions & 0 deletions modules/nf-core/bamstats/generalstats/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/bamstats/generalstats/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bamstats/generalstats:
- "modules/nf-core/bamstats/generalstats/**"
Loading