R/plotQC.R

Defines functions plotQC

library(dendextend)
library(Rtsne)
library(calibrate)

plotQC <- function(mat, cols=NA, ...){
  par(mfrow=c(2,2))
  barplot(colSums(is.na(mat)) / nrow(mat) * 100, las=2, col=cols, ylab="Missing values (%)", main="Missing values per sample", ylim=c(0, 100))

  dend <- as.dendrogram(hclust(dist(t(mat))))
  labels_colors(dend) <- cols
  plot(dend, main="Sample hierarchical clustering", ylab="Tree height")

  result <- pcaMethods::pca(t(mat), method="ppca", nPcs=2, seed=123, main="PCA")
  plot(result@scores[,1], result@scores[,2], col=cols, pch=16, cex=1.5, xlab="PC1", ylab="PC2", ...)
  textxy(result@scores[,1], result@scores[,2], colnames(mat), cex=0.75)
}
SydneyBioX/phosphoR documentation built on May 20, 2019, 12:58 a.m.