To begin conducting analysis using DataSHIELD, you first need to log in to each server that has data you want to access. This is done by creating a data frame to store all the login information necessary to access a DataSHIELD server. You can save this information (as an R script) for future logins, so you don’t need to gather it each time.
TBC
First you need to load the core DataSHIELD packages. If you haven't yet installed them, follow these instructions.
library(DSI)
library(DSOpal)
library(DSMolgenisArmadillo)
First we create a container to which we will add details of each server:
builder <- DSI::newDSLoginBuilder()
First you need to fetch a token. Running this code will open a window in your browser. Click 'ok'.
armadillo_demo_url <- "https://armadillo-demo.molgenis.net/"
armadillo_token <- armadillo.get_token(armadillo_demo_url)
This has now stored a token in your local R environment. If you are logging into multiple Armadillo servers you will need to fetch a token for each server, and call it something different.
You can then use this token in the login details for that server.
builder$append(
server = "server1",
url = armadillo_demo_url,
token = armadillo_token,
driver = "ArmadilloDriver")
Opal servers normally use a username and password so you skip the token step:
opal_demo_url <- "https://opal-demo.obiba.org/"
builder$append(
server = "server2",
url = opal_demo_url,
user = "dsuser",
password = "P@ssw0rd",
driver = "OpalDriver")
You will need to repeat the previous steps for each cohort. Once you have added login information for all cohorts, you can build the final login object:
logindata <- builder$build()
Now you can use this object to login to all of the servers, using the following code:
connections <- DSI::datashield.login(logins = logindata, assign = FALSE)
Finally, when you have finished using DataSHIELD you can log out:
datashield.logout(connections)