STRINGdb offline use (via input_directory argument)
1
0
Entering edit mode
@csoneson-7887
Last seen 2 days ago
Switzerland

Hello,

I am trying to figure out if it is possible to use STRINGdb offline, assuming that all the necessary files have been downloaded locally. I am running

library(STRINGdb)
strdb <- STRINGdb$new(version = "11.5", species = 10090, 
                      score_threshold = 400, input_directory = "~/Desktop/stringdb")
print(strdb) ## this triggers the download of files from STRING to the local directory
strdb$map(data.frame(x = "Sox2"), "x", removeUnmappedRows = FALSE)  ## this downloads the alias file and maps the ID

which will download the necessary files. If I then re-execute the mapping or the initialization of the strdb object, the files will not be re-downloaded. So far, so good.

Now, if I disconnect from the internet and try to re-initialize the object, I get an error as R is not able to open the connection to https://string-db.org/api/tsv-no-header/version:

Error in open.connection(file, "rt") : 
  cannot open the connection to 'https://string-db.org/api/tsv-no-header/version'
In addition: Warning message:
In open.connection(file, "rt") :
  URL 'https://string-db.org/api/tsv-no-header/version': Timeout of 60 seconds was reached

Is there any way that I can force STRINGdb to use the local files, without checking in with the remote server?

Thanks!

Session info:

R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] STRINGdb_2.10.1

loaded via a namespace (and not attached):
 [1] igraph_1.4.1       hash_2.2.6.2       Rcpp_1.0.10        rstudioapi_0.14    magrittr_2.0.3    
 [6] bit_4.0.5          rlang_1.0.6        fastmap_1.1.1      blob_1.2.3         plyr_1.8.8        
[11] caTools_1.18.2     tools_4.2.2        png_0.1-8          plotrix_3.8-2      KernSmooth_2.23-20
[16] cli_3.6.0          DBI_1.1.3          gtools_3.9.4       bit64_4.0.5        RColorBrewer_1.1-3
[21] vctrs_0.5.2        bitops_1.0-7       RCurl_1.98-1.10    cachem_1.0.7       memoise_2.0.1     
[26] RSQLite_2.3.0      gsubfn_0.7         compiler_4.2.2     gplots_3.1.3       chron_2.3-59      
[31] sqldf_0.4-11       proto_1.0.0        pkgconfig_2.0.3
STRINGdb • 1.5k views
ADD COMMENT
1
Entering edit mode
damian.szk ▴ 110
@damianszk-12963
Last seen 4 months ago
Switzerland

Unfortunately, it's not possible. Some features can't work without access to STRING's API, like generating the image, payload, and enrichment functionality. In the future update, the mapping will also move to the API. This is all done for the sake of consistency, so any improvements to STRING's algorithms (between the versions) will be applicable to the STRINGdb package as well. It's impossible for us to maintain the two code bases in sync.

If you do not use images, payload, or the enrichment and only the network, in principle we can skip the version check, and AFAIK it should work. That said you are then better off simply using the STRING package once for mapping and then loading the network from the flat files (found in the download section of STRING, which is where the package gets it from), and do not bother with the package anymore, as it doesn't really give you a lot of additional functionality.

Hope it's clearer, why the package needs access.

Thanks for the feedback!

Damian.

ADD COMMENT
1
Entering edit mode

Yes, makes total sense. In fact what I ultimately want to do is to generate the images, so I'd need the access to the API then anyway. Thanks a lot for the quick and clear reply!

ADD REPLY

Login before adding your answer.

Traffic: 754 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