Skip to content

Latest commit

 

History

History
167 lines (113 loc) · 5.88 KB

rpackage.md

File metadata and controls

167 lines (113 loc) · 5.88 KB

Installing the MS-DAP R package

This guide helps you install the MS-DAP R package and all of its software dependencies on your computer. If you are looking for the Dockerized MS-DAP, use this guide.

Note that recent updates to some dependencies (e.g. variancePartition) of MS-DAP have changed requirements to R version 4.3 (or later). So when installing MS-DAP for the first time (i.e. required packages are not installed yet), you may find that you need to update R first.

prequisites

Windows

You will need to install GIT, which is needed to automatically retrieve R packages from github.com (may not be installed on your system). Download and install this tool, available at https://gitforwindows.org

Ubuntu

(for Ubuntu 18.04 or older, see further https://github.com/ropensci/pdftools )

Linux installations require pandoc to be installed (guide at https://pandoc.org/installing.html ). Other requirements can be installed by;

sudo apt-get update
sudo apt-get install git libnetcdf-dev netcdf-bin libpoppler-cpp-dev libarchive-dev

Fedora

Linux installations require pandoc to be installed (guide at https://pandoc.org/installing.html ). Other requirements can be installed by;

sudo dnf install git netcdf-devel netcdf poppler-cpp-devel libarchive-devel

MacOS

first, install Homebrew if you haven’t: https://brew.sh

brew install git netcdf poppler automake
export PKG_CONFIG_PATH=/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig

troubleshooting

poppler is a requirement for pdftools to function, which is used by MS-DAP to create PDF reports, if you have any trouble installing please check these resources:

pandoc; If you run into issues on Linux or macOS that relate to tex/latex/Rmd files/markdown, either during installation of the MS-DAP R package or when creating a QC report with msdap::analysis_quickstart(), then try to (re)install pandoc (guide at https://pandoc.org/installing.html ).

installing R (if you have not already)

R version 4.3 or later is recommended. MS-DAP was tested with the recently released R version 4.4 (as well as older version 4.1)

Windows

If you do not have R installed yet, go to https://cloud.r-project.org/bin/windows/

  • download and install “base” R
  • download and install “Rtools”

Ubuntu

the latest R version is not available through the default/stable package repository. Recommended to install R as follows;

Download the R project’s public GPG key and install it:

wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/r-project.gpg

update APT sources

echo "deb [signed-by=/usr/share/keyrings/r-project.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee -a /etc/apt/sources.list.d/r-project.list

download latest available packages and install R

sudo apt update
sudo apt install --no-install-recommends r-base

print the installed R version

sudo -i R

Fedora

sudo dnf install R

MacOS

install RStudio Desktop

Download and install RStudio Desktop (free edition) from https://rstudio.com/products/rstudio/download/

install the MS-DAP R package

Start RStudio (restart if it was already up-and-running to get a clean session) and run below code line-by-line so you can keep an eye on the results of each intermediate step in the RStudio console.

Notes on windows;

  1. When prompted to optionally compile packages from source you can simply select ‘no’ (to install a readily available binary instead).
  2. As noted during the TinyTex installation, the two popup errors stating “The code execution cannot proceed because luatex.dll …” can be safely dismissed.
### 1) setup required R packages
install.packages(c("devtools", "tidyverse", "tinytex", "BiocManager"))
# install LaTeX which is required to create the pdf report (you can safely dismiss both popup errors)
tinytex::install_tinytex()
# install packages from bioconductor
BiocManager::install(c('ProtGenerics', 'MSnbase', 'limma'), update=T, ask=F)

### 2) install MS-DAP R package directly from github
# first, make sure we don't halt on minor issues that can be ignored (eg; your R installation is a minor version behind)
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true")
# install MS-DAP R package and all required dependencies (but don't check for updates on all packages, to minimize complexity)
devtools::install_github("ftwkoopmans/msdap", upgrade = "never")

# 3) if all went well, you can now load the msdap package.
library(msdap)

# If you get any warnings, no problem; you only need to be on the lookout for errors

general troubleshooting

  • If you encounter “installation path not writable” errors the user running R (/RStudio) may not have write access to the directory where the R packages are stored. Use the R command .libPaths() to print those locations.

    • For windows users, the most robust workaround is to start a command prompt as administrator (start > type cmd > right-click run as administrator), open a commandline R session (eg; on the cmd prompt, type "C:\Program Files\R\R-3.6.3\bin\R.exe") and retry your package installation.
  • Further documentation for TinyTex, in case you run into problems when installing it, is available at https://yihui.org/tinytex/

  • On systems with many CPU cores that run into errors related to “socketConnection” or “PSOCK” when running analysis_quickstart() for analyses that include MSqRob/MSqRobSum; try to set parameter multiprocessing_maxcores=8 to limit the amount of parallel threads initiated by MS-DAP.