## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(echo = TRUE) ## ----eval=TRUE, message=FALSE, results='hide'--------------------------------- #-- Call packages library(geneplast) library(geneplast.data.string.v91) library(RTN) library(Fletcher2013b) library(ggplot2) library(ggpubr) library(plyr) ## ----eval=FALSE, message=FALSE, warning=FALSE--------------------------------- # #-- Load orthology data from the 'geneplast.data.string.v91' package # data(gpdata_string_v91) # # #-- Create an object of class 'OGR' for a reference 'spid' # ogr <- groot.preprocess(cogdata=cogdata, phyloTree=phyloTree, spid="9606") ## ----eval=FALSE, message=FALSE, warning=FALSE--------------------------------- # #-- Run the 'groot' function and infer the evolutionary roots # ogr <- groot(ogr, nPermutations=1000, verbose=TRUE) ## ----eval=FALSE, message=FALSE, warning=FALSE--------------------------------- # #-- Load regulons # data("rtni1st") # tni.regulon.summary(rtni1st) ## ----eval=FALSE, message=FALSE, warning=FALSE--------------------------------- # ## This regulatory network comprised of 809 regulons. # ## -- DPI-filtered network: # ## regulatoryElements Targets Edges # ## 809 14131 47012 # ## Min. 1st Qu. Median Mean 3rd Qu. Max. # ## 0.0 10.0 37.0 58.1 80.0 523.0 # ## -- Reference network: # ## regulatoryElements Targets Edges # ## 809 14131 617672 # ## Min. 1st Qu. Median Mean 3rd Qu. Max. # ## 0 43 449 764 1245 4148 # ## --- ## ----eval=FALSE, message=FALSE, warning=FALSE--------------------------------- # #-- Put regulons into an 'igraph' object # #-- Note: small regulons (n<15 targets) are romeved in this step. # graph <- tni.graph(rtni1st, gtype = "rmap") # # #-- Map the 'ogr' object to the 'igraph' object # graph <- ogr2igraph(ogr, cogdata, graph, idkey = "ENTREZ") # # #-- Make a data frame with the gene roots # roots_df <- data.frame(COGID = V(graph)$COGID, # SYMBOL = V(graph)$SYMBOL, # ENTREZ = V(graph)$ENTREZ, # Root = V(graph)$Root, # TRN_element = c("Target","TF")[V(graph)$tfs+1], # stringsAsFactors = FALSE) ## ----eval=FALSE--------------------------------------------------------------- # #-- Remove NAs from missing annotation # roots_df <- roots_df[complete.cases(roots_df),] # # #-- Remove genes rooted at the base of the phylogenetic tree # roots_df <- roots_df[roots_df$Root