nextflow-io / nextflow-io/nextflow
file.getName() doesn't strip the parent directory as described in the documentation.
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 3.5k
- Forks
- 811
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 61
Description
Bug report
Expected behavior and actual behavior
When using the getName() method on TaskPath objects, it should just output the filename and not the parent directory if the file gets staged in a subdirectory of a process. The actual behaviour is that getName provides the full staged path, unlike getBaseName which does strip the parent directory.
Steps to reproduce the problem
workflow {
TASK( Channel.fromPath(['data/sampleA.ext.gz','data/sampleB.ext.gz','data/sampleC.ext.gz']).collect() )
.view()
}
process TASK {
input:
path files_in, stageAs: 'zipped/*'
script:
"""
echo "${files_in*.name}"
echo "${files_in*.baseName}"
"""
output:
stdout
}
Program output
$ nextflow run main.nf
N E X T F L O W ~ version 24.10.4
Launching `main.nf` [big_davinci] DSL2 - revision: b223d1ff7a
executor > local (1)
[c0/b424af] process > TASK [100%] 1 of 1 ✔
[zipped/sampleA.ext.gz, zipped/sampleB.ext.gz, zipped/sampleC.ext.gz]
[sampleA.ext, sampleB.ext, sampleC.ext]
Environment
- Nextflow version: 24.10.4
- Java version: openjdk 17.0.14-internal 2025-01-21
- Operating system: Linux
- Bash version: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TaskPath getName() entry point and reproduce the behavior with the supplied Nextflow workflow, especially the stageAs: 'zipped/*' input. Done means getName() outputs only the filename for staged files, while the existing getBaseName() behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100