1.安装加载RTCGA:R包
#加载包
library(RTCGA)
library(RTCGA.clinical)
library(RTCGA.miRNASeq)
library(RTCGA.mRNA)
library(RTCGA.rnaseq)
library(RTCGA.mutations)
2.指定基因HSF1从癌症里获取芯片表达数据
Breast invasive carcinoma (BRCA)
Ovarian serous cystadenocarcinoma (OV)
Lung squamous cell carcinoma (LUSC)
expr<-expressionsTCGA(BRCA.mRNA,OV.mRNA,LUSC.mRNA,
extract.cols = c("HSF1")
)
expr
bcr_patient_barcode dataset HSF1
<chr> <chr> <dbl>
1 TCGA-A1-A0SD-01A-11R-A115-07 BRCA.mRNA -0.290
2 TCGA-A1-A0SE-01A-11R-A084-07 BRCA.mRNA 0.134
3 TCGA-A1-A0SH-01A-11R-A084-07 BRCA.mRNA 0.332
4 TCGA-A1-A0SJ-01A-11R-A084-07 BRCA.mRNA 0.614
5 TCGA-A1-A0SK-01A-12R-A084-07 BRCA.mRNA 1.09
6 TCGA-A1-A0SM-01A-11R-A084-07 BRCA.mRNA -0.124
7 TCGA-A1-A0SO-01A-22R-A084-07 BRCA.mRNA -1.3
8 TCGA-A1-A0SP-01A-11R-A084-07 BRCA.mRNA 0.797
9 TCGA-A2-A04N-01A-11R-A115-07 BRCA.mRNA 0.0912
10 TCGA-A2-A04P-01A-31R-A034-07 BRCA.mRNA 1.04
# ... with 1,295 more rows
3.查看cancers种类
nb_samples<-table(expr$dataset)
> nb_samples
BRCA.mRNA LUSC.mRNA OV.mRNA
590 154 561
>
4.修改前两列
expr$dataset<-gsub(pattern = ".mRNA",replacement = "",expr$dataset)
expr$bcr_patient_barcode<-paste0(expr$dataset,c(1:590,1:561,1:154))
5.绘制基因HSF1在不同的癌症的表达量boxplot
library(ggpubr)
my_comparisons <- list(c("BRCA", "OV"), c("OV", "LUSC"))
ggboxplot(expr, x = "dataset", y = "HSF1",
title = "HSF1", ylab = "Expression",
color = "dataset", palette = "jco")+
stat_compare_means(comparisons =my_comparisons)