有感于 果子学生信
应用:从TCGA GDC中下载下来的文件进行汇总
library(TCGAbiolinks)
query <- GDCquery(project = "TCGA-LUSC",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - Counts" )
GDCdownload(query)
# 所有下载的counts数据存在“./GDCdata/TCGA-LUSC/harmonized/Transcriptome_Profiling”;
# 并且被保存在一个个文件夹内
# 接下来首先将每个文件夹内的文件转自一个文件内"./expr_data/raw_data_in_one"
dirname <- "001a2541-a9d3-4811-97bf-d8fcd89b4c66"
for (dirname in dir("./GDCdata/TCGA-LUSC/harmonized/Transcriptome_Profiling/Gene_Expression_Quantification/")) {
## use list.files function to find single file within “./GDCdata/TCGA-LUSC/harmonized/Transcriptome_Profiling”
file <- list.files(path = paste0(getwd(),
"/GDCdata/TCGA-LUSC/harmonized/Transcriptome_Profiling/Gene_Expression_Quantification/",
dirname),pattern = "*.counts.gz") #找到文件中的内容,pattern可以是正则表达式
## 使用file.copy函数复制黏贴压缩文件到raw_data_in_one
file.copy(paste0(getwd(),"/GDCdata/TCGA-LUSC/harmonized/Transcriptome_Profiling/Gene_Expression_Quantification/",
dirname,"/",file),to = "./expr_data/raw_data_in_one") #复制内容到新的文件夹
}
联系客服