saezlab / decoupleR

R package to infer biological activities from omics data using a collection of methods.
https://saezlab.github.io/decoupleR/
GNU General Public License v3.0
183 stars 24 forks source link

Options to use locally downloaded database #58

Closed woaidangyang closed 2 years ago

woaidangyang commented 2 years ago

While running net <- get_progeny(organism = 'human', top = 100), I kept getting this error:

[ERROR]   [OmnipathR] Failed to download `https://omnipathdb.org/annotations?resources=PROGENy&license=academic` (attempt 3/3); error: LibreSSL SSL_read: error:02FFF036:system library:func(4095):Connection reset by peer, errno 54
Error in download_base(url, fun, ...) : 
  Failed to download `https://omnipathdb.org/annotations?resources=PROGENy&license=academic` (attempt 3/3); error: LibreSSL SSL_read: error:02FFF036:system library:func(4095):Connection reset by peer, errno 54

But I have no problem downloading https://omnipathdb.org/annotations?resources=PROGENy&license=academic using the browser. I'd like to ask if you can add an option so we can just retrieve the data from the locally downloaded file.

Thank you so much for your great work!

PauBadiaM commented 2 years ago

Hi @woaidangyang,

Thanks for checking out the package! Sorry for the late reply, I was on vacation. In theory you should be able to do this if you place it in the /cache/ folder for OmniPath, but the download should work anyways. @deeenes what could be happening here?

deeenes commented 2 years ago

Hi,

The issue above most likely means that your curl R package was compiled against an old curl library or libressl library, or the operating system's certificate store needs an update, or there is a firewall which interferes with the connection. To know more about the reasons, you can run curl in verbose mode:

library(curl)
library(httr)

# see some details about your curl:
curl_version()

# see the debug trace of this connection:
progeny_url <- 'https://omnipathdb.org/annotations?resources=PROGENy&license=academic'
p <- GET(progeny_url, verbose(data_in = TRUE, info = TRUE, ssl = TRUE))

Also you can try to update the curl R package, it might help, especially if you also update the libcurl and libressl used for the compilation.

To manually insert cache content as Pau suggested, you can extract the attached zip into the cache directory of OmnipathR, and add this to the cache.json file in the directory, with modifying the path /home/... to your actual cache directory:

{
 ...

"3492392585ba05414edfae46801492076437d7e7": {
    "key": ["3492392585ba05414edfae46801492076437d7e7"],
    "url": ["https://omnipathdb.org/annotations?resources=PROGENy&license=academic"],
    "post": [],
    "payload": [],
    "ext": ["rds"],
    "versions": {
      "1": {
        "number": ["1"],
        "path": ["/home/denes/.cache/OmnipathR/3492392585ba05414edfae46801492076437d7e7-1.rds"],
        "dl_started": ["2022-05-18 20:37:10"],
        "status": ["ready"],
        "dl_finished": ["2022-05-18 20:37:12"]
      }
    }
  },

  ...
}

To find the cache directory:

library(OmnipathR)
OmnipathR:::omnipath_get_cachedir()
# [1] "/home/denes/.cache/OmnipathR"

progeny-omnipathr-cache.zip