Skip to content
Snippets Groups Projects

Velma r

Merged Velma Aho requested to merge velma_r into master
1 file
+ 8
6
Compare changes
  • Side-by-side
  • Inline
@@ -1640,7 +1640,7 @@ mgmt_2hp_met <- do.call("rbind", lapply(
res <- subset_cors(df, "X2HP")
colnames(res)[grep("Feature", colnames(res))] <- "KO"
res <- merge(res, metgene_df)
res$Type <- x
res$Data <- x
return(res)
}))
@@ -1650,20 +1650,22 @@ mgmt_2hp_met$p_cat <- cut(mgmt_2hp_met$fdr,
include.lowest = TRUE)
mgmt_2hp_met$p_cat <- factor(mgmt_2hp_met$p_cat,
levels = rev(levels(mgmt_2hp_met$p_cat)))
mgmt_2hp_met_tab <- dcast(mgmt_2hp_met, Type + Subset ~ p_cat)
mgmt_2hp_met_tab <- cbind(mgmt_2hp_met_tab[,1:2],
prop.table(as.matrix(mgmt_2hp_met_tab[,3:7]), 1)*100)
mgmt_2hp_met_tab <- dcast(mgmt_2hp_met, Type + Data + Subset ~ p_cat)
mgmt_2hp_met_tab <- cbind(mgmt_2hp_met_tab[,1:3],
prop.table(as.matrix(mgmt_2hp_met_tab[,4:8]), 1)*100)
mgmt_2hp_met_tab <- melt(mgmt_2hp_met_tab)
mgmt_2hp_met_tab <- subset(mgmt_2hp_met_tab, variable != "n.s.")
mgmt_2hp_met_tab$Subset <- capitalize(mgmt_2hp_met_tab$Subset)
mgmt_2hp_met_tab$Type <- capitalize(mgmt_2hp_met_tab$Type)
mgmt_2hp_met_tab$Data_Type <- paste0(mgmt_2hp_met_tab$Data, " (", mgmt_2hp_met_tab$Type, ")")
metgene_cors_p <- ggplot(mgmt_2hp_met_tab,
aes(x = Subset, y = value, fill = variable)) +
geom_bar(stat = "identity", position = "stack",
color = "black", size = 0.3) +
scale_fill_manual(values = gray.colors(4, start = 0.95, end = 0.15),
name = "q-value\n(fdr-adjusted P)\nsignificance") +
facet_wrap(Type~., nrow = 1) +
facet_grid(.~Data_Type) +
ylab("% of methanogenesis-related\ngenes correlated with 2-HP") +
xlab("Data used for correlations") +
custom_gg +
Loading