sh: fastq-dump: command not found
1
2
Entering edit mode
5.9 years ago
yejiahao0 ▴ 20

I encountered an error when invoking fastq-dump function from RStudio (using system(), following the instruction from an article from Nature Protocol (DOI: 10.1038/nprot.2013.099 or https://www.nature.com/articles/nprot.2013.099). The puzzling part is: fastq-dump cannot be found when invoked from RStudio, but executed perfectly OK when from the command line (see the codes below).

RStudio code

>system("pwd")

/Users/Yeats
> system("fastq-dump")

sh: fastq-dump: command not found
> sessionInfo()

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Command line code

Rs-MacBook-Pro:~ Yeats$ fastq-dump

Usage:
  fastq-dump [options] <path> [<path>...]
  fastq-dump [options] <accession>

Use option --help for more information

fastq-dump : 2.9.1

I guess the system() use a different searching directory than command line, but I couldn't identify the right nomenclature to get relevant results from Google search. BTW: sratoolkits was installed into the default directory with the conda: conda install sra-tools

Any suggestion of the problem itself or similar are verily welcome. Thank you very much for your time and help.

RNA-Seq R software error • 9.0k views
ADD COMMENT
0
Entering edit mode

This is a question, not a forum post. I've made the necessary changes. Also, Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

ADD REPLY
0
Entering edit mode

Thanks a lot for your tips Ram.

ADD REPLY
0
Entering edit mode

I'm unfamiliar with using R for this, but what does system("echo $PATH") show you? Is it different from your "shell $PATH"?

ADD REPLY
0
Entering edit mode

system(unix_command) is the same as running unix_command on the SHELL at getwd() location.

ADD REPLY
0
Entering edit mode

Since R-studio is not R, try the same in R. Launch R and try to run OP code. If it works, it is R-studio issue. If it is R-studio issue, launch OS terminal and type open -a RStudio within terminal. Check if r-studio still shows the issue.

ADD REPLY
0
Entering edit mode

Amazingly that R code works when launch RStudio from terminal. Thanks a lot for your tips! :)

ADD REPLY
0
Entering edit mode

this means Rstudio can't read user local env. Try to configure R studio to read local env.

ADD REPLY
1
Entering edit mode
5.9 years ago
Nitin Narwade ★ 1.6k

try to install sra-toolkit manually on your system (HowTo: Binary Installation). Then add the path of sra-toolkit bin folder to either ~/.bashrc or ~/.profile OR you can just export the same into an environmental variable $PATH using the export command as:

export PATH=/path/to/sra-toolkit/bin/:$PATH

Restart your R environment and check whether it is working or not.

In case, if it is not working try with giving an absolute path to fast-dump. You can do something like this;

system("/opt/program/sratoolkit.2.9.0-ubuntu64/bin/fastq-dump")
ADD COMMENT

Login before adding your answer.

Traffic: 1712 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6