R script from bin folder isn't executed

Hi there,
I’ve a bin folder under which I’ve put few scripts (bash and R).

The bash script is picked and executed with no issues. However, the R script isn’t executed.

My nextflow script is as:

echo $genes_samples"\n"
Rscript nflow_long_to_wide_mut.R


I get error as:

  Fatal error: cannot open file 'nflow_long_to_wide_mut.R': No such file or directory

It’s header as:

#!/usr/bin/env Rscript

Let me know if any other details are needed.

Hey @complexgenome

The magic behind the project bin folder is that Nextflow will add it to $PATH, so that when you run a program that is there, the operating system will know where the program is. When you run Rscript, Rscript would be this program, not the argument (R script filename). What you’re doing is almost right! :slight_smile: You have the shebang already (#!/usr/bin/env Rscript) so you just have to call your script in the Nextflow pipeline.

echo $genes_samples"\n"

Make sure it has execution permission (chmod +r).

Could you try this please?

I did try that, please see below error:

Command error:
  .command.sh: line 2: ./nflow_long_to_wide_mut.R: No such file or directory

I have executed chmod +r to the script and it is also chmod +x.

Then, I removed the ./ then it worked. I used nflow_long_to_wide_mut.R without any ./ or Rscript.

Thank you

Oh, sorry. You’re right, there’s no need to have the ./. Thanks for pointing this out! I just updated the answer :wink:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.