Skip to content

Extract mutation ancestral states in Python #787

Extract mutation ancestral states in Python

Extract mutation ancestral states in Python #787

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: R-CMD-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
# vignette rendering is switched off though because of:
# - https://github.com/tidyverse/ggplot2/issues/2252#issuecomment-1006713187
# - https://github.com/lcolladotor/biocthis/issues/27
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
# - name: Set NOT_CRAN=false on Windows
# if: runner.os == 'Windows'
# run: |
# echo "NOT_CRAN=false" >> $GITHUB_ENV
# shell: bash
- name: Install rgdal dependencies (macOS)
if: runner.os == 'macOS'
run: brew install gdal
- name: Install ADMIXTOOLS dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install libopenblas-dev libgsl-dev liblapack-dev
- name: Install ADMIXTOOLS dependencies (macOS)
if: runner.os == 'macOS'
run: brew install openblas gsl lapack bedtools
- name: Compile and install ADMIXTOOLS (Linux) # + macOS)
# if: runner.os != 'Windows'
if: runner.os == 'Linux'
run: |
# create a single directory for all external software
mkdir -p ~/deps
cd ~/deps
# download and unpack the ADMIXTOOLS source code
curl -LO https://github.com/DReichLab/AdmixTools/archive/v7.0.2.tar.gz
tar xf v7.0.2.tar.gz
cd AdmixTools-7.0.2
# set compiler flags (compilation on macOS was failing unable to find
# openblas library files)
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
# compile ADMIXTOOLS and move binaries under bin/
cd src
make clobber
make LDLIBS="-llapack" all
make install
# # download testing data for unit tests
# cd ../
# curl -LO https://reich.hms.harvard.edu/sites/reich.hms.harvard.edu/files/inline-files/AdmixTools_Example_Data.tar_.gz
# tar xf AdmixTools_Example_Data.tar_.gz
#
# # run the Perl script with tests for the compiled binaries
# cd examples
# # fix unportable Perl shebang
# if [[ "$OSTYPE" == "darwin"* ]]; then
# sed -i '' "1s/.*/\#\!\/usr\/bin\/env perl -w/" mklog
# else
# sed -i "1s/.*/\#\!\/usr\/bin\/env perl/" mklog
# fi
# ./mklog
# cd ../
# we need to do this in bash because of $OSTYPE above
shell: bash
- name: Compile and install SLiM on Unix
if: runner.os != 'Windows'
run: |
# download SLiM into a separate directory to avoid CRAN errors
mkdir -p ~/deps
cd ~/deps
# installation instructions copied from the SLiM manual:
wget https://github.com/MesserLab/SLiM/releases/download/v4.2/SLiM.zip
unzip SLiM.zip
cd SLiM
cmake .
make slim
- name: Populate PATH with compiled binaries on Unix
if: runner.os != 'Windows'
run: |
export PATH="$HOME/deps/SLiM:$HOME/deps/AdmixTools-7.0.2/bin:$PATH"
echo "PATH=$PATH" >> ~/.Renviron
- name: Install SLiM on Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-slim-simulator
bash
- name: Install pandoc on Windows
if: runner.os == 'Windows'
run: |
install.packages("gh", repos = "http://cran.rstudio.com")
install.packages("pandoc", repos = "http://cran.rstudio.com")
pandoc::pandoc_install()
shell: Rscript {0}
#- name: Check ming64/bin contents
# if: runner.os == 'Windows'
# run: |
# dir ${{ runner.temp }}\msys64\mingw64\bin
# shell: cmd
#- name: Check usr/bin contents
# if: runner.os == 'Windows'
# run: dir ${{ runner.temp }}\msys64\usr\bin
# shell: cmd
- name: Populate PATH with compiled binaries on Windows
if: runner.os == 'Windows'
run: |
writeLines(
paste0(
"PATH=D:/a/_temp/msys64/mingw64/bin",
"\n",
"RSTUDIO_PANDOC=", normalizePath(dirname(pandoc::pandoc_bin()), winslash = "/"),
"\n",
"GTIFF_SRS_SOURCE=EPSG # silence GDAL warning"
),
con = paste0(normalizePath(path.expand("~"), winslash = "/"), "/.Renviron"))
shell: Rscript {0}
# The Windows GDAL GitHub Actions warning solved by setting 'GTIFF_SRS_SOURCE' above
# is actually not the first time this happened, interesting:
# https://github.com/bodkan/slendr/blob/3e02fa2ad7fb085ccbcc23df518bca6b72e782b1/R/compilation.R#L730
# - name: Check PATHs
# if: runner.os == 'Windows'
# run: |
# cat(Sys.getenv("PATH"), "\n")
# cat(Sys.getenv("RSTUDIO_PANDOC"), "\n")
# shell: Rscript {0}
- name: Set R_LIBS path on unix
if: runner.os == 'Windows'
run: |
mkdir ~/R_LIBS
echo "GTIFF_SRS_SOURCE='EPSG'" >> ~/.Renviron
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
- name: Setup dedicated Python environment for slendr
run: |
install.packages("reticulate", repos = "http://cran.rstudio.com")
reticulate::install_miniconda()
deps <- c("msprime==1.3.3", "tskit==0.5.8", "pyslim==1.0.4")
PYTHON_ENV <- paste0("Python-3.12_", paste(gsub("==", "-", c(deps, "tspop==0.0.2")), collapse = "_"))
reticulate::conda_create(envname = PYTHON_ENV, python_version = '3.12')
reticulate::use_condaenv(PYTHON_ENV, required = TRUE)
reticulate::conda_install(envname = PYTHON_ENV, packages = c("msprime==1.3.1", "tskit==0.5.6"), pip = FALSE)
reticulate::conda_install(envname = PYTHON_ENV, packages = c("tspop==0.0.2", "pyslim==1.0.4", "pyarrow"), pip = TRUE)
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/check-r-package@v2