toCX: Convert an RCX object to CX (JSON)

View source: R/Json-toJson.R

toCXR Documentation

Convert an RCX object to CX (JSON)

Description

This function converts an RCX object to JSON in a valid CX data structure (see NDEx documentation: https://home.ndexbio.org/data-model/).

Usage

toCX(rcx, verbose = FALSE, pretty = FALSE)

Arguments

rcx

RCX object

verbose

logical; whether to print what is happening

pretty

logical; adds indentation whitespace to JSON output. Can be TRUE/FALSE or a number specifying the number of spaces to indent. See jsonlite::prettify()

Details

The single aspects of the RCX object are processed by generic functions of rcxToJson for each aspect class. Therefore, not only the single aspects are converted to JSON, but also necessary additional aspects are added, so the resulting CX is accepted by the NDEx platform (https://ndexbio.org/):

  • numberVerication shows the supported maximal number

  • status is needed at the end to show, that no errors have occurred while creation

If the RCX object contains additional aspects besides the officially defined ones, the corresponding rcxToJson functions for those aspect classes have to be implemented in order to include them in the resulting CX.

Value

CX (JSON) text

See Also

toCX, rcxToJson, readCX, writeCX

Examples

rcx = createRCX(
  nodes = createNodes(
    name = LETTERS[seq_len(10)]
  ),
  edges = createEdges(
    source=c(1,2),
    target = c(2,3)
  )
)

json = toCX(rcx, pretty=TRUE)

frankkramer-lab/RCX documentation built on Feb. 4, 2023, 5:12 p.m.