In this example MBB is a table with 5149 rows and 4122 columns. It displays, for every MBB, the selected groups (Kingdoms, families, etc.) to which it belongs.
In this example mDAG is a table with 1132 rows and 5278 columns. It displays, for every m-DAG, the selected groups (Kingdoms, families, etc.) in which it belongs.
The Results table contains for every organism (row) the following information: its category (taxonomy), selected group, Full name, m-DAG id and all reactions name id with their corresponding enzyme. When a reaction is present in the corresponding m-DAG, the MBB to which it belongs is displayed in this column.
# Load data```{r setup_load_data, include=FALSE,message=FALSE}knitr::opts_chunk$set(echo = TRUE, cache=TRUE, warning = FALSE, message = FALSE, out.width = "100%", lazy.cache = FALSE)#pdf="TRUE"library(tidyverse)library(igraph)library(ComplexHeatmap)library(viridis)library(circlize)library(plotly)library(randomcoloR)library(factoextra)library(RColorBrewer)library(kableExtra)library(igraph)library(GGally)``````{r}experiment="0a845f74-826e-3b46-aed9-e7ecf74db262/"path_exp=paste0("data/",experiment)knitr::kable(data.frame(Directory_files_and_folders=dir(path_exp),Type=c(rep("Data file",2),rep("Directory",3),rep("Data file",8),"Directory")))``````{r}MBB=read_csv(paste0(path_exp,"Different_MBB.csv"),show_col_types =FALSE)mDAG=read_csv(paste0(path_exp,"Different_mDAG.csv"),show_col_types =FALSE)```## Load metadataOrganisms are sorted by Kingdom, Phylum and Class:```{r}path_expResults=read_csv(paste0(path_exp,"Results.csv"))#rename MetaDaG variablesnames(Results)[c(1,2,3,4,5)]=c("Organism","Categories","Groups","mDAG_Id","Full_Name")taxo=Results %>%select(Organism:Full_Name)meta_taxo=taxo %>%separate(Categories,into=c("Kingdom","Phylum","Class"))index=which(is.na(meta_taxo$Class))meta_taxo$Class[index]=paste(meta_taxo$Phylum[index])rm(taxo)aux=table(meta_taxo$Kingdom)Freq_Kingdom=tibble(Kingdom=names(aux),Freq_Kingdom=aux)aux=table(meta_taxo$Phylum)Freq_Phylum=tibble(Phylum=names(aux),Freq_Phylum=aux)aux=table(meta_taxo$Class)Freq_Class=tibble(Class=names(aux),Freq_Class=aux)meta_taxo = meta_taxo %>%left_join(Freq_Kingdom) %>%left_join(Freq_Phylum) %>%left_join(Freq_Class)meta_taxo = meta_taxo %>%arrange(desc(Freq_Kingdom),desc(Freq_Phylum),desc(Freq_Class))#arrange metaxto by frequencies of kingom phylum and classknitr::kable(head(meta_taxo))``````{r}table(meta_taxo$Kingdom) %>% kable %>%kable_styling("striped", full_width = F,position="left")%>%scroll_box(width ="400px", height ="200px")table(meta_taxo$Phylum,meta_taxo$Kingdom) %>% kable %>%kable_styling("striped", full_width = F,position="left")%>%scroll_box(width ="500px", height ="500px")```## Table of MBBsIn this example `MBB` is a table with `r nrow(MBB)` rows and `r ncol(MBB)` columns. It displays, for every MBB, the selected groups (Kingdoms, families, etc.) to which it belongs.```{r}#100knitr::kable(MBB[1:20,1:10]) %>%scroll_box(width ="100%", height ="200px")```## Table of m-DAGsIn this example `mDAG` is a table with `r nrow(mDAG)` rows and `r ncol(mDAG)` columns. It displays, for every m-DAG, the selected groups (Kingdoms, families, etc.) in which it belongs.```{r}kable(mDAG[1:20,1:10]) %>%scroll_box(width ="100%", height ="200px")``````{r}dim(mDAG)names(mDAG)[1:6]head(names(mDAG)[7:(dim(mDAG)[2]-1150)])# 28 to 1213 code MBB: 1 if MBB in mDAG 0```## Results TableThe `Results` table contains for every organism (row) the following information: its category (taxonomy), selected group, Full name, m-DAG id and all reactions name id with their corresponding enzyme. When a reaction is present in the corresponding m-DAG, the MBB to which it belongs is displayed in this column.```{r}kable(Results[1:20,1:10])%>%row_spec(0, angle =0) %>%scroll_box(width ="300%", height ="1000px")``````{r}dim(Results)names(Results)[1]# organisms kegg id class representant of mDAGnames(Results)[2]# taxonomy separate by |names(Results)[3]# groups names(Results)[4]# mDAG_Id names(Results)[5]# Full name representantnames(Results)[6:36]# columns 6 to 3998 # reactions name id with its enzyme.``````{r}reactions=names(Results)[-c(1:5)]reverse_reactions=stringr::str_detect(reactions,"rev")reverse_reactions=table(reverse_reactions)dimnames(reverse_reactions)$reverse_reactions=c("Non reverse reaction","Reverse reaction")reverse_reactions %>% kable %>%kable_styling("striped", full_width = F,position="left")``````{r pasar_load, include=FALSE}save.image(file='metadag_work_space.RData')```