#' Generate the Gene Matrix of samples
#'
#' use the generateMatrix() fuction to orgnize the expression Matrix of Samples.
#' @import progress
#' @param dataPath the direction of download Data
#' @export
generateMatrix<-function(dataPath){
setwd(dataPath)
message("正在创建所有样本的基因表达矩阵...",appendLF = T)
#定义空变量
x_merge=NULL
setwd(paste(dataPath,"all",sep="/"))
file.remove(list.files(pattern = ".*.R"))
i<-list.files()
pb <- progress::progress_bar$new(total = length(i))
try(
for(n in i){
x=read.delim(n,col.names = c('ID',substr(n,1,9)))
if(is.null(x_merge)){
x_merge=x
}
else{
x_merge=merge(x_merge,x,by='ID')
}
pb$tick()
}
)
setwd(dataPath)
#head(x_merge)[,1:5]
#基因转换成行名
rownames(x_merge)<-x_merge$ID
x_reduce=x_merge[-(1:5),]
x_reduce=x_reduce[,-1]
rownames(x_reduce)=x_merge$ID[-c(1:5)]
#由于此步骤比较耗时,所以我将该步骤获得的x_reduce表达矩阵另存为Rdata文件
save(x_reduce,file = ".//output//step02.RData")
message("Completed!",appendLF = T)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.