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

TaskPath.name includes directory from stageAs: #3574

Closed
julibeg opened this issue Jan 26, 2023 · 5 comments · Fixed by #4189
Closed

TaskPath.name includes directory from stageAs: #3574

julibeg opened this issue Jan 26, 2023 · 5 comments · Fixed by #4189

Comments

@julibeg
Copy link

julibeg commented Jan 26, 2023

Bug report

Expected behavior and actual behavior

When staging an input file in a subdirectory with input: path x, stageAs: 'my-dir/*', then x.name gives my-dir/filename instead of just filename.

Steps to reproduce the problem

process my_proc {
    input: path x, stageAs: 'my-dir/*'
    script:
    print(x.name)
    """
    """
}

workflow {
    Channel.fromPath('my-file.txt')
    | my_proc
}

Program output

N E X T F L O W  ~  version 22.10.6
Launching `test.nf` [loving_saha] DSL2 - revision: 978d464ef2
executor >  local (1)
[a9/f4d7cf] process > my_proc (1) [100%] 1 of 1 ✔
my-dir/my-file.txt

Environment

  • Nextflow version: 22.10.6
  • Java version: openjdk version "17.0.3-internal" 2022-04-19
  • Operating system: Ubuntu
  • Bash version: GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
@bentsherman
Copy link
Member

It looks like TaskPath just has a slightly different API from Path. The getName() method returns the entire filename. You can get the base name with x.fileName.name.

I will make a note to document TaskPath in the Nextflow docs.

@julibeg
Copy link
Author

julibeg commented Jan 26, 2023

I see, thanks for clarifying!

@julibeg
Copy link
Author

julibeg commented Jan 26, 2023

is there a difference between x.fileName.name and x.alias?

@bentsherman
Copy link
Member

Yes, x.alias is equivalent to x.name so it's not what you want.

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants