jsonToRCX: Convert parsed JSON aspects to RCX

Description Usage Arguments Details Value See Also Examples

View source: R/Json-fromJson.R

Description

Functions to handle parsed JSON for the different aspects.

Usage

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
jsonToRCX(jsonData, verbose)

## Default S3 method:
jsonToRCX(jsonData, verbose)

## S3 method for class 'status'
jsonToRCX(jsonData, verbose)

## S3 method for class 'numberVerification'
jsonToRCX(jsonData, verbose)

## S3 method for class 'metaData'
jsonToRCX(jsonData, verbose)

## S3 method for class 'nodes'
jsonToRCX(jsonData, verbose)

## S3 method for class 'edges'
jsonToRCX(jsonData, verbose)

## S3 method for class 'nodeAttributes'
jsonToRCX(jsonData, verbose)

## S3 method for class 'edgeAttributes'
jsonToRCX(jsonData, verbose)

## S3 method for class 'networkAttributes'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cartesianLayout'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cyGroups'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cyHiddenAttributes'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cyNetworkRelations'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cySubNetworks'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cyTableColumn'
jsonToRCX(jsonData, verbose)

## S3 method for class 'cyVisualProperties'
jsonToRCX(jsonData, verbose)

Arguments

jsonData

nested list from parsed JSON

verbose

logical; whether to print what is happening

Details

These functions will be used in processCX to process the JSON data for every aspect. Each aspect is accessible in the CX-JSON by a particular accession name (i.e. its aspect name; see NDEx documentation: https://home.ndexbio.org/data-model/). This name is used as class to handle different aspects by method dispatch. This simplifies the extension of RCX for non-standard or self-defined aspects.

The CX-JSON is parsed to R data types using the jsonlite package as follows:

jsonlite::fromJSON(cx, simplifyVector = F)

This results in a list of lists (of lists...) to avoid automatic data type conversions, which affect the correctness and usability of the data. Simplified JSON data for example NodeAttributes would be coerced into a data.frame, therefore the value column looses the format for data types other than string.

The jsonData will be a list with only one element named by the aspect: jsonData$<accessionName>

To access the parsed data for example nodes, this can be done by jsonData$nodes. The single aspects are then created using the corresponding create functions and combined to an RCX object using the corresponding update functions.

Value

created aspect or NULL

See Also

rcxToJson, toCX, readCX, writeCX

Examples

1
2
3
4
5
nodesJD = list(nodes=list(list("@id"=6, name="EGFR"),
                          list("@id"=7, name="CDK3")))
class(nodesJD) = c("nodes", class(nodesJD))

jsonToRCX(nodesJD, verbose=TRUE)

frankkramer-lab/RCX documentation built on July 14, 2021, 6:33 p.m.