Created
July 22, 2014 22:56
-
-
Save xwu/ddf04c763c80ca418ccc to your computer and use it in GitHub Desktop.
Principal component analysis of gene expression microarray datasets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my.data.frame <- read.delim("tab_delimited_file_with_probeset_ids_in_first_column.txt", row.names=1) | |
my.data.matrix <- as.matrix(my.data.frame) | |
# PCA by sample: | |
# center each gene (mean) without scaling | |
# scale each sample (root mean square) without centering | |
# transpose the matrix to PCA by sample instead of by gene | |
a <- scale(t(my.data.matrix), center=TRUE, scale=FALSE) | |
b <- scale(t(a), center=FALSE, scale=TRUE) | |
my.pca <- prcomp(t(b), center=FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment