Skip to content

Instantly share code, notes, and snippets.

@dfjenkins3
Created May 25, 2016 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfjenkins3/f38a7d297badc4a27891c724e09caa5e to your computer and use it in GitHub Desktop.
Save dfjenkins3/f38a7d297badc4a27891c724e09caa5e to your computer and use it in GitHub Desktop.
example PCA
#run PCA
pca.results <- prcomp(t(expression))
#vector of colors
cols <- as.character(indata$Annotation)
cols[cols=="K"] <- 'red'
cols[cols=="LG"] <- 'lightgreen'
cols[cols=="G"] <- 'darkgreen'
#plot it
plot(pca.results$x[,1], pca.results$x[,2], col=cols)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment