Skip to content

Installation

CREDTOOLS requires Python 3.9 or higher. The base installation includes all dependencies needed for fine-mapping analysis.

Basic Installation

To install the base CREDTOOLS package, run this command in your terminal:

$ pip install credtools

This is the preferred method to install CREDTOOLS, as it will always install the most recent stable release.

Development Installation

For development, you may want to install CREDTOOLS in "editable" mode:

$ git clone https://github.com/Jianhua-Wang/credtools.git
$ cd credtools
$ pip install -e .

Check that CREDTOOLS is installed correctly:

$ credtools --help

Conda Installation

You can also install CREDTOOLS using conda:

$ conda install -c conda-forge credtools

Source

The source for CREDTOOLS can be downloaded from the Github repo.

You can either clone the public repository:

$ git clone git://github.com/Jianhua-Wang/credtools

Or download the tarball:

$ curl -OJL https://github.com/Jianhua-Wang/credtools/tarball/master

Once you have a copy of the source, you can install it with:

$ cd credtools
$ pip install -e .

External Tool Dependencies

Some fine-mapping tools in CREDTOOLS require external software to be installed separately. The core tools (SuSiE, ABF, MultiSuSiE, RSparsePro) are pure Python and work out of the box. The following tools need additional setup:

SuSiEx

SuSiEx requires a pre-compiled binary. See the SuSiEx documentation for installation instructions.

MESuSiE

MESuSiE (Multiple Ancestry Sum of Single Effects) is an R-based multi-ancestry fine-mapping tool. It requires R and the MESuSiE R package to be installed on your system.

Option 1: Native R Installation

Step 1: Install R

# Using Homebrew
brew install r
sudo apt-get update
sudo apt-get install r-base r-base-dev
sudo yum install R R-devel

Step 2: Install MESuSiE R package

MESuSiE depends on RcppArmadillo, which requires a Fortran compiler. Make sure gfortran is available:

# Install gfortran via gcc
brew install gcc

# Create ~/.R/Makevars to tell R where to find gfortran
mkdir -p ~/.R
cat > ~/.R/Makevars << 'EOF'
FC = /opt/homebrew/bin/gfortran
F77 = /opt/homebrew/bin/gfortran
FLIBS = -L/opt/homebrew/lib/gcc/current -lgfortran -lquadmath
EOF
sudo apt-get install gfortran
sudo yum install gcc-gfortran

Then install MESuSiE from GitHub:

# In R console
install.packages("devtools")
devtools::install_github("borangao/MESuSiE")

# Verify installation
library(MESuSiE)

Or from the command line:

Rscript -e 'install.packages("devtools", repos="https://cran.r-project.org")'
Rscript -e 'devtools::install_github("borangao/MESuSiE")'

# Verify
Rscript -e 'library(MESuSiE); cat("MESuSiE installed successfully\n")'

Option 2: Conda Environment

If you prefer using conda to manage R and its dependencies:

# Create a conda environment with R
conda create -n credtools_env python=3.12 r-base r-devtools r-rcpp r-rcpparmadillo -c conda-forge

# Activate the environment
conda activate credtools_env

# Install credtools
pip install credtools

# Install MESuSiE R package
Rscript -e 'devtools::install_github("borangao/MESuSiE")'

# Verify both are available
credtools --version
Rscript -e 'library(MESuSiE); cat("MESuSiE installed successfully\n")'

Conda Tips

  • Make sure to install r-rcpparmadillo from conda-forge to avoid Fortran compiler issues.
  • If devtools::install_github fails inside conda, try installing additional R packages first:
    conda install -c conda-forge r-rcpp r-rcpparmadillo r-nloptr r-ggplot2 r-cowplot r-ggrepel r-progress r-tidyr
    

Option 3: HPC / Module System

On HPC clusters with a module system:

# Load R module (exact name varies by cluster)
module load R/4.3.0
# or
module load r/4.3.0

# Install MESuSiE to a user library
Rscript -e 'devtools::install_github("borangao/MESuSiE")'

HPC Note

On some HPC systems, you may need to load additional modules (e.g., gcc, openblas) before compiling R packages with C++/Fortran code. Check your cluster's documentation or contact your sysadmin.

Verifying MESuSiE Setup

After installation, verify that CREDTOOLS can find MESuSiE:

# Check Rscript is on PATH
which Rscript

# Check MESuSiE is loadable
Rscript -e 'library(MESuSiE); cat("OK\n")'

If either command fails, CREDTOOLS will provide a clear error message with installation instructions when you try to run MESuSiE.

Troubleshooting

If you encounter any issues during installation, please check:

  1. Python version (3.9+ required)
  2. pip is up to date
  3. You have write permissions for the installation directory

MESuSiE-Specific Issues

Rscript not found: Ensure R is installed and Rscript is on your PATH. Run which Rscript to verify.

library 'gfortran' not found (macOS): Install gfortran via brew install gcc and create ~/.R/Makevars as described above.

ggrepel not available for this version of R: Install an older compatible version:

devtools::install_version("ggrepel", version = "0.9.6", repos = "https://cran.r-project.org")

RcppArmadillo compilation errors: Ensure you have a C++ compiler and Fortran compiler available. On macOS, install Xcode Command Line Tools (xcode-select --install) and gcc (brew install gcc).