readCX function combines three sub-task:
read the JSON from file
parse the JSON
process the contained aspects to create an RCX object
1 2 3 4 5 6 7
character; the name of the file which the data are to be read from
logical; whether to print what is happening
named character; accession names and aspect classes aspectClasses
character; raw JSON data
list; list containing the aspect data (parsed JSON)
If any errors occur during this process, the single steps can be performed individually. This also allows to skip certain steps, for example if the JSON data is already availabe as text, there is no need to save it as file and read it again.
readJSON function only read the content of a text file and returns it as a simple character vector.
parseJSON function uses the jsonlite package, to parse JSON text:
jsonlite::fromJSON(cx, simplifyVector = FALSE)
The result is a list containing the aspect data as elements. If, for some reason, the JSON is not valid, the jsonlite package raises an error.
processCX function, the single elements from the previous list will be processed with the jsonToRCX functions,
which creating objects for the single aspects.
The standard CX aspects are processed by generic functions named by the aspect names of the CX data structure, e.g.
jsonToRCX.nodeAttributes for the samely named CX aspect the corresponding
NodeAttributesAspect in RCX
vignette("02. The RCX and CX Data Model") or NDEx documentation: https://home.ndexbio.org/data-model/).
The CX network may contain additional aspects besides the officially defined ones.
This includes self defined or deprecated aspects, that sill can be found in the networks at the NDEx platform.
By default, those aspects are simply omitted.
In those cases, the setting verbose to
TRUE is a good idea to see, which aspects cannot be processed this package.
Those not processable aspects can be handled individually, but it is advisable to extend the jsonToRCX functions by
implementing own versions for those aspects.
Additionally, the update functions have to be implemented to add the newly generated aspect objects
to RCX object (see e.g. updateNodes or updateEdges).
Therefore, the function also have to be named
"update<aspect-name>, where aspect-name is the capitalized version of the
name used in the CX.
vignette("03. Extending the RCX Data Model")
readJSON: Reads the CX/JSON from file and returns the content as text
parseJSON: Parses the JSON text and returns a list with the aspect data
processCX: Processes the list of aspect data and creates an RCX
1 2 3 4 5 6 7 8 9 10 11 12 13
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.