title: TCGAbiolinks (一) 获得counts矩阵 tags: [] id: '1655' categories:
packageVersion("TCGAbiolinks") # 2.25.0
library(TCGAbiolinks)
library(plyr)
library(SummarizedExperiment)
# 查看癌症类型
TCGAbiolinks:::getGDCprojects()$project_id
# 查看对应癌症的数据类型
TCGAbiolinks:::getProjectSummary('TCGA-PRAD') # 以前列腺癌为例
# 一般的前列腺癌 GDC Data Portal 是 hg38 的
PRAD <- GDCquery(project = 'TCGA-PRAD',
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts")
# 选择病例列 ,不加cols参数则是完整结果的全部列
PRAD_cases <- getResults(PRAD,cols=c("cases"))
# 选择癌组织数据
PRAD_tp <- TCGAquery_SampleTypes(barcode = PRAD_cases, typesample = "TP")
PRAD_D <- GDCquery(project = 'TCGA-PRAD',
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts",
barcode = PRAD_tp)
PRAD_D <- GDCquery(project = 'TCGA-PRAD',
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts",
barcode = PRAD_tp)
GDCdownload(query = PRAD_D)
PRAD <- GDCprepare(query = PRAD_D, save = TRUE, save.filename = "PRAD.rda")
counts <- PRAD@assays@data$unstranded
colnames(counts) <- PRAD@colData$patient
rownames(counts) <- PRAD@rowRanges$gene_name