rm(list=ls())
##this Rcode is used for 1):extract target gene expression from GSE file; and 2) draw box plot
##annotation is accomplished by relevant bioconductor package
##----------------
##GSE matrix file download
if(F){
suppressPackageStartupMessages(library(GEOquery))
eSet <- getGEO('GSE3325', destdir=".",
AnnotGPL = F,
getGPL = F)
#getGPL = F: no GPL will be downloaded
#getGPL = T: a GPLxxx.SOFT file will be downloaded
save(eSet,file='GSE3325_eSet.Rdata')
}
##----------------
##row exprSet(rownames are probeids) and phenotype preparation
load('GSE3325_eSet.Rdata')
b = eSet[[1]]
raw_exprSet=exprs(b)
raw_exprSet[1:4,1:4]
phe=pData(b)
phe$title
library(stringr)
group_list= tolower(str_split(as.character(phe$title),' ',simplify = T)[,2])
# head(group_list);table(group_list)
#identical(rownames(phe),colnames(raw_exprSet)) # the return value must be TRUE
save(raw_exprSet,group_list,
file='GSE3325_raw_exprSet.Rdata')
##----------------
##annotation and pickout intersted genes
rm(list=ls())
load(file='GSE3325_raw_exprSet.Rdata')
#annotation with bioconductor package
suppressPackageStartupMessages(library(hgu133plus2.db))
eg2probe=toTable(hgu133plus2SYMBOL)
#input intersted gene symbol
eg2probe[eg2probe$symbol=='TRAF4',]
raw_exprSet[1:4,1:4]
exprSet=log2(raw_exprSet)
##extract intersted gene expression
exprSet_select <- exprSet[eg2probe[eg2probe$symbol=='TRAF4',]$probe_id,]
##pick out the most max value of rowMeans
dat=data.frame(gene= exprSet_select[which.max(rowMeans(exprSet_select)),],
mut= group_list)
head(dat)
#-----------------
#visualization
if(require('ggpubr')){
library(ggpubr)
# google search : ggpubr boxplot add p-value
# http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/76-add-p-values-and-significance-levels-to-ggplots/
p <- ggboxplot(dat, x = "mut", y = "gene",
color = "mut", palette = "jco",
add = "jitter")
# Add p-value
p + stat_compare_means()
}
if(require('ggstatsplot')){
library(ggstatsplot)
ggbetweenstats(data = dat, x = mut, y = gene)
}
if(require('ggplot2')){
library(ggplot2)
ggplot(dat,aes(x=mut,y=gene))+
geom_boxplot()+
theme_bw()
}
GEO提取任意基因表达量(bioconductor包注释)
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 分析基因芯片的数据,提取出差异表达的基因这次试验的数据来源于文献:https://www.ncbi.nlm.nih...
- 这是ggplot2可视化专题的第一个实例操作 ggplot2的基本思路见前文总论:基于ggplot2的RNA-se...
- R基础-08.任意基因任意癌症表达量分组的生存分析 参考视频【生信技能树】生信人应该这样学R语言代码为自己学习总结...