Description Usage Arguments Details Value Examples
projects()
returns projects available to the
currently authenticated user
schema()
returns all type names (objects) defined in
the Gen3 schema. Type names form the basis of queries.
fields()
returns fields defined on the type name. A
field has associated values that can be retrieved by queries.
values()
returns values corresponding to fields of
type_name
. Each row represents a record in the database.
query_graphql()
allows arbitrary queries against the
graphql database.
1 2 3 4 5 6 7 8 9 |
as |
for |
type_name |
|
... |
|
.n |
integer(1) number of records to retieve. The special
value |
query |
character(1) valid graphql query to be evaluated by the database. |
Generally, GraphQL schema()
fields starting with '_',
e.g., 'subjects_count', are returned with the leading ''
replaced by '.', e.g., '.subjects_count'.
projects()
returns a tibble with project_id, id, and
study_description. There are as many rows as there are projects
accessbile to the current user.
schema()
returns a tibble with with a single columm
("name"
) corresponding to the type names available in Gen3.
fields()
returns a tibble with columns type_name
,
field
(name of corresponding fields in type name) and type
(type of field, e.g., String, Int).
values()
returns a tibble with type_name and field names
as columns, with one row for each record queried.
query_graphql()
returns JSON-like list-of-lists following
the structure of the query, but with terminal data.frame-like
collections simplified to a tibbles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Authenticate first; prefer authentication with credentials
response <- tryCatch(authenticate(), error = identity)
if (inherits(response, "error")) {
## perhaps credentials are cached...
cache <- tools::R_user_dir("Gen3", "cache")
credentials <- file.path(cache, "credentials.json")
stopifnot(
`no credentials file, cannot authenticate` = file.exists(credentials)
)
authenticate(credentials)
}
projects()
schema()
fields("subject")
values("subject", "id", "sex")
query <- '{
subject(
project_id: "open_access-1000Genomes"
first: 0
) {
id
sex
population
submitter_id
}
}'
result <- query_graphql(query)
result
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.