Home > database >  R and sra toolkit - odd system() behavior
R and sra toolkit - odd system() behavior

Time:09-30

In order to extract some fastq data from NCBI's sequence read archive I've downloaded and installed the sra toolkit for Windows. In order to test if it is setup correctly, I opened cmd, navigated to the directory and typed in the command fasterq-dump --split-files SRR7647019. It downloads the file SRR7647019.sra as expected and splits it into fastq files.

Then I've tried the same command in RStudio, wrapping the system() command around it: system(fasterq-dump --split-files SRR7647019). However, R always returns

An error occured: unrecognized tool FASTER~2.EXE If this continues to happen, please contact the SRA Toolkit at https://trace.ncbi.nlm.nih.gov/Traces/sra/

as well as the number 75 (probably an error code).

Any idea why I'm not able to run fasterq-dump.exe from R? How could it be solved?

Thanks a lot for suggestions in advance!

CodePudding user response:

Tried the whole thing again, but this time with fasterq-dump-orig: system(fasterq-dump --split-files SRR7647019). And guess what ... it worked! Nevertheless, it would be nice to know why I'm able to exectue fasterq-dump-orig from R, but not fasterq-dum ...

CodePudding user response:

Sometimes it helps to call the terminal shell explicitly to bypass the environmental variables which might get overwritten by RStudio:

system("cmd.exe /k fasterq-dump --split-files SRR7647019")
  • Related