gdc-client download -m gdc_manifest_2021.txt -d ./
## -m的意思是下载manifest,后面接着文件列表的txt文件名称,-d是下载的文件药储存的地方
下载之后的文件,一个样本在一个文件夹下并且为gz格式
2.批量解压缩子目录中的gz文件:
find . -name '*.gz' |xargs gunzip {}
3.整理合并所有样本的基因counts matrix
options(stringAsFactors=F)
count_files=dir("./",pattern="*.htseq_counts.txt$",recursive=T)
exp=list()
for(i in 1:length(count_files)){exp[[i]] = read.table(paste("./",count_files[[i]],sep=""),row.names=1,sep="\t")}
## 先观察genid顺序是否一致
gene_name=lapply(exp,function(x){rownames(x)})
all_ssample_name=do.call(cbind,gene_name)
a=all_ssample_name[,1]
apply(all_ssample_name,2,function(x){identical(x,a)})
## 合并matrix
exp=do.call(cbind,exp)
dim(exp);exp[1:4,1:4]
save(count_files,file="./files_order.Rdata")
write.table(exp,file="./allSample_exp.txt",col.names=F,sep="\t",row.names=T,quote=F)