knitr::opts_chunk$set(echo = TRUE)
# Obtains trueW, trueH from exp2.RData load("~/rnaGinesis/data/Dataset_ResampledSingleCell.RData") trueW <- Dataset_ResampledSingleCell$trueW trueH <- Dataset_ResampledSingleCell$trueH # Obtains resultW, resultH from NMF and rearranges them to match trueW, trueH ordering load("~/rnaGinesis/data/Dataset_ResampledSingleCell.NMF.result.RData") Dataset_ResampledSingleCell.NMF <- rearrange(Dataset_ResampledSingleCell.NMF, Dataset_ResampledSingleCell) resultW.NMF <- Dataset_ResampledSingleCell.NMF[[1]] resultH.NMF <- Dataset_ResampledSingleCell.NMF[[2]]
# Normalizes resultH so that proportions sum to 1 resultH.NMF <- apply(resultH.NMF, 2, FUN = sum_to_1) # Do the same for the second deconvolution method # Obtains RMSE for each sample between true proportions and estimated proportions H.RMSE <- makeH.RMSE(trueH, resultH.NMF, resultH.NMF, "NMF", "TBD_Method")
# melts H.RMSE into dataframe with two variables and H.RMSE across all samples for each deconvolution method mydf <- reshape2::melt(H.RMSE) mydf <- mydf[,-1] names(mydf) <- c("method", "H_RMSE") # plots H.RMSE between true proportions and estimated proportions in each sample based on deconvolution method # make jitter reproduceable set.seed(1234) p <- ggplot2::ggplot(data = mydf, ggplot2::aes(y = H_RMSE, x= method, fill = method)) p <- p + ggplot2::geom_violin() p <- p + ggplot2::geom_jitter(width = 0.1, height = 0) #+ ggplot2::ylim(0,1) p <- p + ggplot2::labs(title="Violin Plots of Root Mean Squared Error (RMSE) for Proportions", x = "Deconvolution Method", y = "H_RMSE") p <- p + ggplot2::theme(axis.title.x = ggplot2::element_text(size = 40)) p <- p + ggplot2::theme(axis.title.y = ggplot2::element_text(size = 40)) p <- p + ggplot2::theme(axis.text = ggplot2::element_text(size=30)) print(p)
W.COSDIST <- makeW_COSDIST(trueW, resultW.NMF, resultW.NMF, "NFM", "TBD_Method")
# melts W.COSDIST into dataframe with two variables and W.COSDIST across all samples for each deconvolution method mydf2 <- reshape2::melt(W.COSDIST) mydf2 <- mydf2[,-1] names(mydf2) <- c("method", "W_COSDIST") # plots W.COSDIST between true W and estimated W in each sample based on deconvolution method # make jitter reproduceable set.seed(1234) p2 <- ggplot2::ggplot(data = mydf2, ggplot2::aes(y = W_COSDIST, x= method, fill = method)) p2 <- p2 + ggplot2::geom_violin() p2 <- p2 + ggplot2::geom_jitter(width = 0.1, height = 0) #+ ggplot2::ylim(0,1.5) p2 <- p2 + ggplot2::labs(title="Violin Plots of Cosine Distance (COSDIST) for Gene Expression",x = "Deconvolution Method", y = "W_COSDIST") + ggplot2::theme(axis.title.x = ggplot2::element_text(size = 40)) + ggplot2::theme(axis.title.y = ggplot2::element_text(size = 40)) + ggplot2::theme(axis.text=ggplot2::element_text(size=30)) print(p2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.