retrieve_SpecialCases: Helper functions that utilize special cases of magma...

Description Usage Arguments Details Value Functions Examples

Description

Helper functions that utilize special cases of magma /retrieve

Usage

1
2
3
4
5
6
7
retrieveTemplate(target, projectName, ...)

retrieveModels(target, projectName, ...)

retrieveIds(target, projectName, modelName, ...)

retrieveAttributes(target, projectName, modelName, ...)

Arguments

target

A list, which can be created using magmaRset, containing your authorization 'token' (a string), a 'url' of magma to target (a string), and optional 'opts' for specifying additions parameters for curl requests (a named list).

projectName

Single string. The name of the project you would like to interact with. For options, see retrieveProjects.

...

Additional parameters passed along to the internal '.retrieve()', '.query()', or '.update()' functions, for troubleshooting or advanced-user purposes only:

  • request.only (Logical) & json.params.only (Logical) which 1) stop the function before its main curl request to magma and 2) returns the values that would have been sent to magma in either of two formats.

  • verbose (Logical) sets whether to report the status of the curl request after it is performed.

modelName

Single string. The name of the subset data structure within the project, which are referred to as 'model's in magma, to interact with. For options, see retrieveModels or https://timur.ucsf.edu/<projectName>/map.

Details

These functions aim to help users determine acceptable inputs to other magmaR functions without needing to leave R.

They make properly crafted calls to retrieve which target either the "template" or "identifier" special cases outlined in https://mountetna.github.io/magma.html#retrieve, followed by directly returning the output (retrieveTemplate and retrieveIds), by returning just a targeted portion of that output (retrieveModels), or by returning a targeted portion of a subsequent single-record call to retrieve (retrieveAttributes).

Value

retrieveTemplate = a list conversion of the project's template json.

retrieveModels = a string vector of model names

retrieveIds = a string vector of record names/identifiers.

retrieveAttributes = a string vector of attribute names.

Functions

Examples

 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
if (interactive()) {
    # First, we use magmaRset to create an object which will tell other magmaR
    #  functions our authentication token (as well as some other optional bits).
    # When run in this way, it will ask you to give your token.
    magma <- magmaRset()
    
    template <- retrieveTemplate(
        target = magma,
        projectName = "example")
    str(template, max.level = 4)
        
    models <- retrieveModels(
        target = magma,
        projectName = "example")
    print(models)    

    ids <- retrieveIds(
        target = magma,
        projectName = "example",
        modelName = "rna_seq")
    print(ids)
        
    atts <- retrieveAttributes(
        target = magma,
        projectName = "example",
        modelName = "subject")
    print(atts)
}

magmaR documentation built on Oct. 2, 2021, 5:08 p.m.