jsonToRCX: Convert parsed JSON aspects to RCX

View source: R/Json-fromJson.R

jsonToRCXR Documentation

Convert parsed JSON aspects to RCX

Description

Functions to handle parsed JSON for the different aspects.

Usage

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 = FALSE)

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

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 Feb. 4, 2023, 5:12 p.m.