/Racmacs

Racmacs R package for performing antigenic cartography (https://acorg.github.io/Racmacs)

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

Lifecycle: maturing

Racmacs

The Racmacs package provides a toolkit for making antigenic maps from assay data such as HI assays, as described in Smith et al. 2004.

For a general introduction to using Racmacs to make an antigenic map from titer data see the article Making an antigenic map from titer data. For documentation of the functions available see the references section.

Installation instructions

Install the devtools package

If not already installed, install the devtools package, this provides functions to help with installation.

install.packages("devtools")

Install Racmacs

Now you can install Racmacs directly from the latest development source code. In future pre-built binary versions will also be included.

# To build from github source
devtools::install_github("acorg/Racmacs")

Building Racmacs to run code in parallel

Racmacs uses OpenMP instructions to specify when code, for example map optimization runs, can be run in parallel to increase performance. The resulting speed-up can be significant, but you need to check whether the compiler you use supports OpenMP. The default compiler on mac systems for example is clang which does not support OpenMP and will compile Racmacs as a single-threaded program.

Luckily in these cases it is relatively easy to install to install an alternative compiler like gcc which does support OpenMP and will compile Racmacs as a multi-threaded program. To do this you need to first install gcc and then tell R that you would like to use the gcc compiler instead.

Installing gcc
The easiest way to install gcc is through homebrew. First download homebrew if you haven't already then simply run:

brew install gcc

This will then install the g++ compiler executable

Changing the default compiler in R
To change the default compiler in R, you can specify this in your local Makevars file. This exists in the .R folder in your home folder, i.e. ~/.R/Makevars. It is possible you will have to create the .R folder and the Makevars text file.

Once done, add the following lines to the Makevars file:

CXX=/usr/local/bin/g++-10
CXX1X=/usr/local/bin/g++-10
CXX11=/usr/local/bin/g++-10
SHLIB_CXXLD=/usr/local/bin/g++-10
FC=/usr/local/bin/gfortran-10
F77=/usr/local/bin/gfortran-10
MAKE=make -j8

SHLIB_OPENMP_CFLAGS=-fopenmp
SHLIB_OPENMP_CXXFLAGS=-fopenmp
SHLIB_OPENMP_FCFLAGS=-fopenmp
SHLIB_OPENMP_FFLAGS=-fopenmp

Now when you try and install and build the package from source things should be setup to use g++, with support for OpenMP parallization now included.