Database download ends with error for AnnotationHub
2
0
Entering edit mode
@arman-shahrisa-7713
Last seen 5.4 years ago

I have to install AnnotationHub for "Introduction to Bioconductor" class in edx. I'm using R 3.1.3 due to limitations of class. I can install "AnnotationHub" and execute library function for it. But after typing "AnnotationHub()", it ends with error. I have tried it multiple times, tried it via VPN and proxy. I have cleared R memory and even restarted operating system (windows 8.1). The AnnotationHub ends with the same error shortly after executing the command. I can install any R or Bioconductor package through my internet connection. The only problem is with AnnotationHub. Is there any way to fix the error or can anybody zip it's database and tell me to which folders I should copy them?

 

Error message:

Error in unlist(.metadata(snapshotUrl, columns = "RDataPath")) :
  error in evaluating the argument 'x' in selecting a method for function 'unlist': Error: error reading from connection

software error • 2.4k views
ADD COMMENT
1
Entering edit mode

Hi,

Please include the output of traceback() and sessionInfo() after getting this error.
 

Then we can try to troubleshoot the problem. Another thing to try is, in a fresh R session, before loading AnnotationHub, do 

setInternet2(TRUE)

 

ADD REPLY
0
Entering edit mode

Traceback():     

3: unlist(.metadata(snapshotUrl, columns = "RDataPath"))
2: .snapshotPaths(snapshotUrl)
1: AnnotationHub()

sessioninfo()

loaded via a namespace (and not attached):
 [1] annotate_1.44.0              AnnotationDbi_1.28.2        
 [3] Biobase_2.26.0               BiocInstaller_1.16.4        
 [5] Category_2.32.0              colorspace_1.2-6            
 [7] DBI_0.3.1                    digest_0.6.8                
 [9] genefilter_1.48.1            GenomeInfoDb_1.2.5          
[11] GenomicRanges_1.18.4         ggplot2_1.0.1               
[13] graph_1.44.1                 grid_3.1.3                  
[15] gridSVG_1.4-3                GSEABase_1.28.0             
[17] gtable_0.1.2                 htmltools_0.2.6             
[19] httpuv_1.3.2                 httr_0.6.1                  
[21] interactiveDisplay_1.4.1     interactiveDisplayBase_1.4.0
[23] lattice_0.20-31              magrittr_1.5                
[25] MASS_7.3-40                  Matrix_1.2-0                
[27] mime_0.3                     munsell_0.4.2               
[29] plyr_1.8.2                   proto_0.3-10                
[31] R6_2.0.1                     RBGL_1.42.0                 
[33] Rcpp_0.11.6                  reshape2_1.4.1              
[35] rjson_0.2.15                 RJSONIO_1.3-0               
[37] RSQLite_1.0.0                scales_0.2.4                
[39] shiny_0.11.1                 splines_3.1.3               
[41] stringi_0.4-1                stringr_1.0.0               
[43] survival_2.38-1              tools_3.1.3                 
[45] XML_3.98-1.1                 xtable_1.7-4                
[47] XVector_0.6.0 

setInternet2(TRUE) didn't solve the problem.

ADD REPLY
0
Entering edit mode
@arman-shahrisa-7713
Last seen 5.4 years ago

Any help would be appreciated! I think the problem is with database. Does anybody knows whether databases for older versions of AnnotationHub have been removed?

ADD COMMENT
0
Entering edit mode

The sessionInfo() you posted is not complete; it doesn't show your R version and platform. In any case, I could not reproduce this problem in R-3.1.3 on Windows. I suggest you update to R-3.2.0. AnnotationHub in the current release version of Bioconductor (which runs on R-3.2.0)  has been completely overhauled.

ADD REPLY
0
Entering edit mode

You could try manually removing the data base files and re-loading them. I think the files are in a directory like

> hubCache(hub)
[1] "C:\\Users\\mtmorgan/.AnnotationHub"

