Entering edit mode
3.4 years ago
sana777munquad
▴
10
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")