1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| f_SCE_VlnBoxPlot_dds <- function(featureN, dds){ df <- as.data.frame(t(assay(dds[featureN, ]))) df[['groupN']] <- dds@colData$condition colnames(df) <- c('value', 'groupN') df } require(ggplot2) f_SCE_VlnBoxPlot <- function(df, geneN, groupN='groupN'){ p <- ggplot(df, aes(x=!!sym(groupN), y=value, fill= !!sym(groupN), alpha = 0.618)) p <- p + theme_bw() + theme (legend.position = "none") p <- p + geom_violin()
p <- p + geom_boxplot(width=0.618) p <- p + stat_summary(fun="mean",geom="point",color='white') p <- p + labs(x=NULL, y=NULL) p <- p + labs(title=geneN) + theme(plot.title = element_text(hjust = 0.5)) p <- p + theme(axis.text.x=element_text(hjust = 1, angle = 45)) p }
|