A lot of our blogs start as questions from our users. So don’t fret about asking questions! It’s hard, we know, we were there too. But know we’re here to help ^_^.
Hi Sheri,
I’ve never installed anything from GitHub to the cluster on my own… how should I go about installing sambamba (to mark PCR duplicates)? Do I need to submit a ticket for this?
Thanks,
<Grad Student>
Hey,
Oops! You’ve been doing so well I more or less forgot you haven’t been doing this a while ^_^. Also, I cannot believe we don’t have to install things from GitHub blog. Going to kill two tasks with one stone!
Git Releases:
In this case, it is very similar to what you have done before: I googled “sambamba” and clicked on the first link, then the Downloads page, which brought me here: https://github.com/biod/sambamba/releases
If you right-click the “Source code (tar.gz)” link and copy the link address.. you can just do “wget <paste web link>” and it will download a tar for you. This is sometimes the procedure, particularly if they want you to grab the code (usually in the form of a tarball) from the Releases. I don’t run into this much, but some people do for sure.
Git Clones:
However, since we’re on the topic of git, here’s the general procedure for installing something from GitHub (i.e.: https://github.com/vika19/R_Workshop):
- click the green button that says “clone or download”.
- click the clipboard to copy (do people even know what clipboards are anymore?)
- “git clone <paste the link>” wherever you’d like to place it.
- done!
This will give you a folder called whatever the repo is called (i.e. R_Workshop) that contains the same files and organization as what you see on GitHub.
A note on where to install things:
I don’t know if I mentioned this before, but for the sake of completeness and your sanity:
I recommend having a sane organization of installed programs or you are going to not be very happy in the long run. I always make a “local” folder in my home dir. Then, whenever I am installing things, I do so inside of “$HOME/local”. programs tend to install in a set of common folders–shared/, bin/, lib/. If those folders already exist, the programs just append to them. So the useful folders for all programs are in $HOME/local/shared, $HOME/local/bin, $HOME/local/lib… “$HOME/local/” is the prefix to all the useful installation folders… meaning:
./configure --prefix=$HOME/local/
will install all of your stuff in the same place, every time.
NOTE: Do not use prefix=$HOME/local/bin, which is a common mistake, as that will install in $HOME/local/bin/shared, $HOME/local/bin/bin, $HOME/local/bin/lib…
I also use “local” to dump all my git clones, etc. Then I add $HOME/local/bin to my PATH, and almost everything runs without full path. I also use $HOME/local/ to dump my git clone folders, but you do have to add those individually to PATH.
This is by no means the only way to do it, but what I recommend as a starting point.
Good luck,
Sheri Sanders
Bioinformatic Analyst
National Center for Genome Analysis and Support (NCGAS)
NCGAS is a management unit of the Research Technologies division of UITS; NCGAS is affiliated with the Indiana University Pervasive Technology Institute.
Bonus Material:Git for R:
I am running into more and more R packages distributed by git as well. The above client doesn’t use R, however, this is useful general knowledge. So, for the sake of completeness, here an example of installing Google Maps into R:
if(!requireNamespace("devtools")) install.packages("devtools"); devtools::install_github("dkahle/ggmap", ref = "tidyup", force=TRUE); #Load the library library("ggmap")
Where things install in R:
The R_LIBS variable stores the location of where your packages library is (for install and loading), so you can point it to different places easily.
To start, you want to see what is in the variable to start with. This is a very good idea on a cluster or shared system, as we use this R_LIBS variable to point the computer to our bioconductor libraries, for instance. We also use it to point to the MAIN R libraries, since they are not installed in the default root directory (common on a cluster). If you overwrite R_LIBS, you may run into some strange errors as R will have suddenly forgotten how to do things like… math.
echo $R_LIBS #display default location
Note: You can also check this inside R, using “.libPaths()”.
If nothing comes up, that is likely because the main R packages are installed in a default directory, and you don’t have a local library for your own installations yet. If you do not set this variable ahead of time, R will install into $HOME/.R/.
You can set it ahead of time with:
export R_LIBS=$R_LIBS:/wherever/youd/like/.R
This will specify locations R will try to install packages into but also sets for where R will look for new packages being loaded. If you want this setting to be permanent, you can add it to your ~/.bashrc file.
There are a lot more things to do with git, but that should get you started using code you find there!