通过加载GEOquery包,使用getGEO函数可以得到对应GEO号的表达矩阵,注释信息,样本信息等。以GSE76275为例。
rm(list = ls())
options()$repos #翻墙
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()$BioC_mirror
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
library(GEOquery)
gset <- getGEO('GSE76275', destdir=".",
AnnotGPL = T, ## 注释文件
getGPL = T) ## 平台文件
然而由于网络等问题,getGEO函数可能会出错。

以下为解决方法。
1.表达矩阵
进入GEO网站,找到对应的Series Matrix File(s)即表达矩阵进行下载,保存到本地进行加载。



在R中打开,由于read.table之后的表达矩阵与getGEO之后的有一定出入,需要处理一下。
a1<-read.table("GSE76275_series_matrix.txt.gz",sep="\t",quote = "",
fill=T,comment.char = "!",header=T)
rownames(a1)<-a1[,1] #把第一列的值变为行名
a1<-a1[,-1] #把第一列去掉
# 另外还需要把行名、列名进行一定的处理,去掉前后多余的字符。


2.注释信息
在GEO网站找到GSE76275对应的注释信息号为GPL570

在R中直接单独下载GPL570,可以看到GPL570中含有很多信息,我们可能只需要其GENE ID以及GENE SYMBOL,提取出来即可
GPL570 <- getGEO("GPL570",destdir = ".")
法2 在得到GPL号之后,去菜鸟团网站http://www.bio-info-trainee.com/1399.html 找到对应注释信息的R包

下载并加载R包,可得注释信息。详见https://www.jianshu.com/p/e15ee2cd3174
3.可能getGEO("GPL570",destdir = ".")还是不行
在我们下载好表达矩阵之后,可以再试一次
Gset <- getGEO('GSE76275', destdir=".",
AnnotGPL = F, ## 注释文件
getGPL = F) ## 平台文件
这时因为本地已经存在表达矩阵的文件,可能会促进网络对整体的加载,将样本信息一并下载下来。此后再进行一系列操作就很方便了。
ggset <- Gset[[1]]
pdata <- pData(ggset)
eexprs <- exprs(ggset)
参考来源:生信技能树
友情链接:
课程分享
生信技能树全球公益巡讲
(https://mp.weixin.qq.com/s/E9ykuIbc-2Ja9HOY0bn_6g)
B站公益74小时生信工程师教学视频合辑
(https://mp.weixin.qq.com/s/IyFK7l_WBAiUgqQi8O7Hxw)
招学徒:
(https://mp.weixin.qq.com/s/KgbilzXnFjbKKunuw7NVfw)
欢迎关注公众号:青岛生信菜鸟团
网友评论