求助:使用GEOquery::getGEO加载GSE166427表达集失败
解决GEOquery获取GSE166427(GPL13667)表达集的错误问题
问题背景
我正在基于平台GPL13667处理GEO数据集GSE166427,尝试用以下R脚本获取数据,但最后一行执行时出现错误与警告,导致表达集无法加载。
初始脚本
library(Biobase) library(GEOquery) library(limma) series <- "GSE166427" platform <- "GPL13667" setwd("D:/Proj/DEGs/COAD DEGs/") Sys.setenv(VROOM_CONNECTION_SIZE=131072*10) gset <- getGEO(series, GSEMatrix = TRUE, AnnotGPL = TRUE, destdir = "COAD Data/")
初始执行错误信息
Found 2 file(s) GSE166427-GPL13534_series_matrix.txt.gz Using locally cached version: COAD Data//GSE166427-GPL13534_series_matrix.txt.gz Rows: 0 Columns: 241 - Column specification ----------------------------------------------------------------------------------- Delimiter: "\t" chr (241): ID_REF, GSM3759532, GSM3759533, GSM3759534, GSM3759535, GSM3759536, GSM3759537, GSM3759538, ... i Use `spec()` to retrieve the full column specification for this data. i Specify the column types or set `show_col_types = FALSE` to quiet this message. Annotation GPL not available, so will use submitter GPL instead Using locally cached version of GPL13534 found here: `COAD Data//GPL13534.soft` Error in `parseGSEMatrix(fname, destdir = destdir, AnnotGPL = AnnotGPL, : parsing failed--expected only one '!series_data_table_begin'` In addition: Warning message: In `download.file(myurl, destfile, mode = mode, quiet = TRUE, method = getOption("download.file.method.GEOquery"))` : cannot open URL <https://ftp.ncbi.nlm.nih.gov/geo/platforms/GPL13nnn/GPL13534/annot/GPL13534.annot.gz>: HTTP status was '404 Not Found'
修改后的脚本(仍报错)
gset <- getGEO(series, filename ="COAD Data/GSE166427-GPL13667_series_matrix.txt.gz", GSEMatrix = TRUE, AnnotGPL = TRUE, destdir = "COAD Data/")
修改后执行错误信息
Rows: 49386 Columns: 247 - Column specification ----------------------------------------------------------------------------------- `Delimiter: "\t"` chr (1): ID_REF dbl (246): GSM1077598, GSM1077599, GSM1077600, GSM1077601, GSM1077602, GSM1077603, GSM1077604, GSM10776... i Use `spec()` to retrieve the full column specification for this data. i Specify the column types or set `show_col_types = FALSE` to quiet this message. Annotation GPL not available, so will use submitter GPL instead Using locally cached version of GPL13667 found here: `COAD Data//GPL13667.soft` Error in `.rowNamesDF <- (x, value = value) : invalid 'row.names' length` In addition: Warning messages: 1: In `download.file(myurl, destfile, mode = mode, quiet = TRUE, method = getOption("download.file.method.GEOquery"))` : cannot open URL <https://ftp.ncbi.nlm.nih.gov/geo/platforms/GPL13nnn/GPL13667/annot/GPL13667.annot.gz> : HTTP status was '404 Not Found' 2: One or more parsing issues, call `problems()` on your data frame for details, e.g.: `dat <- vroom(...)` problems(dat)
会话信息
> sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default
解决方案
错误原因分析
- 多平台数据集默认加载错误平台:GSE166427包含两个平台(GPL13534和GPL13667),
getGEO默认会加载第一个平台的数据,导致获取到非目标平台的空矩阵。 - 官方注释文件不存在:GPL13534和GPL13667的官方注释文件在NCBI FTP上已不存在(404错误),开启
AnnotGPL = TRUE会触发无效下载请求,同时导致注释与表达矩阵匹配失败。 - 手动指定文件导致行名不匹配:直接指定本地文件时,提交者提供的注释文件与表达矩阵的行数量不一致,引发行名长度错误。
修正后的完整脚本
library(Biobase) library(GEOquery) library(limma) series <- "GSE166427" target_platform <- "GPL13667" setwd("D:/Proj/DEGs/COAD DEGs/") Sys.setenv(VROOM_CONNECTION_SIZE=131072*10) # 核心修正:指定目标平台,关闭无效的官方注释下载 gset <- getGEO(series, GSEMatrix = TRUE, AnnotGPL = FALSE, # 跳过官方注释下载,避免404 destdir = "COAD Data/", platform = target_platform) # 明确指定要加载的平台 # 确保获取到正确的表达集(若返回列表则取第一个元素) if (is.list(gset)) { gset <- gset[[1]] } # 验证表达集加载结果 print(paste("加载的表达集平台:", annotation(gset))) head(exprs(gset))
关键修改说明
platform = target_platform:强制getGEO加载指定平台(GPL13667)的数据集,避免默认加载错误平台的问题。AnnotGPL = FALSE:关闭官方注释文件的自动下载,改用提交者上传的注释信息,解决404错误和注释匹配失败问题。- 列表判断处理:当数据集包含多个平台时,
getGEO会返回列表,手动选取第一个元素即可得到目标平台的表达集。
额外处理建议
如果仍然遇到行名错误或解析问题:
- 删除
COAD Data/目录下的所有缓存文件(包括.txt.gz和.soft文件),让getGEO重新下载完整的数据集文件。 - 检查本地网络连接,确保能正常访问NCBI FTP服务器。
- 若需要更完整的注释信息,可以手动从GEO平台页面下载GPL13667的注释文件,后续通过
annotateEset函数手动添加注释。
内容的提问来源于stack exchange,提问作者mori
相关产品推荐
相关产品推荐

