# Boiteau Lab pipeline for the visualization and statistics of metaB data
## Workflow by Sherlynette Pérez Castro and Laurinda Korang Nyarko v01 December 2022
## Alignment_4_8_Blankfilt, Alignment_4_8_Blankfilt_R,Alignment_4_8_Blankfilt_volcano,Alignment_4_8_Blankfilt_volcano_metadata,https://maayanlab.cloud/biojupies/analyze,
### 1,151 features, 118 sig features
#### =MID(A2,20,1), =MID(A2,22,2),
### I. Interactive Volcano Plot
### II. Line graphs
### III. Repeated measures ANOVAs
### IV. Nonmetric Multidimensional Scaling (NMDS) visualization
### V. Permutational multivariate analysis of variance (PERMANOVA)
>https://maayanlab.cloud/biojupies/analyze
> Upload Expression Table File [rows(metabolome), columns(peak height)] > Continue > Upload metadata File > Continue > Add Differential Expression Analyses (Differential Expression Table, Volcano Plot, MA Plot) > Continue > Add names of the groups > Continue > Generate Notebook > Open Notebook
### Temporal visualization: A line graph is the simplest way to represent time series data.
#### required packages
>library(sciplot)
#### multipanel plotting par(mfrow=c(rows,columns)
>par(mfrow=c(3,2),mai=c(0.5,0.8, 0.3, 0.1))
lineplot.CI(date2,x1792,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
lineplot.CI(date2,x2160,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
lineplot.CI(date2,x1468,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
lineplot.CI(date2,x2038,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
lineplot.CI(date2,x377,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
lineplot.CI(date2,x2099,virus,data=metabolomics,col = c("orange","darkgreen"),legend=F,x.cont=TRUE)
### Permutational Multivariate Analysis of Variance. adonis2 function for the analysis and partitioning sums of squares using dissimilarities.
#### required packages
>library(readxl)
library(vegan)
metaB <- read_excel("metabolomics.xlsx")
>adonis2(metaB[,1:2285] ~ virus*timepoint, data=metaB, permutations=999,method="bray")
#### Function metaMDS performs Nonmetric Multidimensional Scaling (NMDS)
>metaB.mds <- metaMDS(metaB[,1:2285], distance = "bray",trace = FALSE,trymax=100)
metaB.mds
plot(metaB.mds, type = "t", display = "sites")
with(metaB,ordiellipse(phyla.mds,virus,kind="se",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
with(metaB,ordiellipse(phyla.mds,timepoint,kind="se",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
with(metaB,ordiellipse(phyla.mds,plant,kind="se",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
abline(v=0,lty=2)
abline(h=0,lty=2)
>with(metaB,ordiellipse(phyla.mds,virus,kind="ehull",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
with(metaB,ordiellipse(phyla.mds,timepoint,kind="ehull",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
with(metaB,ordiellipse(phyla.mds,plant,kind="ehull",conf=0.95,label=TRUE,col=c(rep("black"),rep("black"))))
#### required packages
>library(ggplot2)
metabolomics$timepoint<-as.factor(metabolomics$timepoint)
> ggplot(metabolomics,aes(x=timepoint, y=x1792,fill=virus)) +
geom_boxplot(aes(shape=virus, color=virus,size=virus,fill=virus),lwd=1) +
scale_color_manual(values=c('orange','darkgreen'))+
theme_bw()+
geom_text(aes(label = plant),
position = position_jitterdodge())