Download & Install BactMAP - veeninglab/BactMAP GitHub Wiki

Get started with R

BactMAP is an R package: a set of command-line functions which can be used in R. You can run R from command-line, but I recommend to download Rstudio Desktop as well, which makes it easier to see your data and generally keep track of what you are doing. A good, comprehensive explanation + instructions how to download and install R and Rstudio can be found here.

Prior knowledge of R is not necessary to use BactMAP, but it certainly helps speed up the learning curve. Find a good list of resources for getting to know R here.

Install BactMAP

R packages can be downloaded and installed from command line in Rstudio. When packages are approved by CRAN, the Comprehensive R Archive Network, you can do this using install.packages(). Because BactMAP is still in development, it is not submitted to CRAN yet. To download BactMAP from gitHub, you need the R package devtools to obtain the function install_github().

In your Rstudio console, first type the following to install devtools:

install.packages('devtools')

Then, install BactMAP:

devtools::install_github('veeninglab/bactMAP')

devtools will install BactMAP from github, but it will also check your installed packages for updates. Choose whether you want to update your packages when it asks for it.

If you run into errors when installing packages, you might have conflicting files in your R package library. Check this post for possible solutions and/or to leave comments/suggestions. When you are using a Mac and you get an error mentioning xcrun, check this post for instructions on solving this problem.

BactMAP uses other R packages to plot and arrange data. While ggplot2, plyr, utils, methods, stats, rlang and ggtree will automatically be installed upon installation of BactMAP, other packages will be prompted for installation when you need them.

Load BactMAP

To use BactMAP's functions, you need to load the package. Do this using the command library():

library(bactMAP)

Update BactMAP after updating R

The newest version of R, R4.0.0, requires re-installation of many packages, also BactMAP, on your computer. If you start with a new, empty package library, you can just do this using the normal installation procedure above. However, this might take a while and you will have to re-install all the previously installed dependent packages as well.

As an alternative, you can take your old packages with you and update them:

  1. update R to R4.0.0
  2. copy your old packages from your old package library folder (folder looks something like ..\R\win-library\3.xx in windows) to your new package library (..\R\win-library\4.0). If you don't know where your R packages are, you can use the command .libPaths() in R to find them.
  3. run:
update.packages(checkBuilt=TRUE, ask=FALSE)