In the Eukaryotes test, we aimed to analyze which factors caused some algae and plants to be distinguished from their respective kingdoms. To address this question, we revisited the core metabolism obtained with MetaDAG, focusing on each cluster.
```{r include=FALSE,message=FALSE}knitr::opts_chunk$set(echo = TRUE, cache=TRUE, warning = FALSE, message = FALSE, out.width = "100%", cache.lazy = 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}load(file='metadag_work_space.RData')```# Clusters analysisIn the Eukaryotes test, we aimed to analyze which factors caused some algae and plants to be distinguished from their respective kingdoms. To address this question, we revisited the core metabolism obtained with MetaDAG, focusing on each cluster.```{r}reactions=names(Results)reactions=reactions[grep("(^R\\d{5})",reactions)]reactions=tibble(reactions)reactions=reactions %>%separate(reactions, into=c("r_id","enzyme"),sep="\\(",remove=FALSE)reactions=reactions %>%mutate(enzyme=gsub("\\(|\\)","",enzyme))#reactions=reactions[,-3]reactions$rev=stringr::str_detect(reactions$r_id,"v")```The results of the clusters are compared to the classification of Kingdoms for both similarity measures:```{r}clust4_MSA2=tibble(mDAG_Id=names(clust4_MSA), clust4_MSA=clust4_MSA)clust4_Mun2=tibble(mDAG_Id=names(clust4_Mun), clust4_Mun=clust4_Mun)meta_taxo2=meta_taxometa_taxo2=meta_taxo2 %>%left_join(clust4_MSA2,by="mDAG_Id") %>%left_join(clust4_Mun2,by="mDAG_Id")meta_taxo2$combined_cluster_MSA_Kingdom=paste0(meta_taxo2$Kingdom,meta_taxo2$clust4_MSA)meta_taxo2$combined_cluster_Mun_Kingdom=paste0(meta_taxo2$Kingdom,meta_taxo2$clust4_MSA)write.csv(meta_taxo2,file="meta_taxo_4_clusters.csv")``````{r}knitr::kable(table(meta_taxo2$Kingdom,meta_taxo2$clust4_MSA))knitr::kable(table(meta_taxo2$Kingdom,meta_taxo2$clust4_Mun))knitr::kable(table(meta_taxo2$clust4_Mun,meta_taxo2$clust4_MSA))```The table below correlates the clusters with the Phylum information.```{r}library(reshape2)MSA_table=melt(table(meta_taxo2$Kingdom,meta_taxo2$Phylum,meta_taxo2$clust4_MSA))names(MSA_table)=c("Kingdom","Phylum","cluster_MSA","N")MSA_table=MSA_table %>%filter(N!=0)``````{r}knitr::kable(MSA_table)```