Skip to content

Commit

Permalink
add install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Feb 14, 2022
1 parent c4de38a commit b05e5e5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ GPATH
*.pdf
*.o
PCAone*
mac.makefile
linux.makefile
*.makefile
external/*/*.a
*.dylib
/external/zstd/lib/*.a
Expand Down
24 changes: 14 additions & 10 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,31 @@ PCAone is a fast and memory efficient PCA tool implemented in C++ aiming at prov
See [[file:CHANGELOG.org][change log]] here.

- Has both Arnoldi and Halko methods with *out-of-core* implementation.
- Implement our new fast Halko algorithm with super power iterations for tera-scale dataset.
- Implement our new fast fancy Halko algorithm with super power iterations for tera-scale dataset.
- Quite fast with multi-threading support using high performance library [[https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html#gs.8jsfgz][MKL]] or [[https://www.openblas.net/][OpenBLAS]] as backend.
- Supports the [[https://www.cog-genomics.org/plink/1.9/formats#bed][PLINK]], [[https://www.well.ox.ac.uk/~gav/bgen_format][BGEN]], [[http://www.popgen.dk/angsd/index.php/Input#Beagle_format][Beagle]] genetic data formats.
- Supports [[https://github.com/Rosemeis/emu][EMU]] algorithm for scenario with large proportion of missingness.
- Supports [[https://github.com/Rosemeis/pcangsd][PCAngsd]] algorithm for low coverage sequencing scenario with genotype likelihood as input.
- Supports a general [[https://github.com/facebook/zstd][zstd]] compressed CSV format for scRNAs data

| *Input format* | bfile | bgen | beagle | csv |
| *Arnoldi method* | + | + | + | + |
| *One Pass Halko* | + | + | + | + |
| *Super fast Halko* | + | +/- | +/- | + |
| *EMU algorithm* | + | + | - | - |
| *PCAngsd algorithm* | - | + | + | - |
| *Out-of-core mode* | + | + | - | + |
| *Input format* | bfile | bgen | beagle | csv |
| *Arnoldi method* | + | + | + | + |
| *One Pass Halko* | + | + | + | + |
| *Fast fancy Halko* | + | +/- | +/- | + |
| *EMU algorithm* | + | + | - | - |
| *PCAngsd algorithm* | - | + | + | - |
| *Out-of-core mode* | + | + | - | + |


* Installation

** Via conda

You can install PCAone via =conda install -c bioconda pcaone=.
If you have conda installed, you can simply run the following command, which will download the MKL dependency for you and fix the runtime library automatically.

#+begin_src sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Zilong-Li/PCAone/main/install.sh)"
#+end_src

** Download binaries

Expand Down Expand Up @@ -126,7 +130,7 @@ PCAone --bfile input.plink -k 20 -n 20 -o out -h
PCAone --bfile input.plink -k 20 -n 20 -o out -h -m 2
#+end_src

- use super fast Halko method for crazy huge data set
- use fast fancy Halko method for crazy huge data set
#+begin_src shell
# running in RAM with fast Halko
PCAone --bfile input.plink -k 20 -n 20 -o out -f
Expand Down
53 changes: 53 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

##########
# first, this script will install mkl dependency via conda
# second, it will try to add or link libiomp5 into runtime path

set -e

version=0.1.5

abort() {
printf "%s\n" "$@"
exit 1
}

# get conda prefix
if [ ${CONDA_PREFIX} ];then
PREFIX=${CONDA_PREFIX}
else
PREFIX=$(conda info --base)
fi
echo "try to install dependency in the environment $PREFIX "
# install mkl via conda
#
conda install -c conda-forge -y mkl

# check OS.
OS="$(uname)"

if [[ "${OS}" == "Linux" ]]
then
system="Linux"
echo "download PCAone for ${system}"
url="https://github.com/Zilong-Li/PCAone/releases/download/v${version}/PCAone-v${version}_x64-${system}-iomp5.zip"
curl -OL $url && unzip "PCAone-v${version}_x64-${system}-iomp5.zip"
# download patchelf
conda install -c conda-forge -y patchelf
# add rpath
patchelf --set-rpath ${PREFIX}/lib PCAone
# try to link
[[ $? != 0 ]] && link -sf ${PREFIX}/lib/libiomp5.so /usr/local/lib

elif [[ "${OS}" == "Darwin" ]]
then
system="Mac"
echo "download PCAone for ${system}"
url="https://github.com/Zilong-Li/PCAone/releases/download/v${version}/PCAone-v${version}_x64-${system}-iomp5.zip"
curl -OL $url && unzip "PCAone-v${version}_x64-${system}-iomp5.zip"
# add rpath
install_name_tool -add_rpath ${PREFIX}/lib PCAone
# try to link
[[ $? != 0 ]] && link -sf ${PREFIX}/lib/libiomp5.dylib /usr/local/lib
fi

0 comments on commit b05e5e5

Please sign in to comment.