getGEO()無法下載文件:InternetOpenUrl失敗:’無法與服務器建立連接'


其實加載GEOquery包的時候就出現options()的這行代碼

> library(GEOquery)
載入需要的程輯包:Biobase
載入需要的程輯包:BiocGenerics
載入需要的程輯包:parallel

載入程輯包:‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply,
    parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

    anyDuplicated, append, as.data.frame, basename, cbind,
    colnames, dirname, do.call, duplicated, eval, evalq,
    Filter, Find, get, grep, grepl, intersect, is.unsorted,
    lapply, Map, mapply, match, mget, order, paste, pmax,
    pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce,
    rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit, which, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages
    'citation("pkgname")'.

Setting options('download.file.method.GEOquery'='auto')  ####
Setting options('GEOquery.inmemory.gpl'=FALSE)

 其實不僅僅是在加載Bioconductor包的時候會有這樣的連不上的報錯,在下載有些數據的時候也會,比如下載GEO的數據:

> library(GEOquery)
Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)
> if(!file.exists(f)){}
NULL
> if(!file.exists(f)){
+     gset <- getGEO("GSE42872",destdir = ".",AnnotGPL = F,getGPL = F)
+     save(gset,file = f)
+ }
Found 1 file(s)
GSE42872_series_matrix.txt.gz
試開URL’https://ftp.ncbi.nlm.nih.gov/geo/series/GSE42nnn/GSE42872/matrix/GSE42872_series_matrix.txt.gz'
 Error in download.file(sprintf("https://ftp.ncbi.nlm.nih.gov/geo/series/%s/%s/matrix/%s",  : 
  無法打開URL'https://ftp.ncbi.nlm.nih.gov/geo/series/GSE42nnn/GSE42872/matrix/GSE42872_series_matrix.txt.gz' 
3.
download.file(sprintf("https://ftp.ncbi.nlm.nih.gov/geo/series/%s/%s/matrix/%s", 
    stub, GEO, b[i]), destfile = destfile, mode = "wb", method = getOption("download.file.method.GEOquery")) 
2.
getAndParseGSEMatrices(GEO, destdir, AnnotGPL = AnnotGPL, getGPL = getGPL, 
    parseCharacteristics = parseCharacteristics) 
1.
getGEO("GSE42872", destdir = ".", AnnotGPL = F, getGPL = F) 

當把options('download.file.method.GEOquery'='auto') 改成 options('download.file.method.GEOquery'='libcurl')的時候就可以下載了!、

> options('download.file.method.GEOquery'='libcurl')
> if(!file.exists(f)){
+     gset <- getGEO("GSE42872",destdir = ".",AnnotGPL = F,getGPL = F)
+     save(gset,file = f)
+ }
Found 1 file(s)
GSE42872_series_matrix.txt.gz
試開URL’https://ftp.ncbi.nlm.nih.gov/geo/series/GSE42nnn/GSE42872/matrix/GSE42872_series_matrix.txt.gz'
Content length 768865 bytes (750 KB)
downloaded 750 KB

Parsed with column specification:
cols(
  ID_REF = col_double(),
  GSM1052615 = col_double(),
  GSM1052616 = col_double(),
  GSM1052617 = col_double(),
  GSM1052618 = col_double(),
  GSM1052619 = col_double(),
  GSM1052620 = col_double()
)
|===========================================================| 100%    1 MB
> class(gset)
[1] "list"
> length(gset)
[1] 1
> gset
$GSE42872_series_matrix.txt.gz
ExpressionSet (storageMode: lockedEnvironment)
assayData: 33297 features, 6 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: GSM1052615 GSM1052616 ... GSM1052620 (6 total)
  varLabels: title geo_accession ... cell type:ch1 (34 total)
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
  pubMedIds: 24469106 
Annotation: GPL6244

 更正一下:有的時候也不定有用,咳咳。。。比如gpl6244 <- getGEO("GPL6244",destdir = "."),下載個平台注釋文件老是下部完整就完了,無奈!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM