Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhub committed Feb 20, 2024
1 parent 53ec715 commit 864be71
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 44 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^.*[.]png$
^CRAN-RELEASE$
^codecov\.yml$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/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

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {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

- 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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Description: Many complex diseases are known to be affected by the interactions
challenged by the high-dimensional nature of the study and the complexity of environmental
influences. We have developed a novel and powerful semi-parametric Bayesian variable
selection method that can accommodate linear and nonlinear G×E interactions simultaneously
(Ren et al. (2019) <arXiv:1906.01057>). Furthermore, the proposed method can conduct
(Ren et al. (2020) <doi:10.1002/sim.8434>). Furthermore, the proposed method can conduct
structural identification by distinguishing nonlinear interactions from main effects only
case within Bayesian framework. Spike-and-slab priors are incorporated on both individual
and group level to shrink coefficients corresponding to irrelevant main and interaction
Expand All @@ -21,10 +21,10 @@ License: GPL-2
Encoding: UTF-8
LazyData: true
LinkingTo: Rcpp, RcppArmadillo, testthat
Imports: Rcpp, splines, MASS, glmnet, utils, graphics, stats, ggplot2
Imports: Rcpp, splines, glmnet, utils, stats, ggplot2
URL: https://github.com/jrhub/spinBayes
BugReports: https://github.com/jrhub/spinBayes/issues
RoxygenNote: 7.1.0
RoxygenNote: 7.3.1
Suggests:
testthat (>= 2.1.0),
covr
26 changes: 14 additions & 12 deletions R/BVCFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,26 @@
#' Users can modify the hyper-parameters by providing a named list of hyper-parameters via the argument 'hyper'.
#' The list can have the following named components
#' \itemize{
#' \item{a.c, a.v, a.e: }{ shape parameters of the Gamma priors on \eqn{\lambda_{c}}, \eqn{\lambda_{v}} and \eqn{\lambda_{e}}, respectively.}
#' \item{b.c, b.v, b.e: }{ rate parameters of the Gamma priors on \eqn{\lambda_{c}}, \eqn{\lambda_{v}} and \eqn{\lambda_{e}}, respectively.}
#' \item{r.c, r.v, r.e: }{ shape parameters of the Beta priors (\eqn{\pi^{r-1}(1-\pi)^{w-1}}) on \eqn{\pi_{c}}, \eqn{\pi_{v}} and \eqn{\pi_{e}}, respectively.}
#' \item{w.c, w.v, w.e: }{ shape parameters of the Beta priors on \eqn{\pi_{c}}, \eqn{\pi_{v}} and \eqn{\pi_{e}}, respectively.}
#' \item{s: }{ shape parameters of the Inverse-gamma prior on \eqn{\sigma^{2}}.}
#' \item{h: }{ scale parameters of the Inverse-gamma prior on \eqn{\sigma^{2}}.}
#' \item a.c, a.v, a.e: shape parameters of the Gamma priors on \eqn{\lambda_{c}}, \eqn{\lambda_{v}} and \eqn{\lambda_{e}}, respectively.
#' \item b.c, b.v, b.e: rate parameters of the Gamma priors on \eqn{\lambda_{c}}, \eqn{\lambda_{v}} and \eqn{\lambda_{e}}, respectively.
#' \item r.c, r.v, r.e: shape parameters of the Beta priors (\eqn{\pi^{r-1}(1-\pi)^{w-1}}) on \eqn{\pi_{c}}, \eqn{\pi_{v}} and \eqn{\pi_{e}}, respectively.
#' \item w.c, w.v, w.e: shape parameters of the Beta priors on \eqn{\pi_{c}}, \eqn{\pi_{v}} and \eqn{\pi_{e}}, respectively.
#' \item s: shape parameters of the Inverse-gamma prior on \eqn{\sigma^{2}}.
#' \item h: scale parameters of the Inverse-gamma prior on \eqn{\sigma^{2}}.
#' }
#' Please check the references for more details about the prior distributions.
#'
#' @return an object of class "BVCfit" is returned, which is a list with components:
#' \item{posterior}{posterior samples from the MCMC}
#' \item{coefficients}{a list of posterior estimates of coefficients}
#' \item{burn.in}{the number of iterations for burn-in}
#' \item{iterations}{the number of MCMC iterations.}
#' \itemize{
#' \item posterior: posterior samples from the MCMC
#' \item coefficients: a list of posterior estimates of coefficients
#' \item burn.in: the number of iterations for burn-in
#' \item iterations: the number of MCMC iterations.
#' }
#'
#' @references
#' Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y., Wu, C. (2019) Semi-parametric Bayesian variable selection for gene-environment interactions.
#' \url{https://arxiv.org/abs/1906.01057}
#' Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y., Wu, C. (2020) Semiparametric Bayesian variable selection for gene-environment interactions.
#' {\emph{Statistics in Medicine}, 39(5): 617– 638} \url{https://doi.org/10.1002/sim.8434}
#'
#' @examples
#' data(gExp)
Expand Down
6 changes: 3 additions & 3 deletions R/BVSelection.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#' Please check the references for more details about the variable selection.
#'
#' @references
#' Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y., Wu, C. (2019) Semi-parametric Bayesian variable selection for gene-environment interactions.
#' \url{https://arxiv.org/abs/1906.01057}
#' Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y., Wu, C. (2020) Semiparametric Bayesian variable selection for gene-environment interactions.
#' {\emph{Statistics in Medicine}, 39(5): 617– 638} \url{https://doi.org/10.1002/sim.8434}
#'
#' Barbieri, M.M. and Berger, J.O. (2004). Optimal predictive model selection
#' \href{https://projecteuclid.org/euclid.aos/1085408489}{\emph{Ann. Statist}, 32(3):870–897}
#' {\emph{Ann. Statist}, 32(3):870–897}
#'
#' @rdname BVSelection
#' @return an object of class "BVSelection" is returned, which is a list with components:
Expand Down
9 changes: 7 additions & 2 deletions R/spinBayes-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#' @importFrom Rcpp sourceCpp
NULL

#' @docType package
#' @keywords overview
"_PACKAGE"

#' @name spinBayes-package
#' @title Semi-Parametric Gene-Environment Interaction via Bayesian Variable Selection
#' @aliases spinBayes-package
Expand All @@ -29,9 +30,13 @@ NULL
#' Wu, C., Jiang, Y., Ren, J., Cui, Y., Ma, S. (2018). Dissecting gene-environment interactions: A penalized robust approach accounting for hierarchical structures.
#' {\emph{Statistics in Medicine}, 37:437–456} \url{https://doi.org/10.1002/sim.7518}
#'
#' Wu, C., Zhong, P.-S., and Cui, Y. (2018). Additive varying–coefficient model for nonlinear gene–environment interactions.
#' Wu, C., Zhong, P.-S., and Cui, Y. (2018). Additive varying–coefficient model for nonlinear gene–
#' environment interactions.
#' {\emph{Statistical Applications in Genetics and Molecular Biology}, 17(2)}
#'
#' Jiang, Y., Huang, Y., Du, Y., Zhao, Y., Ren, J., Ma, S., Wu, C. (2017). Identification of prognostic genes and pathways in lung adenocarcinoma using a Bayesian Approach.
#' \emph{Cancer Informatics, 1(7)}
#'
#' Wu, C., Shi, X., Cui, Y. and Ma, S. (2015). A penalized robust semiparametric approach for gene-environment interactions.
#' {\emph{Statistics in Medicine}, 34 (30): 4016–4030} \url{https://doi.org/10.1002/sim.6609}
#'
Expand Down
26 changes: 14 additions & 12 deletions man/BVCfit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/BVSelection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions man/spinBayes-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed spinBayes.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## With R 3.1.0 or later, you can uncomment the following line to tell R to
## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
Expand All @@ -8,7 +8,7 @@
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
## CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
6 changes: 3 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## With R 3.1.0 or later, you can uncomment the following line to tell R to
## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
Expand All @@ -8,7 +8,7 @@
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
## CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
7 changes: 6 additions & 1 deletion src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// BVCStr
Rcpp::List BVCStr(arma::mat xx, arma::vec y, arma::mat W, arma::mat Ex, unsigned int s, unsigned int q, int maxSteps, arma::vec hatM, arma::vec hatR0, arma::vec hatRStar, arma::vec hatAlpha, arma::vec hatZeta, arma::vec hatInvSigM0, arma::vec hatInvTauSq0, arma::vec hatInvTauSqStar, arma::mat invSigAlpha0, arma::vec hatInvTauSqZeta, double hatLambdaSq0, double hatLambdaSqStar, double hatLambdaSqZeta, double hatSigmaSq, double a0, double b0, double aStar, double bStar, double alpha, double gamma, int progress);
RcppExport SEXP _spinBayes_BVCStr(SEXP xxSEXP, SEXP ySEXP, SEXP WSEXP, SEXP ExSEXP, SEXP sSEXP, SEXP qSEXP, SEXP maxStepsSEXP, SEXP hatMSEXP, SEXP hatR0SEXP, SEXP hatRStarSEXP, SEXP hatAlphaSEXP, SEXP hatZetaSEXP, SEXP hatInvSigM0SEXP, SEXP hatInvTauSq0SEXP, SEXP hatInvTauSqStarSEXP, SEXP invSigAlpha0SEXP, SEXP hatInvTauSqZetaSEXP, SEXP hatLambdaSq0SEXP, SEXP hatLambdaSqStarSEXP, SEXP hatLambdaSqZetaSEXP, SEXP hatSigmaSqSEXP, SEXP a0SEXP, SEXP b0SEXP, SEXP aStarSEXP, SEXP bStarSEXP, SEXP alphaSEXP, SEXP gammaSEXP, SEXP progressSEXP) {
Expand Down Expand Up @@ -368,7 +373,7 @@ BEGIN_RCPP
END_RCPP
}

RcppExport SEXP run_testthat_tests();
RcppExport SEXP run_testthat_tests(void);

static const R_CallMethodDef CallEntries[] = {
{"_spinBayes_BVCStr", (DL_FUNC) &_spinBayes_BVCStr, 28},
Expand Down

0 comments on commit 864be71

Please sign in to comment.