diff --git a/DESCRIPTION b/DESCRIPTION index ae683a44..14f222ec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: netZooR Type: Package Title: Unified methods for the inference and analysis of gene regulatory networks -Version: 1.3.25 +Version: 1.3.28 Date: 2023-03-27 Authors@R: c(person("Marouen", "Ben Guebila", email = "benguebila@hsph.harvard.edu", role = c("aut","cre"), comment = c(ORCID = "0000-0001-5934-966X")), diff --git a/NAMESPACE b/NAMESPACE index 99745492..851d8dcc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,8 @@ # Generated by roxygen2: do not edit by hand +export(TIGER) +export(adj2el) +export(adj2regulon) export(alpaca) export(alpacaCrane) export(alpacaExtractTopGenes) @@ -15,6 +18,8 @@ export(craneUnipartite) export(createCondorObject) export(createPandaStyle) export(dragon) +export(el2adj) +export(el2regulon) export(elistToAdjMat) export(lioness) export(lionessPy) @@ -36,6 +41,8 @@ export(pandaDiffEdges) export(pandaPy) export(pandaToAlpaca) export(pandaToCondorObject) +export(prior.pp) +export(puma) export(runEgret) export(sambar) export(sourcePPI) diff --git a/R/PUMA.R b/R/PUMA.R index 27f92eb1..f0f1549d 100644 --- a/R/PUMA.R +++ b/R/PUMA.R @@ -45,8 +45,9 @@ #' "coopNet" is the cooperative network which is not updated for miRNAs #' @examples #' data(pandaToyData) +#' mirs = c("AHR","AR","ARID3A","ARNT","BRCA1","CEBPA","CREB1","DDIT3") #' pumaRes <- puma(pandaToyData$motif, -#' pandaToyData$expression,NULL,hamming=.1,progress=TRUE) +#' pandaToyData$expression,NULL,mir_file=mirs,hamming=.1,progress=TRUE) #' @references #' Kuijjer, Marieke L., et al. "PUMA: PANDA using microRNA associations." Bioinformatics 36.18 (2020): 4765-4773. puma <- function(motif,expr=NULL,ppi=NULL,alpha=0.1,mir_file,hamming=0.001, @@ -238,11 +239,11 @@ puma <- function(motif,expr=NULL,ppi=NULL,alpha=0.1,mir_file,hamming=0.001, rownames(tfCoopNetwork) <- tf.names } - if(mir_file != NULL){ + if(!is.null(mir_file)){ mirIndex = match(mir_file,tf.names) tfCoopNetwork[mirIndex,] = 0 tfCoopNetwork[,mirIndex] = 0 - seqs = seq(1, num.tfs*num.tfs, num.tfs+1) + seqs = seq(1, num.TFs*num.TFs, num.TFs+1) tfCoopNetwork[seqs] <- 1 # tfCoopNetwork has now a diagonal of 1 and all entries are zeros # for miRNA-miRNA interactions and TF-miRNA interactions @@ -288,7 +289,7 @@ puma <- function(motif,expr=NULL,ppi=NULL,alpha=0.1,mir_file,hamming=0.001, geneCoreg=minusAlpha*geneCoreg + alpha*CoReg2 #PUMA step to skip update of PPI matrix for miRNA interactions - seqs = seq(1, num.tfs*num.tfs, num.tfs+1) + seqs = seq(1, num.TFs*num.TFs, num.TFs+1) savediag = tfCoopNetwork[seqs] # save diagonal tfCoopNetwork[mirIndex,] <- TFCoopInit[mirIndex,] tfCoopNetwork[,mirIndex] <- TFCoopInit[,mirIndex] @@ -422,4 +423,4 @@ prepResult <- function(zScale, output, regulatoryNetwork, geneCoreg, tfCoopNetwo } pandaObj <- setClass("panda", slots=c("regNet","coregNet","coopNet","numGenes","numTFs","numEdges")) -setMethod("show","panda",function(object){print.panda(object)}) +setMethod("show","panda",function(object){print.panda(object)}) \ No newline at end of file diff --git a/R/SPIDER.R b/R/SPIDER.R index 1ecb043d..e593819e 100644 --- a/R/SPIDER.R +++ b/R/SPIDER.R @@ -50,8 +50,8 @@ #' pandaToyData$epifilter = pandaToyData$motif #' nind=floor(runif(5000, min=1, max=dim(pandaToyData$epifilter)[1])) #' pandaToyData$epifilter[nind,3] = 0 -#' #spiderRes <- spider(pandaToyData$motif,pandaToyData$expression, -#' # pandaToyData$epifilter,pandaToyData$ppi,hamming=.1,progress=TRUE) +#' spiderRes <- spider(pandaToyData$motif,pandaToyData$expression, +#' pandaToyData$epifilter,pandaToyData$ppi,hamming=.1,progress=TRUE) #' @references #' Sonawane, Abhijeet Rajendra, et al. "Constructing gene regulatory networks using epigenetic data." npj Systems Biology and Applications 7.1 (2021): 1-13. spider <- function(motif,expr=NULL,epifilter=NULL,ppi=NULL,alpha=0.1,hamming=0.001, diff --git a/man/TIGER.Rd b/man/TIGER.Rd new file mode 100644 index 00000000..a759fa09 --- /dev/null +++ b/man/TIGER.Rd @@ -0,0 +1,71 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{TIGER} +\alias{TIGER} +\title{TIGER main function} +\usage{ +TIGER( + expr, + prior, + method = "VB", + signed = TRUE, + baseline = TRUE, + psis_loo = FALSE, + seed = 123, + out_path = NULL, + out_size = 300, + a_sigma = 1, + b_sigma = 1, + a_alpha = 1, + b_alpha = 1, + sigmaZ = 10, + sigmaB = 1 +) +} +\arguments{ +\item{expr}{A normalized log-transformed gene expressison matrix. Rows are genes +and columns are sampeles (cells).} + +\item{prior}{A prior regulatory network in adjacency matrix format. Rows are TFs +and columns target genes.} + +\item{method}{Method used for Bayesian inference. "VB" or "MCMC". Defaults to "VB".} + +\item{signed}{Prior network is signed or not. Defaults to TRUE.} + +\item{baseline}{Include baseline or not. Defaults to TRUE.} + +\item{psis_loo}{Use pareto smoothed importance sampling leave-one-out cross +validation to check model fitting or not. Defaults to FALSE.} + +\item{seed}{Seed for reproducible results. Defaults to 123.} + +\item{out_path}{(Optional) output path for CmdStanVB or CmdStanMCMC object. Defaults to NULL.} + +\item{out_size}{Posterior sampling size. Default = 300.} + +\item{a_sigma}{Hyperparameter of error term. Default = 1.} + +\item{b_sigma}{Hyperparameter of error term. Default = 1.} + +\item{a_alpha}{Hyperparameter of edge weight W. Default = 1.} + +\item{b_alpha}{Hyperparameter of edge weight W. Default = 1.} + +\item{sigmaZ}{Standard deviation of TF activity Z. Default = 10.} + +\item{sigmaB}{Standard deviation of baseline term. Default = 1.} +} +\value{ +A TIGER list object. +* W is the estimated regulatory network, but different from prior network, +rows are genes and columns are TFs. +* Z is the estimated TF activities, rows are TFs and columns are samples. +* TF.name, TG.name, and sample.name are the used TFs, target genes and samples. +* If psis_loo is TRUE, loocv is a table of psis_loo result for model checking. +* If psis_loo is TRUE, elpd_loo is the Bayesian LOO estimate of the expected log pointwise predictive +density, which can be used for Bayesian stacking to handle multi-modality later. +} +\description{ +TIGER main function +} diff --git a/man/adj2el.Rd b/man/adj2el.Rd new file mode 100644 index 00000000..67baa31a --- /dev/null +++ b/man/adj2el.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{adj2el} +\alias{adj2el} +\title{Convert a bipartite adjacency matrix to an edgelist} +\usage{ +adj2el(adj) +} +\arguments{ +\item{adj}{An adjacency matrix, with rows as TFs and columns as genes.} +} +\value{ +An edge list dataframe with three columns. First column is TF name, +second column is gene name, and third column is edge weight. +} +\description{ +Convert a bipartite adjacency matrix to an edgelist +} diff --git a/man/adj2regulon.Rd b/man/adj2regulon.Rd new file mode 100644 index 00000000..a549b7f5 --- /dev/null +++ b/man/adj2regulon.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{adj2regulon} +\alias{adj2regulon} +\title{Convert bipartite adjacency to regulon} +\usage{ +adj2regulon(adj) +} +\arguments{ +\item{adj}{An adjacency matrix, with rows as TFs and columns as genes.} +} +\value{ +A VIPER required regulon object. +} +\description{ +Convert bipartite adjacency to regulon +} diff --git a/man/el2adj.Rd b/man/el2adj.Rd new file mode 100644 index 00000000..351355fb --- /dev/null +++ b/man/el2adj.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{el2adj} +\alias{el2adj} +\title{Convert bipartite edge list to adjacency mat} +\usage{ +el2adj(el) +} +\arguments{ +\item{el}{An edge list dataframe with three columns. First column is TF name, +second column is gene name, and third column is edge weight.} +} +\value{ +An adjacency matrix with rows as TFs and columns as genes. +} +\description{ +Convert bipartite edge list to adjacency mat +} diff --git a/man/el2regulon.Rd b/man/el2regulon.Rd new file mode 100644 index 00000000..ee9b7e48 --- /dev/null +++ b/man/el2regulon.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{el2regulon} +\alias{el2regulon} +\title{Convert a bipartite edgelist to regulon} +\usage{ +el2regulon(el) +} +\arguments{ +\item{el}{An edge list dataframe with three columns. First column is TF name, +second column is gene name, and third column is edge weight.} +} +\value{ +A VIPER required regulon object +} +\description{ +Convert a bipartite edgelist to regulon +} diff --git a/man/pandaPy.Rd b/man/pandaPy.Rd index 95a10fa8..790852ee 100644 --- a/man/pandaPy.Rd +++ b/man/pandaPy.Rd @@ -41,7 +41,7 @@ Also, this can be generated with a list of proteins of interest by \code{\link{s \item{remove_missing}{Only when modeProcess='legacy': remove_missing='TRUE' removes all unmatched TF and genes; remove_missing='FALSE' keeps all tf and genes. The default value is 'FALSE'.} -\item{with_header}{if TRUE reads header of expression matrix} +\item{with_header}{Boolean to read gene expression file with a header for sample names} } \value{ When save_memory=FALSE(default), this function will return a list of three items: diff --git a/man/prior.pp.Rd b/man/prior.pp.Rd new file mode 100644 index 00000000..04719523 --- /dev/null +++ b/man/prior.pp.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/TIGER.R +\name{prior.pp} +\alias{prior.pp} +\title{Filter low confident edge signs in the prior network using GeneNet} +\usage{ +prior.pp(prior, expr) +} +\arguments{ +\item{prior}{A prior network (adjacency matrix) with rows as TFs and columns as genes.} + +\item{expr}{A normalized log-transformed gene expression matrix.} +} +\value{ +A filtered prior network (adjacency matrix). +} +\description{ +Filter low confident edge signs in the prior network using GeneNet +} diff --git a/man/puma.Rd b/man/puma.Rd new file mode 100644 index 00000000..c8b4422a --- /dev/null +++ b/man/puma.Rd @@ -0,0 +1,96 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PUMA.R +\name{puma} +\alias{puma} +\title{PANDA using microRNA associations} +\usage{ +puma( + motif, + expr = NULL, + ppi = NULL, + alpha = 0.1, + mir_file, + hamming = 0.001, + iter = NA, + output = c("regulatory", "coexpression", "cooperative"), + zScale = TRUE, + progress = FALSE, + randomize = c("None", "within.gene", "by.gene"), + cor.method = "pearson", + scale.by.present = FALSE, + edgelist = FALSE, + remove.missing.ppi = FALSE, + remove.missing.motif = FALSE, + remove.missing.genes = FALSE, + mode = "union" +) +} +\arguments{ +\item{motif}{A miRNA target dataset, a data.frame, matrix or exprSet containing 3 columns. +Each row describes the association between a miRNA (column 1) its target +gene (column 2) and a score (column 3) for the association from TargetScan or miRanda} + +\item{expr}{An expression dataset, as a genes (rows) by samples (columns) data.frame} + +\item{ppi}{This can be set to 1) NULL which will be encoded as an identity matrix between miRNAs in PUMA for now. +Or 2) it can include a set of TF interactions, or 3) a mix of TFs and miRNAs.} + +\item{alpha}{value to be used for update variable, alpha (default=0.1)} + +\item{mir_file}{list of miRNA to filter the PPI matrix and prevent update of miRNA edges.} + +\item{hamming}{value at which to terminate the process based on hamming distance (default 10^-3)} + +\item{iter}{sets the maximum number of iterations PUMA can run before exiting.} + +\item{output}{a vector containing which networks to return. Options include "regulatory", +"coregulatory", "cooperative".} + +\item{zScale}{Boolean to indicate use of z-scores in output. False will use [0,1] scale.} + +\item{progress}{Boolean to indicate printing of output for algorithm progress.} + +\item{randomize}{method by which to randomize gene expression matrix. Default "None". Must +be one of "None", "within.gene", "by.genes". "within.gene" randomization scrambles each row +of the gene expression matrix, "by.gene" scrambles gene labels.} + +\item{cor.method}{Correlation method, default is "pearson".} + +\item{scale.by.present}{Boolean to indicate scaling of correlations by percentage of positive samples.} + +\item{edgelist}{Boolean to indicate if edge lists instead of matrices should be returned.} + +\item{remove.missing.ppi}{Boolean to indicate whether miRNAs in the PPI but not in the motif data should be +removed. Only when mode=='legacy'.} + +\item{remove.missing.motif}{Boolean to indicate whether genes targeted in the motif data but not the +expression data should be removed. Only when mode=='legacy'.} + +\item{remove.missing.genes}{Boolean to indicate whether genes in the expression data but lacking +information from the motif prior should be removed. Only when mode=='legacy'.} + +\item{mode}{The data alignment mode. The mode 'union' takes the union of the genes in the expression matrix and the motif +and the union of TFs in the ppi and motif and fills the matrics with zeros for nonintersecting TFs and gens, 'intersection' +takes the intersection of genes and TFs and removes nonintersecting sets, 'legacy' is the old behavior with version 1.19.3. +#' Parameters remove.missing.ppi, remove.missingmotif, remove.missing.genes work only with mode=='legacy'.} +} +\value{ +An object of class "panda" containing matrices describing networks achieved by convergence +with PUMA algorithm.\cr +"regNet" is the regulatory network\cr +"coregNet" is the coregulatory network\cr +"coopNet" is the cooperative network which is not updated for miRNAs +} +\description{ +This function runs the PUMA algorithm to predict a miRNA-gene regulatory network +} +\examples{ +data(pandaToyData) +mirs = c("AHR","AR","ARID3A","ARNT","BRCA1","CEBPA","CREB1","DDIT3") +pumaRes <- puma(pandaToyData$motif, + pandaToyData$expression,NULL,mir_file=mirs,hamming=.1,progress=TRUE) +} +\references{ +Kuijjer, Marieke L., et al. "PUMA: PANDA using microRNA associations." Bioinformatics 36.18 (2020): 4765-4773. +} +\keyword{keywords} diff --git a/man/spider.Rd b/man/spider.Rd index ec9a3282..3f1a45f2 100644 --- a/man/spider.Rd +++ b/man/spider.Rd @@ -91,8 +91,8 @@ data(pandaToyData) pandaToyData$epifilter = pandaToyData$motif nind=floor(runif(5000, min=1, max=dim(pandaToyData$epifilter)[1])) pandaToyData$epifilter[nind,3] = 0 -#spiderRes <- spider(pandaToyData$motif,pandaToyData$expression, -# pandaToyData$epifilter,pandaToyData$ppi,hamming=.1,progress=TRUE) +spiderRes <- spider(pandaToyData$motif,pandaToyData$expression, + pandaToyData$epifilter,pandaToyData$ppi,hamming=.1,progress=TRUE) } \references{ Sonawane, Abhijeet Rajendra, et al. "Constructing gene regulatory networks using epigenetic data." npj Systems Biology and Applications 7.1 (2021): 1-13.