Bioconductor not working through Unix command line
1
1
Entering edit mode
6.1 years ago

I'm working through the Bioconductor book and am currently int he RNA-Seq statistics: R and Bioconductor section. I've actually used both R and Bioconductor before, but in Windows, not Linux.

I have R installed. If I try to run conda install r again, everything freezes up and I have to open up another window and sudo kill the process.

I did the following:

$ conda install -y bioconductor-deseq bioconductor-deseq2 bioconductor-edger r-gplots
Fetching package metadata .................
Solving package specifications: .

# All requested packages already installed.
# packages in environment at /home/moltres/miniconda3/envs/bioinfo:
#
bioconductor-deseq        1.24.0                 r3.3.2_0    bioconda
bioconductor-deseq2       1.16.1                 r3.3.2_0    bioconda
bioconductor-edger        3.16.5                 r3.3.2_0    bioconda
r-gplots                  2.17.0                 r3.3.2_0    bioconda
(bioinfo) 
$ curl -O http://data.biostarhandbook.com/rnaseq/code/deseq1.r
$ curl -O http://data.biostarhandbook.com/rnaseq/code/counts.txt
$ cat counts.txt | Rscript deseq1.r 3x3 > results_deseq1.txt
Error in library(DESeq) : there is no package called 'DESeq'
Execution halted

So even though I just downloaded DESeq, it says I don't have the DESeq package. I did check my R version, and it's 3.4.3. I suspect that could be a problem, but I don't know how to change it in Linux. When I try doing everything in RStudio, I get a bunch of errors in dependencies and configuration upon using biocLite("DESeq").

Any ideas what's going wrong? I would appreciate any help.

RNA-Seq statistics: R and Bioconductor R • 4.1k views
ADD COMMENT
1
Entering edit mode

What is the output of which Rscript? I have a hunch that the Rscript you're using there is not the Rscript from anaconda

ADD REPLY
0
Entering edit mode
$ which Rscript
/home/moltres/miniconda3/envs/bioinfo/bin/Rscript

Okay. How do I know if it's from anaconda? Is it in the wrong directory? Thanks for the response. Still trying to figure this out.

Also, if it counts for anything I tried to uninstall everything. I did...

$ sudo apt-get --purge remove r-base
$ sudo apt-get --purge remove r-base-dev
$ sudo apt-get --purge remove r-base-core

I also went into /home/moltres/miniconda3/envs/bioinfo/bin/Rscript and deleted the R and RScript files. I tried to re-download R using conda install r.

It's still getting stuck and not downloading. I'm not really sure what else to do at this point...

ADD REPLY
0
Entering edit mode

Hm that's the correct Rscript -
By 'it's still getting stuck and not downloading', what do you mean? Anaconda is not doing anything? The R installation is big and may take a long while to resolve dependencies in ananonda

Edit: An idea: Have you tried installing DESeq and DESeq the non-Anaconda way?

Start R using 'R', then copy paste:

source("https://bioconductor.org/biocLite.R")
biocLite('DESeq')
biocLite("DESeq2")
biocLite("edgeR")

That will install DESeq, DESeq2 into your anaconda-installed R, maybe that'll do it?

I tried to reproduce your error but I'm not even getting that far :D I'm getting heaps of segmentation faults haha

ADD REPLY
0
Entering edit mode

So, it turns out that I'm just impatient, and R did download. I have good and bad news.

When I try to run the Rscript in command line, it still fails.

    $ cat counts.txt | Rscript deseq1.r 3x3 > results_deseq1.txt
bash: /usr/bin/Rscript: No such file or directory
(bioinfo) 

$ Rscript
bash: /usr/bin/Rscript: No such file or directory
(bioinfo) 

$ which Rscript
/home/moltres/miniconda3/envs/bioinfo/bin/Rscript
(bioinfo) 

$ which R
/home/moltres/miniconda3/envs/bioinfo/bin/R
(bioinfo)

However, when I open RStudio, I can now install DESeq, and do library(DESeq) without getting error telling me that the directory is wrong. However, when I try to open the deseq1.r script, it tells me "No such file or directory." However, I checked the working directory, and the file is in the same folder as my working directory. I tried to look up this error, and it told me to save it with encoding UTF-8 encoding and re-open it. Tried it. Didn't work. I can't even open a new script window--it won't let me type anything. Do you know of any way to troubleshoot this?

ADD REPLY
1
Entering edit mode

Just for future reference if anyone ever has this issue, I've mostly fixed it now. For some reason, bash thinks R is in one place, even though it also knows it's in another. I don't really get it.

ANYWAY.

If I run the command where it specifies Rscript in the correct place:

$ cat counts.txt | /home/moltres/miniconda3/envs/bioinfo/bin/Rscript deseq1.r 3x3 > results_deseq1.txt

Then this works perfectly. I get the output file.

I've also uninstalled Rstudio, and then reinstalled it using

$ conda install rstudio

The same way I did when I re-downloaded R.

If I want to run rstudio, just typing rstudio in command line doesn't work. I had to type in the full location again.

HOWEVER...if I closed my terminal, then opened a new terminal and ran

$ source activate bioinfo

again, it started working if I just typed rstudio.

So now R seems to be cooperating with everyone else, and they're all a big happy family trying to teach me bioinformatics. And also patience. Unfortunately, I'm not great at either.

Thanks for the help, everyone!

ADD REPLY
1
Entering edit mode

For some reason, bash thinks R is in one place, even though it also knows it's in another. I don't really get it.

bash looks at the environment variable PATH, whichever comes first in PATH is used first, so if you have

PATH=/usr/bin/:/home/kependleton/anaconda/bin

then bash will use the system R. You can check this using echo $PATH.

A workaround is to flip the order, or to put the anaconda one first:

Either:

export PATH=/home/kependleton/anaconda/bin/:/usr/bin/

or:

export PATH=/home/kependleton/anaconda/bin/:$PATH
ADD REPLY
0
Entering edit mode

Ah. Thanks! I'll try to keep this in mind. I struggle looking for solutions to some easy issues since I don't have the right language yet to properly say what's going wrong.

ADD REPLY
0
Entering edit mode
6.1 years ago
Arindam Ghosh ▴ 510

I am not sure about the way you are using it. But I use the tools within R. The packages were installed within R as mentioned in the Bioconductor support page here. For doing any statistical analysis I write an Rscript and execute in terminal or do it one by one within R terminal. And I thing to remember I need to load each libraries using library() function.

ADD COMMENT
0
Entering edit mode

It should work, if as Philipp Bayer mentioned the Rscript is the one in anaconda/bin, which it probably isn't. Changing the order of $PATH may help. As you can see from the error message the Rscript uses library(DESeq), so that part is alright.

ADD REPLY

Login before adding your answer.

Traffic: 2878 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