#' Correlation of samples based on the panel of whole genome
#'
#' use the corSamples() fuction to initiate the correlation among samples
#' @import pheatmap FactoMineR factoextra
#' @param dataPath the direction of download Data
#' @export
corSamples<-function(dataPath){
setwd(dataPath)
load(file =".//output//step03.RData")
message("在所有样本间,进行基因表达相关性分析...",appendLF =F)
pdf(file = ".//output//step04_correlation_matrix.pdf",
width =10,height = ncol(x_reduce)/12)
x_d<-x_reduce[rowSums(x_reduce>100)>ncol(x_reduce)/2,]
pheatmap::pheatmap(cor(log2(x_d+1),method = 'spearman'),
col = colorRampPalette(c('green','white','red'))(100),cex=0.8,
cellheight =5,treeheight_row = 30,show_colnames = F,cluster_cols = T,
clustering_distance_rows = 'euclidean',scale = 'row')
dev.off()
pdf(file = ".//output//step04_PCA.pdf",
width =10)
res.pca=FactoMineR::PCA(t(log2(x_reduce+1)),graph = F)
groups=sample_info$group
p=factoextra::fviz_pca_ind(
res.pca,
geom.ind="point",
col.ind=groups,
palette=c('#00AFBB','#E7B800'),
addEllipses=T,
legend.title="Groups",
title="PCA of all Genes"
)
print(p)
dev.off()
message("Completed!")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.