As far as I understand you want to find the genes (p
) that are the sources of the the majority of the variance between your samples (n
).
You will have to look at entries in your loadings vectors.
pca.object <- princomp(data.matrix) # data.matrix is a [n p] matrix
pca.object$loadings # Your loadings are here
Then you can look at which genes of the genes that have the most extreme loadings.
Loadings range from -1 to 1, and the higher the numerical value of a gene's loading is, the more that gene means for the variance of the principal component in question.
On the other hand, the scores of e.g. PC1 will tell you how the samples differ according to the genes that have high loadings on PC1.
Just a side-note: Have you considered scaling your data-matrix?
EDIT:
You want to see which genes that mean the most for the differences between the samples, and therefore your samples should be in the rows and your genes should be in the columns. As far as I see, you should not transpose your data matrix.
And by the way, in R, use the prcomp
function instead of princomp
(for numerical stability). prcomp
also has the input option of centering and scaling, which you would like if the magnitude of the numbers in your matrix are not of a comparable size.
pca.object <- prcomp(data.matrix, center=TRUE, scale=TRUE) # PCA with centering and scaling
pca.object$rotation # The loadings are here
Just a note that even though PC1 captures the largest share of the variance, it is not always the most interesting biologically. Sometimes PC1 captures non-biologically-interesting features like technical artifacts, batch effects, and the like. Some caution is required in interpretation....