{% set name = "r-saige" %}
{% set version = "0.42.1" %}
{% set vcommit = "29d4426dd4ae62c50fa7ce96794ec302f9d44b1b" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  # url: https://github.com/weizhouUMICH/SAIGE/archive/{{ version }}.tar.gz
  url: https://github.com/weizhouUMICH/SAIGE/archive/{{ vcommit }}.tar.gz
  sha256: 9f11d71eedccc435dccb4fe941579e4150b0c8f3f7c12f8cff2e3f5fedf0fd33
  patches:
    # Fixing shared lib issues
    - patches/0001-use-shared-libs-in-makevars.patch
    # - patches/0358-use-shared-libs-in-makevars-0.35.8.patch
    # - patches/0002-fix-rcpp-returns.patch
    - patches/0003-fix-gettimeofday-import.patch
    - patches/0004-fix-paths-of-imported-libs-should-never-use-path.patch

build:
  skip: true  # [win]
  number: 0
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - {{ compiler('fortran') }}
  host:
    - r-base {{ r_base }}
    - bgenix 1.1.4
    - boost-cpp
    - r-spatest 3.1.2
    - r-rcpp
    - r-rcpparmadillo
    - r-rcppparallel
    - r-metaskat
    - r-skat
    - r-devtools
    - r-matrix
    - r-data.table
    - r-rcppeigen
    - r-bh
    - r-optparse
    - liblapack
    - libopenblas  # [osx]
    - libblas  # [linux]
    - superlu
    - savvy
    - zstd
    - zlib
  run:
    - r-base {{ r_base }}
    - boost-cpp
    - bgenix 1.1.4
    - savvy
    - r-rcpp
    - r-rcppparallel
    - r-matrix
    - r-data.table
    - r-optparse
    - liblapack
    - libopenblas  # [osx]
    - libblas  # [linux]
    - sqlite

test:
  commands:
    - $R -e "library('SAIGE')"
    - step1_fitNULLGLMM.R --help
    - step2_SPAtests.R --help
    - createSparseGRM.R --help

about:
  home: https://github.com/weizhouUMICH/SAIGE
  license: GNU GPL
  license_family: GPL3
  license_file: LICENSE
  summary: SAIGE is an R package with Scalable and Accurate Implementation of Generalized mixed model (Chen, H. et al. 2016)
  description: |
    SAIGE is an R package with Scalable and Accurate Implementation of Generalized
    mixed model (Chen, H. et al. 2016). It accounts for sample relatedness and is
    feasible for genetic association tests in large cohorts and biobanks (N > 400000).
  dev_url: https://github.com/weizhouUMICH/SAIGE

extra:
  recipe-maintainers:
    - matuskosut


# Saige (https://github.com/weizhouUMICH/SAIGE/)
# Versioning guide for builders
# 0.35.8.8: tagged
# 0.42.0: commit 19afee629fbfe1c450e57a717fc621cce17c8199
# 0.42.1: commit 29d4426dd4ae62c50fa7ce96794ec302f9d44b1b
