Skip to content

Commit 9a87948

Browse files
committed
plastid metagene_generate, make_wiggle, psite
1 parent 5bee37f commit 9a87948

File tree

15 files changed

+941
-0
lines changed

15 files changed

+941
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- bioconda::plastid=0.6.1
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
process PLASTID_MAKE_WIGGLE {
2+
tag "$meta.id"
3+
label "process_single"
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7+
'https://depot.galaxyproject.org/singularity/plastid:0.6.1--py39had3e4b6_2':
8+
'biocontainers/plastid:0.6.1--py39had3e4b6_2' }"
9+
10+
input:
11+
tuple val(meta), path(bam)
12+
tuple val(meta2), path(bam_index)
13+
tuple val(meta3), path(p_offsets)
14+
val min_length
15+
val output_format
16+
val fiveprime_variable
17+
18+
output:
19+
tuple val(meta), path("*.{wig,bedgraph}"), emit: tracks
20+
path "versions.yml", emit: versions
21+
22+
when:
23+
task.ext.when == null || task.ext.when
24+
25+
script:
26+
def prefix = task.ext.prefix ?: "${meta.id}"
27+
def extension = output_format == "bedgraph" ? "bedgraph" : "wig"
28+
def args = task.ext.args ?: ""
29+
if (fiveprime_variable) args += "--fiveprime_variable"
30+
"""
31+
make_wiggle \\
32+
--count_files "$bam" \\
33+
--offset "$p_offsets" \\
34+
--min_length "$min_length" \\
35+
--output_format "$output_format" \\
36+
--verbose \\
37+
-o "$prefix" \\
38+
$args
39+
40+
sed -i '/^##/d' *.wig # remove variable comment header
41+
42+
if [ "$output_format" = "bedgraph" ]; then
43+
for FILE in *.wig; do
44+
mv "\$FILE" "\${FILE%.wig}.bedgraph"
45+
done
46+
fi
47+
48+
cat <<-END_VERSIONS > versions.yml
49+
"${task.process}":
50+
plastid: 0.6.1
51+
END_VERSIONS
52+
"""
53+
54+
stub:
55+
def prefix = task.ext.prefix ?: "${meta.id}"
56+
def extension = output_format == "bedgraph" ? "bedgraph" : "wig"
57+
"""
58+
touch ${prefix}_fw.$extension
59+
touch ${prefix}_rc.$extension
60+
61+
cat <<-END_VERSIONS > versions.yml
62+
"${task.process}":
63+
plastid: 0.6.1
64+
END_VERSIONS
65+
"""
66+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
2+
name: "plastid_make_wiggle"
3+
description: Create wiggle or bedGraph files from alignment files after
4+
applying a read mapping rule (e.g. to map ribosome-protected footprints at
5+
their P-sites), for visualization in a genome browser
6+
keywords:
7+
- genomics
8+
- riboseq
9+
- psite
10+
- wiggle
11+
- bedgraph
12+
tools:
13+
- "plastid":
14+
description: "Nucleotide-resolution analysis of next-generation sequencing and genomics data"
15+
homepage: "https://github.com/joshuagryphon/plastid"
16+
documentation: "https://plastid.readthedocs.io/en/latest/"
17+
tool_dev_url: "https://github.com/joshuagryphon/plastid"
18+
doi: "http://dx.doi.org/10.1186/s12864-016-3278-x"
19+
licence: ["BSD-3-clause"]
20+
identifier: biotools:plastid
21+
22+
input:
23+
- - meta:
24+
type: map
25+
description: |
26+
Groovy Map containing sample information
27+
e.g. `[ id:'sample1', single_end:false ]`
28+
- bam:
29+
type: file
30+
description: Genome BAM file
31+
pattern: "*.bam"
32+
ontologies:
33+
- edam: http://edamontology.org/format_2572 # BAM
34+
- - meta2:
35+
type: map
36+
description: |
37+
Groovy Map containing sample information
38+
e.g. `[ id:'sample1', single_end:false ]`
39+
- bam_index:
40+
type: file
41+
description: Genome BAM index file
42+
pattern: "*.bai"
43+
ontologies:
44+
- edam: http://edamontology.org/format_3327 # BAI
45+
- - meta3:
46+
type: map
47+
description: |
48+
Groovy Map containing sample information
49+
e.g. `[ id:'sample1', single_end:false ]`
50+
- p_offsets:
51+
type: file
52+
description: Selected p-site offset for each read length (output from plastid_psites)
53+
pattern: "*_p_offsets.txt"
54+
ontologies: []
55+
- min_length:
56+
type: integer
57+
description: Minimum length of reads to consider
58+
- output_format:
59+
type: string
60+
description: `variable_step` or `bedgraph`
61+
- fiveprime_variable:
62+
type: boolean
63+
description: |
64+
Map read alignment to a variable offset from 5' position of read, with
65+
offset determined by read length
66+
output:
67+
tracks:
68+
- - meta:
69+
type: map
70+
description: |
71+
Groovy Map containing sample information
72+
e.g. `[ id:'sample1', single_end:false ]`
73+
- "*.${extension}":
74+
type: file
75+
description: wig/bedgraph tracks for forward and reverse strands
76+
pattern: "*.${extension}"
77+
ontologies:
78+
- edam: http://edamontology.org/format_3005 # wig
79+
- edam: http://edamontology.org/format_3583 # bedgraph
80+
versions:
81+
- versions.yml:
82+
type: file
83+
description: File containing software versions
84+
pattern: "versions.yml"
85+
ontologies:
86+
- edam: http://edamontology.org/format_3750 # YAML
87+
authors:
88+
- "@suhrig"
89+
maintainers:
90+
- "@suhrig"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// nf-core modules test plastid
2+
nextflow_process {
3+
4+
name "Test Process PLASTID_MAKE_WIGGLE"
5+
script "../main.nf"
6+
process "PLASTID_MAKE_WIGGLE"
7+
8+
tag "modules"
9+
tag "modules_nfcore"
10+
tag "plastid"
11+
tag "plastid/make_wiggle"
12+
13+
test("human chr20 bam") {
14+
15+
when {
16+
process {
17+
"""
18+
input[0] = [
19+
[ id:'SRX11780887' ], // meta map
20+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam", checkIfExists: true)
21+
]
22+
input[1] = [
23+
[ id:'SRX11780887' ], // meta map
24+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam.bai", checkIfExists: true)
25+
]
26+
input[2] = [
27+
[ id:'SRX11780887' ], // meta map
28+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/plastid/SRX11780887_p_offsets.txt", checkIfExists: true)
29+
]
30+
input[3] = 23 // min_length
31+
input[4] = 'variable_step' // output_format
32+
input[5] = true // fiveprime_variable
33+
"""
34+
}
35+
}
36+
37+
then {
38+
assertAll(
39+
{ assert process.success },
40+
{ assert snapshot(process.out.tracks).match('wig') },
41+
{ assert snapshot(process.out.versions).match('versions') }
42+
)
43+
}
44+
}
45+
46+
test("human chr20 bam -stub") {
47+
48+
options "-stub"
49+
50+
when {
51+
process {
52+
"""
53+
input[0] = [
54+
[ id:'SRX11780887' ], // meta map
55+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam", checkIfExists: true)
56+
]
57+
input[1] = [
58+
[ id:'SRX11780887' ], // meta map
59+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887_chr20.bam.bai", checkIfExists: true)
60+
]
61+
input[2] = [
62+
[ id:'SRX11780887' ], // meta map
63+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/plastid/SRX11780887_p_offsets.txt", checkIfExists: true)
64+
]
65+
input[3] = 23 // min_length
66+
input[4] = 'variable_step' // output_format
67+
input[5] = true // fiveprime_variable
68+
"""
69+
}
70+
}
71+
72+
then {
73+
assertAll(
74+
{ assert process.success },
75+
{ assert snapshot(process.out.tracks).match('wig_stub') },
76+
{ assert snapshot(process.out.versions).match('versions_stub') }
77+
)
78+
}
79+
}
80+
81+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"versions_stub": {
3+
"content": [
4+
[
5+
"versions.yml:md5,4ecd455575ab11a0ad86dc5e0a6c6959"
6+
]
7+
],
8+
"meta": {
9+
"nf-test": "0.9.3",
10+
"nextflow": "25.10.0"
11+
},
12+
"timestamp": "2025-12-01T08:21:20.834995954"
13+
},
14+
"wig": {
15+
"content": [
16+
[
17+
[
18+
{
19+
"id": "SRX11780887"
20+
},
21+
[
22+
"SRX11780887_fw.wig:md5,647f8b1b990e3a7f13f761bad68646fe",
23+
"SRX11780887_rc.wig:md5,17955523d22a9d9bc67a39228cdda343"
24+
]
25+
]
26+
]
27+
],
28+
"meta": {
29+
"nf-test": "0.9.3",
30+
"nextflow": "25.10.0"
31+
},
32+
"timestamp": "2025-12-01T08:21:14.597903696"
33+
},
34+
"versions": {
35+
"content": [
36+
[
37+
"versions.yml:md5,4ecd455575ab11a0ad86dc5e0a6c6959"
38+
]
39+
],
40+
"meta": {
41+
"nf-test": "0.9.3",
42+
"nextflow": "25.10.0"
43+
},
44+
"timestamp": "2025-12-01T08:21:14.614712687"
45+
},
46+
"wig_stub": {
47+
"content": [
48+
[
49+
[
50+
{
51+
"id": "SRX11780887"
52+
},
53+
[
54+
"SRX11780887_fw.wig:md5,d41d8cd98f00b204e9800998ecf8427e",
55+
"SRX11780887_rc.wig:md5,d41d8cd98f00b204e9800998ecf8427e"
56+
]
57+
]
58+
]
59+
],
60+
"meta": {
61+
"nf-test": "0.9.3",
62+
"nextflow": "25.10.0"
63+
},
64+
"timestamp": "2025-12-01T08:21:20.817255625"
65+
}
66+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- bioconda::plastid=0.6.1
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
process PLASTID_METAGENE_GENERATE {
2+
tag "$gtf"
3+
label "process_low"
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7+
'https://depot.galaxyproject.org/singularity/plastid:0.6.1--py39had3e4b6_2':
8+
'biocontainers/plastid:0.6.1--py39had3e4b6_2' }"
9+
10+
input:
11+
path gtf
12+
val landmark
13+
14+
output:
15+
path "*_rois.txt" , emit: rois_txt
16+
path "*_rois.bed" , emit: rois_bed
17+
path "versions.yml", emit: versions
18+
19+
when:
20+
task.ext.when == null || task.ext.when
21+
22+
script:
23+
def args = task.ext.args ?: ''
24+
"""
25+
metagene generate "${gtf.baseName}" --landmark "$landmark" --annotation_files "$gtf" $args
26+
sed -i '/^##/d' *_rois.* # remove variable comment header
27+
28+
cat <<-END_VERSIONS > versions.yml
29+
"${task.process}":
30+
plastid: 0.6.1
31+
END_VERSIONS
32+
"""
33+
34+
stub:
35+
"""
36+
touch ${gtf.baseName}_rois.txt
37+
touch ${gtf.baseName}_rois.bed
38+
39+
cat <<-END_VERSIONS > versions.yml
40+
"${task.process}":
41+
plastid: 0.6.1
42+
END_VERSIONS
43+
"""
44+
}

0 commit comments

Comments
 (0)