rcx_fromJSON: Create RCX object from JSON data

Description Usage Arguments Details Value See Also Examples

View source: R/ndex_RCX.r

Description

This function creates an RCX object from a supplied JSON-encoded CX object. RCX objects store the CX data as a named list of data.frames containing metaData and all aspects of the network.

Usage

1
rcx_fromJSON(json, verbose = FALSE)

Arguments

json

JSON data

verbose

logical; whether to print out extended feedback

Details

The structure of an RCX object, as shown via str(rcx) could be a list like this:

 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
> str(rcx)

List of 12
$ metaData          :'data.frame':    11 obs. of  7 variables:
  ..$ name            : chr [1:11] "citations" "@context" "edgeAttributes" "edgeCitations" ...
  ..$ consistencyGroup: int [1:11] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ elementCount    : int [1:11] 4 23 NA NA 11 1 NA NA NA 5 ...
  ..$ lastUpdate      : num [1:11] 1.44e+12 1.44e+12 1.44e+12 1.44e+12 1.44e+12 ...
  ..$ version         : chr [1:11] "1.0" "1.0" "1.0" "1.0" ...
  ..$ idCounter       : int [1:11] 60714397 NA NA NA 60714399 NA NA NA NA 60714395 ...
  ..$ properties      :List of 11
$ numberVerification:'data.frame':    1 obs. of  1 variable:
  ..$ longNumber: num 2.81e+14
$ ndexStatus        :'data.frame':    1 obs. of  10 variables:
  ..$ externalId      : chr "eac8a4b8-6194-11e5-8ac5-06603eb7f303"
  ..$ creationTime    : num 1.44e+12
  ..$ modificationTime: num 1.44e+12
  ..$ visibility      : chr "PUBLIC"
  ..$ published       : logi FALSE
  ..$ nodeCount       : int 5
  ..$ edgeCount       : int 11
  ..$ owner           : chr "nci-pid"
  ..$ ndexServerURI   : chr "http://public.ndexbio.org"
  ..$ readOnly        : logi FALSE
$ @context          :'data.frame':    1 obs. of  23 variables:
  ..$ GENPEPT                      : chr "http://www.ncbi.nlm.nih.gov/protein/"
  ..$ NCBI GENE                    : chr "http://identifiers.org/ncbigene/"
  ..$ ENSEMBL                      : chr "http://identifiers.org/ensembl/"
  [...]
$ networkAttributes :'data.frame':    4 obs. of  2 variables:
  ..$ n: chr [1:4] "name" "description" "version" "ndex:sourceFormat"
  ..$ v: chr [1:4] "PLK3 signaling events" "This network ..." [...]
$ citations         :'data.frame':    4 obs. of  7 variables:
 ..$ @id           : int [1:4] 60714380 60714383 60714386 60714397
 ..$ dc:identifier : chr [1:4] "pmid:17264206" "pmid:14968113" "pmid:12242661" "pmid:11551930"
 ..$ dc:type       : chr [1:4] "URI" "URI" "URI" "URI"
 ..$ attributes    :List of 4 [...]
$ nodes             :'data.frame':    5 obs. of  2 variables:
 ..$ @id: int [1:5] 60714376 60714377 60714381 60714384 60714395
 ..$ n  : chr [1:5] "CCNE1" "PLK3" "MPIP3" "CHK2" ...
$ nodeAttributes    :'data.frame':    10 obs. of  4 variables:
  ..$ po: int [1:10] 60714376 60714376 60714377 60714377 60714381 60714381 60714384 60714384 60714395 60714395
  ..$ n : chr [1:10] "alias" "relatedTo" "alias" "relatedTo" ...
  ..$ v :List of 10
    .. ..$ : chr [1:6] "UniProt Knowledgebase:Q92501" "UniProt Knowledgebase:Q9UD21"  ...
    .. ..$ : chr [1:98] "GENE ONTOLOGY:GO:0003713" "GENE ONTOLOGY:GO:0005515"  ...
    [...]
  ..$ d : chr [1:10] "list_of_string"  ...
$ edges             :'data.frame':    11 obs. of  4 variables:
  ..$ @id: int [1:11] 60714379 60714382  ...
  ..$ s  : int [1:11] 60714376 60714381  ...
  ..$ t  : int [1:11] 60714377 60714377  ...
  ..$ i  : chr [1:11] "neighbor-of" "neighbor-of"  ...
$ edgeCitations     :'data.frame':    11 obs. of  2 variables:
  ..$ po       :List of 11
  .. ..$ : int 60714379
  .. ..$ : int 60714382
  [...]
..$ citations:List of 11
.. ..$ : int 60714380
.. ..$ : int 60714383
  [...]
$ status            :'data.frame':    1 obs. of  2 variables:
  ..$ error  : chr ""
  ..$ success: logi TRUE
- attr(*, "class")= chr [1:2] "RCX" "list"

The data.frames representing nodes and edges could look like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
> rcx[["nodes"]]
   @id     n
 1 60714376 CCNE1
 2 60714377  PLK3
 3 60714381 MPIP3
 4 60714384  CHK2
 5 60714395   P53

> rcx[["edges"]]
    @id        s        t                           i
 1  60714379 60714376 60714377                 neighbor-of
 2  60714382 60714381 60714377                 neighbor-of
 3  60714385 60714384 60714377                 neighbor-of
 4  60714388 60714377 60714376      controls-expression-of
 5  60714390 60714377 60714381 controls-phosphorylation-of
 6  60714392 60714377 60714381    controls-state-change-of
 7  60714393 60714377 60714384 controls-phosphorylation-of
 8  60714394 60714377 60714384    controls-state-change-of
 9  60714396 60714377 60714395 controls-phosphorylation-of
 10 60714398 60714377 60714395    controls-state-change-of
 11 60714399 60714377 60714395                 neighbor-of

Value

returns object of class RCX if successfull, NULL otherwise

See Also

rcxgraph_fromRCX rcxgraph_toRCX rcx_toJSON

Examples

1
2
3
4
5
6
## Create an RCX object
rcx = rcx_new(c('@id'=1, n='Some Name', r='HGNC:Symbol'))
## Convert to JSON
json = rcx_toJSON(rcx)
## Convert it back from JSON
rcx = rcx_fromJSON(json)

ndexr documentation built on March 13, 2021, 2 a.m.