Skip to content

Commit f8efd1b

Browse files
committed
deal with gz
1 parent 5f472c5 commit f8efd1b

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

perf/performance.nf

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def helpMessage() {
2727
nextflow run t/performance.nf [options]
2828
2929
Required parameters:
30-
--gff <file> Input GFF/GFF3 file to benchmark
30+
--gff <file> Input GFF/GFF3 file or URL to benchmark
31+
Can be a local file or URL (http://, https://, ftp://)
32+
Supports .gz compressed files (auto-decompressed)
3133
Default: ${params.gff}
3234
3335
Optional parameters:
@@ -52,6 +54,9 @@ def helpMessage() {
5254
# Full benchmark with multiple CPUs
5355
nextflow run t/performance.nf --gff myfile.gff3 --sizes 1000,5000,10000 --cpus 1,2,4,8
5456
57+
# Using a URL with compressed file
58+
nextflow run t/performance.nf --gff https://ftp.ensembl.org/pub/release-115/gff3/homo_sapiens/Homo_sapiens.GRCh38.115.chr.gff3.gz --sizes 1000,5000 --cpus 1
59+
5560
# Resume a previous run
5661
nextflow run t/performance.nf --gff myfile.gff3 --sizes 1000,5000 --cpus 1,2 -resume
5762
@@ -71,6 +76,22 @@ def cpus_list = (params.cpus instanceof List) ? params.cpus.collect{ it as Int
7176

7277
// Channels will be created within the workflow block for DSL2 correctness
7378

79+
// Decompress GFF file if compressed (.gz)
80+
process decompressGff {
81+
tag { "decompress" }
82+
input:
83+
path gff
84+
output:
85+
path "input.gff3"
86+
script:
87+
"""
88+
set -euo pipefail
89+
echo "Decompressing ${gff}..."
90+
gunzip -c ${gff} > input.gff3
91+
echo "Decompressed: \$(wc -l < input.gff3) lines"
92+
"""
93+
}
94+
7495
// Create subsets of the input GFF retaining headers and first N non-header lines
7596
process makeSubset {
7697
tag { "size:${size}" }
@@ -146,7 +167,16 @@ process aggregate {
146167
workflow {
147168
sizes_ch = Channel.fromList(sizes_list)
148169
cpus_ch = Channel.fromList(cpus_list)
149-
gff_ch = Channel.fromPath(params.gff)
170+
171+
// Channel.fromPath handles both local files and URLs
172+
gff_input = Channel.fromPath(params.gff)
173+
174+
// Decompress if .gz, otherwise use directly
175+
if (params.gff.endsWith('.gz')) {
176+
gff_ch = decompressGff(gff_input)
177+
} else {
178+
gff_ch = gff_input
179+
}
150180

151181
chunks_ch = makeSubset(sizes_ch, gff_ch.collect())
152182
metrics_ch = convertRun(chunks_ch, cpus_ch)

0 commit comments

Comments
 (0)