### R代码从vignette源的介绍。rnw ' ################################################### ### 代码块1号:tPR ################################################### 库(pageRank) set.seed (1) graph1 < - igraph:: erdos.renyi。game(100,0.01, directed = TRUE) igraph::V(graph1)$name <- 1:100 #第一个以name为顶点属性的图形set.seed(2) graph2 <- igraph::erdos.renyi. set.seed)0.01游戏(100年,导演= TRUE) igraph:: V (graph2)美元名称< - 1:10 0 #第二图与名字顶点属性diff_graph (graph1 graph2 ) ################################################### ### 代码块2号:mPR ################################################### set.seed (1) graph1 < - igraph: erdos.renyi。game(100,0.01, directed = TRUE) igraph::V(graph1)$name <- 1:100 igraph::V(graph1)$pagerank <- igraph::page_rank(graph1)$vector #具有pagerank和名称作为顶点属性的基图。Set.seed (2) graph2 <- igraph::erdos.renyi。game(100,0.01, directed = TRUE) igraph::V(graph2)$name <- 1:100 igraph::V(graph2)$pagerank <- igraph::page_rank(graph2)$vector #以pagerank和name作为顶点属性的补充图。multiplex_page_rank (graph1 graph2 ) ################################################### ### 代码块3号:clean_graph ################################################### set.seed图(1)<——igraph:: erdos.renyi。game(100,0.01, directed = TRUE) igraph::V(graph)$name <- 1:100 igraph::V(graph)$pagerank <- igraph::page_rank(graph)$vector #要清洗的图形,以pagerank和name作为顶点属性。clean_graph(图,大小= 5 ) ################################################### ### 代码块数量4:adjust_graph ################################################### set.seed图(1)<——igraph:: erdos.renyi。game(100,0.01, directed = TRUE) igraph::V(graph)$name <- 1:100 igraph::V(graph)$pagerank <- igraph::page_rank(graph, damping=0.85)$vector #要调整的图形,以pagerank和名称作为顶点属性。adjust_graph(图,阻尼= 0.1 ) ################################################### ### 代码块5号:aracne_network ################################################### 图书馆(bcellViper)数据(bcellViper)头(aracne_network(调节子[1:10 ])) ################################################### ### 代码块6号:accessibility_network ################################################### 表< - data.frame(对应= c(“chr1”、“chr1”),开始= c(713689、856337),结束= c(714685、862152),row.names = c(“A”、“B”),stringsAsFactors = FALSE)监管机构= c(“FOXF2”, "MZF1") #peaks and regulators to be analyzed library(GenomicRanges) library(GenomicFeatures) library(TxDb.Hsapiens.UCSC.hg19.knownGene) library(org.Hs.eg.db) library(annotate) promoter <- promoters(genes(TxDb.Hsapiens.UCSC.hg19.knownGene)) names(promoter) <- getSYMBOL(names(promoter), data="org.Hs.eg") promoter <- promoter[!is.na(names(promoter))] #get promoter regions library(JASPAR2018) library(TFBSTools) library(motifmatchr) pfm <- getMatrixSet(JASPAR2018, list(species="Homo sapiens")) pfm <- pfm[unlist(lapply(pfm, function(x) name(x))) %in% regulators] #get regulator position frequency matrix (PFM) list library(BSgenome.Hsapiens.UCSC.hg19) accessibility_network(table, promoter, pfm, "BSgenome.Hsapiens.UCSC.hg19") ################################################### ### code chunk number 7: conformation_network ################################################### table <- data.frame(Chr1=c("chr1", "chr1"), Position1=c(569265, 713603), Strand1=c("+", "+"), Chr2=c("chr4", "chr1"), Position2=c(206628, 715110), Strand2=c("+", "-"), row.names=c("A", "B"), stringsAsFactors=FALSE) regulators=c("FOXF2", "MZF1") #peaks and regulators to be analyzed promoter <- promoters(genes(TxDb.Hsapiens.UCSC.hg19.knownGene)) names(promoter) <- getSYMBOL(names(promoter), data="org.Hs.eg") promoter <- promoter[!is.na(names(promoter))] #get promoter regions pfm <- getMatrixSet(JASPAR2018, list(species="Homo sapiens")) pfm <- pfm[unlist(lapply(pfm, function(x) name(x))) %in% regulators] #get regulator position frequency matrix (PFM) list conformation_network(table, promoter, pfm, "BSgenome.Hsapiens.UCSC.hg19") ################################################### ### code chunk number 8: P_graph ################################################### dset <- exprs(dset) net <- do.call(rbind, lapply(1:10, function(i, regulon){ data.frame(reg=rep(names(regulon)[i], 10), target=names(regulon[[i]][[1]])[1:10], stringsAsFactors = FALSE)}, regulon=regulon)) P_graph(dset, net, method="difference", null=NULL, threshold=0.05) ################################################### ### code chunk number 9: session_information ################################################### sessionInfo()