and you would like to remove the Rda files (I realize you don't  have programmatic access to these files; I'm trying to be explicit about the files to remove.

> dir(hubCache(hub), pattern="Rda", full=TRUE)
[1] "C:\\Users\\mtmorgan/.AnnotationHub/metadata.Rda"    
[2] "C:\\Users\\mtmorgan/.AnnotationHub/snapshotDate.Rda"
> file.remove(dir(hubCache(hub), pattern="Rda", full=TRUE))

and then try again (probably best to do this in a new R session)

> library(AnnotationHub)
> hub = AnnotationHub()

If you run into problems, try debugging

> debug(AnnotationHub:::.metadata)
> hub = AnnotationHub()
debugging in: .metadata(snapshotUrl, columns = "RDataPath")
debug: {
    if (!file.exists(.metadataFile()) || (.lastSnapshotDate() != 
        .latestDate())) 
        .updateMetadata(snapshotUrl)
    metadata <- .metadataFromCache()
    .filterMetadata(metadata, filters, columns)
}

You can step through each line and evaluate R commands, looking for something unusual

Browse[2]> n
debug: if (!file.exists(.metadataFile()) || (.lastSnapshotDate() != 
    .latestDate())) .updateMetadata(snapshotUrl)
Browse[2]> file.exists(.metadataFile())
[1] TRUE
Browse[2]> n
debug: metadata <- .metadataFromCache()
Browse[2]> 
debug: .filterMetadata(metadata, filters, columns)
Browse[2]> class(metadata)
[1] "DataFrame"
attr(,"package")
[1] "S4Vectors"
Browse[2]> dim(metadata)
[1] 10780    18
Browse[2]> filters
list()
Browse[2]> columns
[1] "RDataPath"
Browse[2]> .filterMetadata(metadata, filters, columns)
DataFrame with 10780 rows and 1 column
                                                                                                RDataPath
                                                                                              <character>
1     ensembl/release-69/fasta/ailuropoda_melanoleuca/pep/Ailuropoda_melanoleuca.ailMel1.69.pep.all.fa.rz
2       ensembl/release-69/fasta/anolis_carolinensis/cdna/Anolis_carolinensis.AnoCar2.0.69.cdna.all.fa.rz
3         ensembl/release-69/fasta/anolis_carolinensis/pep/Anolis_carolinensis.AnoCar2.0.69.pep.all.fa.rz
4                            ensembl/release-69/fasta/bos_taurus/cdna/Bos_taurus.UMD3.1.69.cdna.all.fa.rz
5                         ensembl/release-69/fasta/bos_taurus/dna/Bos_taurus.UMD3.1.69.dna.toplevel.fa.rz
...                                                                                                   ...
10776                                         inparanoid8/Orthologs/hom.Xiphophorus_maculatus.inp8.sqlite
10777                                            inparanoid8/Orthologs/hom.Xenopus_tropicalis.inp8.sqlite
10778                                           inparanoid8/Orthologs/hom.Yarrowia_lipolytica.inp8.sqlite
10779                                                              refnet/stamlabTFs-2012.tsv_0.0.1.RData
10780                                                                     refnet/recon202.tsv_0.0.1.RData
Browse[2]> c

It's challenging to help more directly because the problem seems somehow unique to your set-up; please let us know how this goes.

 

 

ADD REPLY
0
Entering edit mode
@arman-shahrisa-7713
Last seen 5.4 years ago

I don't have stable HTTPS connection. I performed your commands but every time it finishes with the same error. Is there anyway to manually download databases and put them in corresponding folder?

By the way, I'm using R 3.1.3 and I can't upgrade it due to limitations of class to strictly use R 3.1.3.

ADD COMMENT
0
Entering edit mode

Please EDIT YOUR RESPONSE to include EXACTLY what you mean. Did the previous files metadata.Rda, snapshotDate.Rda exist? If so, demonstrate that you are able to remove them. I guess the files did not exist, or you are able to successfully remove the old files, and that you are able to use debug() and to step through the individual commands. So perhaps you can step through the .metadata() function as in my response, and Indicate exactly which line fails. If the line is a function call, use undebug(AnnotationHub:::.metadata) to stop debugging the previous function, and then debug() on the troublesome function to step through that function. In particular, you might find that you have trouble in AnnotationHub:::.parseJSONMetadataListViaGET

> AnnotationHub:::.parseJSONMetadataListViaGET
function (url) 
{
    url <- gsub(" ", "%20", url)
    if (getOption("AnnotationHub.debug", FALSE)) 
        .printf("Visiting %s", url)
    t <- tempfile()
    download.file(url, destfile = t, quiet = TRUE)
    j <- fromJSON(file = t)
    rapply(j, .na2na, how = "replace")
}

If you have used debug(AnnotationHub:::.parseJSONMetadataListViaGET) then by the time you get to the line download.file(url, destfile = t, quiet = TRUE) you will be able to see what the variable url is. For me, it is

Browse[2]> url
[1] "http://annotationhub.bioconductor.org/ah/3.0/1.6.0/2014-05-15/query/cols/BiocVersion/cols/DataProvider/cols/Title/cols/SourceFile/cols/Species/cols/SourceUrl/cols/SourceVersion/cols/TaxonomyId/cols/Genome/cols/Description/cols/Tags/cols/RDataClass/cols/RDataPath/cols/Coordinate_1_based/cols/Maintainer/cols/RDataVersion/cols/RDataDateAdded/cols/Recipe"

You could try to manually resolve this link by whatever strategy you intend to use to overcome your poor internet connection, and try to continue from here. One possibility is to experiment with different values of options("download.file.method") as documented on the help page ?download.file.

But (a) you haven't actually shown yet that the problem is with your internet connection; (b) The basic AnnotationHub functionality involves retrieving large files from various internet services, so if the initial data base can't be downloaded because of internet connectivity issues, then it's likely that the resources provided by AnnotationHub are not going to be downloaded and (c) AnnotationHub has changed very significantly since your version of R (yes, your version of R is use by the course you are taking).

I am not sure how successful you will be in the above, or if you will be able to complete the part of your course that relies on AnnotationHub. Perhaps though the exercise has made you more of an expert on R debugging than you had hoped.

 

ADD REPLY
0
Entering edit mode

The command "hubCache(hub)" returns the following error:

Error in hubCache(hub) :
  error in evaluating the argument 'x' in selecting a method for function 'hubCache': Error: object 'hub' not found

also

> traceback()
1: hubCache(hub)

So I wasn't able to remove the files by command. Instead, I searched the files by name and removed them in windows explorer.

> AnnotationHub:::.parseJSONMetadataListViaGET
function (url)
{
    url <- gsub(" ", "%20", url)
    if (getOption("AnnotationHub.debug", FALSE))
        .printf("Visiting %s", url)
    t <- tempfile()
    download.file(url, destfile = t, quiet = TRUE)
    j <- fromJSON(file = t)
    rapply(j, .na2na, how = "replace")
}
<environment: namespace:AnnotationHub>

 

By the way, thank you for your answers.

ADD REPLY

Login before adding your answer.

Traffic: 1108 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6