Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
7 changes: 7 additions & 0 deletions modules/nf-core/plastid/make_wiggle/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::plastid=0.6.1
64 changes: 64 additions & 0 deletions modules/nf-core/plastid/make_wiggle/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
process PLASTID_MAKE_WIGGLE {
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/plastid:0.6.1--py39had3e4b6_2':
'biocontainers/plastid:0.6.1--py39had3e4b6_2' }"

input:
tuple val(meta), path(bam), path(bam_index), path(p_offsets)
val min_length
val output_format
val fiveprime_variable

output:
tuple val(meta), path("*.{wig,bedgraph}"), emit: tracks
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def extension = output_format == "bedgraph" ? "bedgraph" : "wig"
def args = task.ext.args ?: ""
if (fiveprime_variable) args += "--fiveprime_variable"
"""
make_wiggle \\
--count_files "$bam" \\
--offset "$p_offsets" \\
--min_length "$min_length" \\
--output_format "$output_format" \\
--verbose \\
-o "$prefix" \\
$args

sed -i '/^##/d' *.wig # remove variable comment header

if [ "$output_format" = "bedgraph" ]; then
for FILE in *.wig; do
mv "\$FILE" "\${FILE%.wig}.bedgraph"
done
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plastid: 0.6.1
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def extension = output_format == "bedgraph" ? "bedgraph" : "wig"
"""
touch ${prefix}_fw.$extension
touch ${prefix}_rc.$extension

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plastid: 0.6.1
END_VERSIONS
"""
}
80 changes: 80 additions & 0 deletions modules/nf-core/plastid/make_wiggle/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "plastid_make_wiggle"
description: Create wiggle or bedGraph files from alignment files after
applying a read mapping rule (e.g. to map ribosome-protected footprints at
their P-sites), for visualization in a genome browser
keywords:
- genomics
- riboseq
- psite
- wiggle
- bedgraph
tools:
- "plastid":
description: "Nucleotide-resolution analysis of next-generation sequencing and genomics data"
homepage: "https://github.com/joshuagryphon/plastid"
documentation: "https://plastid.readthedocs.io/en/latest/"
tool_dev_url: "https://github.com/joshuagryphon/plastid"
doi: "http://dx.doi.org/10.1186/s12864-016-3278-x"
licence: ["BSD-3-clause"]
identifier: biotools:plastid

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- bam:
type: file
description: Genome BAM file
pattern: "*.bam"
ontologies:
- edam: http://edamontology.org/format_2572 # BAM
- bam_index:
type: file
description: Genome BAM index file
pattern: "*.bai"
ontologies:
- edam: http://edamontology.org/format_3327 # BAI
- p_offsets:
type: file
description: Selected p-site offset for each read length (output from plastid_psites)
pattern: "*_p_offsets.txt"
ontologies: []
- min_length:
type: integer
description: Minimum length of reads to consider
- output_format:
type: string
description: `variable_step` or `bedgraph`
- fiveprime_variable:
type: boolean
description: |
Map read alignment to a variable offset from 5' position of read, with
offset determined by read length
output:
tracks:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.${extension}":
type: file
description: wig/bedgraph tracks for forward and reverse strands
pattern: "*.${extension}"
ontologies:
- edam: http://edamontology.org/format_3005 # wig
- edam: http://edamontology.org/format_3583 # bedgraph
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
authors:
- "@suhrig"
maintainers:
- "@suhrig"
69 changes: 69 additions & 0 deletions modules/nf-core/plastid/make_wiggle/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// nf-core modules test plastid
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "plastid"
tag "plastid/make_wiggle"

test("human chr20 bam") {

when {
process {
"""
input[0] = [
[ id:'SRX11780887' ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam.bai", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/plastid/SRX11780887_p_offsets.txt", checkIfExists: true)
]
input[1] = 23 // min_length
input[2] = 'variable_step' // output_format
input[3] = true // fiveprime_variable
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.tracks).match('wig') },
{ assert snapshot(process.out.versions).match('versions') }
)
}
}

test("human chr20 bam -stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'SRX11780887' ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam.bai", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/plastid/SRX11780887_p_offsets.txt", checkIfExists: true)
]
input[1] = 23 // min_length
input[2] = 'variable_step' // output_format
input[3] = true // fiveprime_variable
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.tracks).match('wig_stub') },
{ assert snapshot(process.out.versions).match('versions_stub') }
)
}
}

}
66 changes: 66 additions & 0 deletions modules/nf-core/plastid/make_wiggle/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"versions_stub": {
"content": [
[
"versions.yml:md5,4ecd455575ab11a0ad86dc5e0a6c6959"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-12-04T21:33:55.015767252"
},
"wig": {
"content": [
[
[
{
"id": "SRX11780887"
},
[
"SRX11780887_fw.wig:md5,647f8b1b990e3a7f13f761bad68646fe",
"SRX11780887_rc.wig:md5,17955523d22a9d9bc67a39228cdda343"
]
]
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-12-04T21:33:49.241128201"
},
"versions": {
"content": [
[
"versions.yml:md5,4ecd455575ab11a0ad86dc5e0a6c6959"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-12-04T21:33:49.263313286"
},
"wig_stub": {
"content": [
[
[
{
"id": "SRX11780887"
},
[
"SRX11780887_fw.wig:md5,d41d8cd98f00b204e9800998ecf8427e",
"SRX11780887_rc.wig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-12-04T21:33:55.001327109"
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/plastid/metagene_generate/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::plastid=0.6.1
44 changes: 44 additions & 0 deletions modules/nf-core/plastid/metagene_generate/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
process PLASTID_METAGENE_GENERATE {
tag "$gtf"
label "process_low"

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/plastid:0.6.1--py39had3e4b6_2':
'biocontainers/plastid:0.6.1--py39had3e4b6_2' }"

input:
path gtf
val landmark

output:
path "*_rois.txt" , emit: rois_txt
path "*_rois.bed" , emit: rois_bed
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
"""
metagene generate "${gtf.baseName}" --landmark "$landmark" --annotation_files "$gtf" $args
sed -i '/^##/d' *_rois.* # remove variable comment header

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plastid: 0.6.1
END_VERSIONS
"""

stub:
"""
touch ${gtf.baseName}_rois.txt
touch ${gtf.baseName}_rois.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plastid: 0.6.1
END_VERSIONS
"""
}
Loading