Principle component ananlysis, variable selection
while performing PCA to reduce the dimension of the variable using "Factomine R" package in R. I want to extract the each individual gene contribution towards principle component. using this function "var$contrib:" I extracted the file but I unable to set the cut off I mean upto which cutoff I have to select the genes.
I am also attaching the code:
library("FactoMineR") library("factoextra")
data2 <- read.csv('t_data_processed_1_scale1.csv', header = TRUE) res.pca <- PCA(data2[,1:X]) print(res.pca) var <- get_pca_var(res.pca) var eig.val <- get_eigenvalue(res.pca) eig.val write.csv(eig.val,"feature_eigval_tissue.csv")
fviz_contrib(res.pca, choice = "var", axes = 1, top = 10)
featureCos2=var$cos2 write.csv(featureCos2,"featureCos2_tissue_new.csv") featureContrib=var$contrib write.csv(featureContrib,"featureContrib_tissue_new.csv")
• 537 views
•
link
0 answers
No answers yet.
Log in to answer this question.
You can do this via PCAtools, by accessing the loadings variable, e.g.,
p$loadings: https://bioconductor.org/packages/release/bioc/vignettes/PCAtools/inst/doc/PCAtools.html#a-loadings-plotDuplicate post: Principle component ananlysis