diff --git a/DESCRIPTION b/DESCRIPTION index 14f222ec..893a01a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,6 +27,8 @@ Depends: R (>= 4.2.0), pandaR, yarn, matrixcalc +Remotes: + stan-dev/cmdstanr biocViews: NetworkInference, Network, @@ -35,37 +37,41 @@ biocViews: Transcription, Microarray, GraphAndNetwork -Imports: RCy3, - viridisLite, - STRINGdb, - Biobase, - GOstats, - AnnotationDbi, - matrixStats, - GO.db, - org.Hs.eg.db, - Matrix, - gplots, - nnet, - data.table, - vegan, - stats, - utils, - reshape, - reshape2, - penalized, - parallel, - doParallel, - foreach, - ggplot2, - ggdendro, - grid, - MASS, - assertthat, - tidyr, - methods, - dplyr, - graphics +Imports: + RCy3, + viridisLite, + STRINGdb, + Biobase, + GOstats, + AnnotationDbi, + matrixStats, + GO.db, + org.Hs.eg.db, + Matrix, + gplots, + nnet, + data.table, + vegan, + stats, + utils, + reshape, + reshape2, + penalized, + parallel, + doParallel, + foreach, + ggplot2, + ggdendro, + grid, + MASS, + assertthat, + tidyr, + methods, + dplyr, + graphics, + cmdstanr, + GeneNet, + loo License: GPL-3 Encoding: UTF-8 LazyData: false @@ -73,7 +79,8 @@ Suggests: testthat (>= 2.1.0), knitr, rmarkdown, - pkgdown + pkgdown, + dorothea VignetteEngine: knitr VignetteBuilder: knitr RoxygenNote: 7.2.3 diff --git a/R/TIGER.R b/R/TIGER.R index 5afab26a..db4398e5 100644 --- a/R/TIGER.R +++ b/R/TIGER.R @@ -51,6 +51,9 @@ #' @export #' #' @examples +#' data(TIGER_expr) +#' data(TIGER_prior) +#' TIGER(TIGER_expr,TIGER_prior) TIGER = function(expr,prior,method="VB", signed=TRUE,baseline=TRUE,psis_loo = FALSE, seed=123,out_path=NULL,out_size = 300, @@ -67,6 +70,8 @@ TIGER = function(expr,prior,method="VB", if (signed){ prior = prior.pp(prior[TF.name,TG.name],expr) P = prior + TF.name = rownames(P) + TG.name = colnames(P) }else{ P = prior[TF.name,TG.name] } @@ -173,7 +178,6 @@ TIGER = function(expr,prior,method="VB", #' @return An adjacency matrix with rows as TFs and columns as genes. #' @export #' -#' @examples el2adj = function(el){ el = as.data.frame(el) all.A = unique(el[,1]) @@ -194,7 +198,6 @@ el2adj = function(el){ #' second column is gene name, and third column is edge weight. #' @export #' -#' @examples adj2el = function(adj){ el = matrix(NA,nrow(adj)*ncol(adj),3) el[,1]=rep(row.names(adj), ncol(adj)) @@ -216,7 +219,6 @@ adj2el = function(adj){ #' @return A VIPER required regulon object #' @export #' -#' @examples el2regulon = function(el) { regulon_list = split(el, el$from) viper_regulons = lapply(regulon_list, function(regulon) { @@ -234,7 +236,6 @@ el2regulon = function(el) { #' @return A VIPER required regulon object. #' @export #' -#' @examples adj2regulon = function(adj){ el = adj2el(adj) el = el[el[,3]!=0,] @@ -251,7 +252,6 @@ adj2regulon = function(adj){ #' @return A filtered prior network (adjacency matrix). #' @export #' -#' @examples prior.pp = function(prior,expr){ # filter tfs and tgs @@ -284,6 +284,28 @@ prior.pp = function(prior,expr){ } +#' TIGER example prior network +#' +#' @format ## `TIGER_prior` +#' A prior network matrix with 14 rows (TFs) and 1772 columns (genes) +#' +#' @source +#' @name TIGER_prior +#' @usage data(TIGER_prior) +"TIGER_prior" + +#' TIGER example expression matrix +#' +#' @format ## `TIGER_expr` +#' A gene expression matrix with 1780 rows (genes) and 16 columns (samples) +#' +#' @source +#' @name TIGER_expr +#' @usage data(TIGER_expr) +"TIGER_expr" + + + # stan model, conditional likelihood TIGER_C <- diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 00000000..4113feff --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,9 @@ + +.onLoad <- function(...) { + cmdstan_version <- cmdstanr::cmdstan_version(error_on_NA = FALSE) + if (is.null(cmdstan_version)) { + #stop("No CmdStan installation found. Run cmdstanr::install_cmdstan() to install.", call. = FALSE) + cmdstanr::check_cmdstan_toolchain(fix = TRUE) + cmdstanr::install_cmdstan() + } +} \ No newline at end of file diff --git a/data/TIGER_expr.rda b/data/TIGER_expr.rda new file mode 100644 index 00000000..87f98d29 Binary files /dev/null and b/data/TIGER_expr.rda differ diff --git a/data/TIGER_prior.rda b/data/TIGER_prior.rda new file mode 100644 index 00000000..f55fe35b Binary files /dev/null and b/data/TIGER_prior.rda differ diff --git a/man/TIGER.Rd b/man/TIGER.Rd index a759fa09..6b53fe44 100644 --- a/man/TIGER.Rd +++ b/man/TIGER.Rd @@ -69,3 +69,8 @@ density, which can be used for Bayesian stacking to handle multi-modality later. \description{ TIGER main function } +\examples{ +data(TIGER_expr) +data(TIGER_prior) +TIGER(TIGER_expr,TIGER_prior) +} diff --git a/man/TIGER_expr.Rd b/man/TIGER_expr.Rd new file mode 100644 index 00000000..d65fb4d2 --- /dev/null +++ b/man/TIGER_expr.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\docType{data} +\name{TIGER_expr} +\alias{TIGER_expr} +\title{TIGER example expression matrix} +\format{ +## `TIGER_expr` +A gene expression matrix with 1780 rows (genes) and 16 columns (samples) +} +\source{ + +} +\usage{ +data(TIGER_expr) +} +\description{ +TIGER example expression matrix +} +\keyword{datasets} diff --git a/man/TIGER_prior.Rd b/man/TIGER_prior.Rd new file mode 100644 index 00000000..c2a44b14 --- /dev/null +++ b/man/TIGER_prior.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\docType{data} +\name{TIGER_prior} +\alias{TIGER_prior} +\title{TIGER example prior network} +\format{ +## `TIGER_prior` +A prior network matrix with 14 rows (TFs) and 1772 columns (genes) +} +\source{ + +} +\usage{ +data(TIGER_prior) +} +\description{ +TIGER example prior network +} +\keyword{datasets}