zoukankan      html  css  js  c++  java
  • 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 = "."),下载个平台注释文件老是下部完整就完了,无奈!

  • 相关阅读:
    final 和 abstract 抽象类
    ajax的同步 和 异步
    自定义控件进阶01_侧滑菜单_快速索引
    自定义控件基础02_下拉刷新_侧拉菜单_自定义属性
    自定义控件基础01_菜单轮__viewPager_下拉框_自定义开关
    解决xxview.measure(0, 0)主动测量控件报错 android.view.InflateException
    Android Studio 笔记
    百度地图_api
    手机卫士13_屏幕适配_异常处理_盈利模式_混淆加密
    手机卫士12_软件锁,应用程序相关
  • 原文地址:https://www.cnblogs.com/SWTwanzhu/p/12970194.html
Copyright © 2011-2022 走看看