I am using the deseq2 function plotPCA to visualize the principal components of my count data. I would like to extract the list of geneIDs that are contributing most to each component. I can get the value of PC1 and PC2 for each sample using returnData=TRUE, but I would like to extract the top and bottom genes from each component. Any ideas for me? Thank you!
As Michael has pointed out,
rowVars
is just a faster way to performapply(x, 1, var)
, but why do you say matrixStats can't be used with R version 3.2.2? It definitely can.> install.packages('matrixStats')
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
HTTPS CRAN mirror
1: 0-Cloud [https] 2: Austria [https]
3: China (Beijing 4) [https] 4: China (Hefei) [https]
5: Colombia (Cali) [https] 6: France (Lyon 2) [https]
7: Iceland [https] 8: Russia (Moscow 1) [https]
9: Switzerland [https] 10: UK (Bristol) [https]
11: UK (Cambridge) [https] 12: USA (CA 1) [https]
13: USA (KS) [https] 14: USA (MI 1) [https]
15: USA (TN) [https] 16: USA (TX) [https]
17: USA (WA) [https] 18: (HTTP mirrors)
Selection: 17
Warning: unable to access index for repository https://cran.fhcrc.org/src/contrib
Warning message:
package 'matrixStats' is not available (for R version 3.2.2)
This isn't matrixStats specific, and I bet installing any other package via
install.packages
will also bite you in this way.You can see that R is telling you that the error is "unsupported URL scheme", and I'm guessing that you can't install packages via https on your system. A google search for installing packages via https for your platform (I'm guessing you're on windows, or(?)) will help you sort it out.
To get you started, this post may or may not help.