Skip to content

Commit

Permalink
migrate NetBID1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdingliang committed Aug 10, 2019
1 parent 24c362c commit 6a4677a
Show file tree
Hide file tree
Showing 228 changed files with 1,430 additions and 816,570 deletions.
Empty file modified COPYRIGHT.txt
100755 → 100644
Empty file.
55 changes: 16 additions & 39 deletions DESCRIPTION
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,44 +1,21 @@
Package: NetBID2
Package: NetBID
Type: Package
Title: Network-based Bayesian Inference of Drivers, version 2
Version: 0.1.2
Authors@R: person('Xinran', 'Dong', email = 'xinran.dong@stjude.org', role = c('aut', 'cre'))
Maintainer@R: person('Xinran', 'Dong', email = 'xinran.dong@stjude.org')
Description: An integrative systems biology algorithm to infer drivers of phenotype based on data-driven context-specific network and Bayesian inference.
License: GPL (>= 2)
Title: Network-based Bayesian Inference of Drivers
Version: 0.1.0
Authors@R: person("Jiyang", "Yu", email = "jiyang.yu@stjude.org", role = c("aut", "cre"))
Maintainer@R: person("Jiyang", "Yu", email = "jiyang.yu@stjude.org")
Description: A integrative systems biolgy algorithm to infer driers of phenotype based on data-driven context-specific network and Bayesian inference.
License: Apache 2.0
Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.6.0),
Matrix (>= 1.2-17),
SummarizedExperiment (>= 1.14.0),
lme4 (>= 1.1-21),
Biobase (>= 2.38.0),
GEOquery (>= 2.46.15),
limma (>= 3.34.9),
impute (>= 1.52.0),
tximport (>= 1.6.0),
DESeq2 (>= 1.20.0),
ConsensusClusterPlus (>= 1.38.0),
aricode (>= 0.1.1),
igraph (>= 1.1.2),
RColorBrewer (>= 1.1-2),
plot3D (>= 1.1.1),
plotrix (>= 3.7-3),
umap (>= 0.2.0.0),
ComplexHeatmap (>= 1.17.1),
ordinal (>= 2019.4-25),
MCMCglmm (>= 2.26),
arm (>= 1.10-1),
reshape (>= 0.8.7),
biomaRt (>= 2.34.2),
GSVA (>= 1.22.4),
msigdbr (>= 6.2.1),
openxlsx (>= 4.1.0),
rmarkdown (>= 1.11),
kableExtra (>= 1.1.0)
Imports:
rhdf5,
plotly
R (>= 3.4)
Imports:
arm,
dplyr,
Biobase,
Rcpp
Suggests:
RoxygenNote: 6.1.1
MCMCglmm,
lme4
RoxygenNote: 6.0.1.9000
Empty file modified LICENSE.txt
100755 → 100644
Empty file.
166 changes: 7 additions & 159 deletions NAMESPACE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,162 +1,10 @@
# Generated by roxygen2: do not edit by hand

export(IQR.filter)
export(NetBID.analysis.dir.create)
export(NetBID.lazyMode.DriverEstimation)
export(NetBID.lazyMode.DriverVisualization)
export(NetBID.loadRData)
export(NetBID.network.dir.create)
export(NetBID.saveRData)
export(RNASeqCount.normalize.scale)
export(SJAracne.prepare)
export(bid)
export(cal.Activity)
export(cal.Activity.GS)
export(combineDE)
export(combinePvalVector)
export(db.preload)
export(draw.2D)
export(draw.2D.ellipse)
export(draw.2D.interactive)
export(draw.2D.text)
export(draw.3D)
export(draw.GSEA)
export(draw.GSEA.NetBID)
export(draw.GSEA.NetBID.GS)
export(draw.MICA)
export(draw.NetBID)
export(draw.bubblePlot)
export(draw.categoryValue)
export(draw.clustComp)
export(draw.combineDE)
export(draw.eset.QC)
export(draw.funcEnrich.bar)
export(draw.funcEnrich.cluster)
export(draw.heatmap)
export(draw.network.QC)
export(draw.pca.kmeans)
export(draw.targetNet)
export(draw.targetNet.TWO)
export(draw.umap.kmeans)
export(draw.volcanoPlot)
export(funcEnrich.Fisher)
export(generate.eset)
export(generate.masterTable)
export(get.SJAracne.network)
export(get.TF_SIG.list)
export(get.class.color)
export(getDE.BID.2G)
export(getDE.limma.2G)
export(get_IDtransfer)
export(get_IDtransfer2symbol2type)
export(get_IDtransfer_betweenSpecies)
export(get_clustComp)
export(get_int_group)
export(get_name_transfertab)
export(get_net2target_list)
export(get_obs_label)
export(gs.preload)
export(load.exp.GEO)
export(load.exp.RNASeq.demo)
export(load.exp.RNASeq.demoSalmon)
export(merge_TF_SIG.AC)
export(merge_TF_SIG.network)
export(merge_eset)
export(merge_gs)
export(merge_target_list)
export(out2excel)
export(test.targetNet.overlap)
export(update_SJAracne.network)
export(update_eset.feature)
export(update_eset.phenotype)
export(z2col)
import(Biobase)
import(ConsensusClusterPlus)
import(biomaRt)
import(igraph)
import(kableExtra)
import(limma)
import(msigdbr)
import(openxlsx)
import(tximport)
importFrom(ComplexHeatmap,Heatmap)
importFrom(DESeq2,DESeq)
importFrom(DESeq2,DESeqDataSetFromTximport)
importFrom(GEOquery,getGEO)
importFrom(GSVA,gsva)
importFrom(MCMCglmm,MCMCglmm)
importFrom(Matrix,rowSums)
importFrom(RColorBrewer,brewer.pal)
importFrom(SummarizedExperiment,assay)
importFrom(aricode,clustComp)
importFrom(arm,bayesglm)
importFrom(grDevices,col2rgb)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,dev.off)
importFrom(grDevices,pdf)
importFrom(grDevices,rgb)
importFrom(graphics,abline)
importFrom(graphics,arrows)
importFrom(graphics,axis)
importFrom(graphics,barplot)
importFrom(graphics,boxplot)
importFrom(graphics,hist)
importFrom(graphics,image)
importFrom(graphics,layout)
importFrom(graphics,legend)
importFrom(graphics,lines)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,points)
importFrom(graphics,polygon)
importFrom(graphics,rect)
importFrom(graphics,segments)
importFrom(graphics,strheight)
importFrom(graphics,stripchart)
importFrom(graphics,strwidth)
importFrom(graphics,text)
importFrom(impute,impute.knn)
importFrom(lme4,lmer)
importFrom(ordinal,clm)
importFrom(ordinal,clmm)
importFrom(plot3D,scatter3D)
importFrom(plotrix,draw.circle)
importFrom(plotrix,draw.ellipse)
importFrom(reshape,melt)
importFrom(rhdf5,H5Fclose)
importFrom(rhdf5,H5Fopen)
importFrom(rmarkdown,html_document)
importFrom(rmarkdown,pandoc_available)
importFrom(rmarkdown,render)
importFrom(stats,IQR)
importFrom(stats,aggregate)
importFrom(stats,as.dendrogram)
importFrom(stats,as.dist)
importFrom(stats,cutree)
importFrom(stats,density)
importFrom(stats,dist)
importFrom(stats,fisher.test)
importFrom(stats,gaussian)
importFrom(stats,glm)
importFrom(stats,hclust)
importFrom(stats,kmeans)
importFrom(stats,ks.test)
importFrom(stats,lm)
importFrom(stats,median)
importFrom(stats,model.matrix)
importFrom(stats,na.omit)
importFrom(stats,order.dendrogram)
importFrom(stats,p.adjust)
importFrom(stats,pchisq)
importFrom(stats,pnorm)
importFrom(stats,prcomp)
importFrom(stats,pt)
importFrom(stats,qnorm)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(stats,splinefun)
importFrom(umap,umap)
importFrom(umap,umap.defaults)
importFrom(utils,read.delim)
importFrom(utils,write.table)
export(combRowEvid.2grps)
export(getActivity)
export(netbid)
export(netbidi)
export(network.tbl2list)
export(scaleActivity)
export(transformNetworkListIds)
Empty file removed NetBID2.Rproj
Empty file.
Binary file removed NetBID2_0.1.2.pdf
Binary file not shown.
100 changes: 100 additions & 0 deletions R/NetBID.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#' Network-based Bayesian Inference of Drivers
#'
#' Driver inference of of case phenotype (vs. ctrl) from one source data and a pre-defined network
#'
#' @param gsc gsc (gene set collection) is a input network in list format with drivers as names and network targets as values that can be mapped to featureNames(eset)
#' @param eset ExpressionSet object of the data used to make inference: pData(eset)$group must exist to indicate the groups which you will compare to make the inference; featureNames(eset) are ids that can be mapped by gsc values.
#' @param group.case case name in pData(eset)$group
#' @param group.ctrl control name in pData(eset)$group
#' @param signed If TURE, consider directions of case vs. ctrl, If FALSE, ignore the directions
#' @param restand If TRUE, restandize or z-normalize the data
#' @return data.frame of case vs. ctrl inference with statistics including netSize (network size), z, pval, FDR.BH (FDR by BH method), log2FC (if signed)
#' @examples
#'
#' ###transform network into list of probes
#' dci.kinase.probes<-network.tbl2list(dci.kinase.tbl[,c('source.symbol','target')])
#' dmrna<-netbid(dci.kinase.probes,mrna,group.case='CD8pos.DC',group.ctrl='CD8neg.DC')
#'
#'
#'
#' @export
netbid<-function(gsc,eset,group.case,group.ctrl,signed=FALSE,restand=TRUE,...){

aset<-getActivity(gsc=gsc,dat=eset,restand=restand,...)
rs<-bid(eset=aset,group.case=group.case,group.ctrl=group.ctrl,signed=signed,...)
rs

}


