-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_code.R
More file actions
29 lines (23 loc) · 1.06 KB
/
Copy pathexample_code.R
File metadata and controls
29 lines (23 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## example script using test_data
library(tidyverse)
library(ggpubr)
library("MLP")
# read input file in the test_data (mOTUs v2.5)
input <- read.delim("../test_data/Franzosa_2018_IBD.motus25.tsv", header = T, row.names = 1, check.names = F)
# transpose the data
input <- data.frame(t(input), check.names = F)
# predict microbial loads
load <- MLP(input, "motus25", "metacardis", "load")
load2 <- MLP(input[sample(nrow(input), 10), ], "motus25", "metacardis", "load")
temp <- dplyr::left_join(load2, load, by = "sample ID")
plot(temp$load.x, temp$load.y)
# transform relative microbiome profile (RMP) to quantitative microbiome profile (QMP)
qmp <- MLP(input, "motus25", "metacardis", "qmp")
# plot predicted microbial loads using ggplot2
md <- read.delim("test_data/Franzosa_2018_IBD.metadata.tsv", header = T, row.names = 1, check.names = F)
df <- data.frame(md, load = load$load)
comp <- combn(unique(df$Disease), 2, simplify = F)
ggplot(df, aes(x = Disease, y = log10(load), fill = Disease)) +
theme_bw() +
geom_boxplot() +
ggpubr::stat_compare_means(comparisons = comp)