#' NetBID Integration
#'
#' Driver inference by intergrating multiple NetBID results
#'
#' @param netbid.list list of netbid outputs, e.g. list(mRNA=dmrna,wProtein=dwprotein,pProtein=dpprotein)
#' @param signed If TURE, consider directions when combining NetBID results, If FALSE, ignore the directions
#' @return data.frame of case vs. ctrl inference with statistics including cobmbined and individual netSize (network size), z, pval, FDR.BH (FDR by BH method), log2FC (if signed)
#' @examples
#'
#' ###transform network into list of probes
#' dci.kinase.probes<-network.tbl2list(dci.kinase.tbl[,c('source.symbol','target')])
#' dmrna<-netbid(dci.kinase.probes,mrna,group.case='CD8pos.DC',group.ctrl='CD8neg.DC')
#' ##whole proteomcis
#' dci.kinase.wprotein<-transformNetworkListIds(dci.kinase.symbols,ref=fData(wprotein)[,c('geneSymbol','proteinId')])
#' dwprotein<-netbid(dci.kinase.wprotein,wprotein,group.case='CD8pos.DC',group.ctrl='CD8neg.DC')

#' dcomb<-netbidi(list(mRNA=dmrna,wProtein=dwprotein))
#'
#'
#'
#' @export
netbidi<-function(netbid.list,signed=FALSE,method='Stouffer',twosided=TRUE,...){


n<-length(netbid.list)
if(n<2) stop('At least two netbid outputs are required for netbidi analysis!\n')

rs<-NULL
for(i in 1:n){

if(names(netbid.list)[i]==''|is.null(names(netbid.list)[i]))
names(netbid.list)[i]<-i

names(netbid.list[[i]])[-1]<-paste(names(netbid.list[[i]])[-1],names(netbid.list)[i],sep='_')

netbid.list[[i]]$id<-as.character(netbid.list[[i]]$id)
if(i==1){
rs<-netbid.list[[i]]
}else{
rs<-dplyr::full_join(rs,netbid.list[[i]],by='id')
}
}


conds<-names(netbid.list)
if(sum(grepl('log2FC',names(rs)))>0){
FC.cols<-paste('log2FC',conds,sep='_')
}else{
FC.cols<-NULL
}
comb<-combinePvalues(rs,pvalue.cols=paste('pval',conds,sep='_'),sign.cols=paste('z',conds,sep='_'),FC.cols =FC.cols,logTransformed=TRUE,log.base=2,method=method,twosided=twosided,signed=signed,byRow=TRUE,...)
comb<-comb[,-1]
names(comb)<-paste(names(comb),'comb',sep='_')

rs<-cbind(comb,rs)

col.sel<-c('id',
grep('^netSize_',names(rs),value=TRUE)
,
grep('^z_',names(rs),value=TRUE),
grep('^log2FC_',names(rs),value=TRUE),
grep('^pval_',names(rs),value=TRUE),
grep('^FDR.BH_',names(rs),value=TRUE)
)

rs<-rs[,c(col.sel,setdiff(names(rs),col.sel))]
rs<-dplyr::arrange(rs,pval_comb)

rs

}
Loading

0 comments on commit 6a4677a

Please sign in to comment.