updateCartesianLayout: Update Cartesian Layouts

Description Usage Arguments Details Value Examples

View source: R/RCX-CartesianLayout.R

Description

This functions add a cartesian layout in the form of a CartesianLayout object to an other CartesianLayout or an RCX object.

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
updateCartesianLayout(
  x,
  cartesianLayout,
  replace = T,
  stopOnDuplicates = F,
  ...
)

## S3 method for class 'CartesianLayoutAspect'
updateCartesianLayout(
  x,
  cartesianLayout,
  replace = T,
  stopOnDuplicates = F,
  ...
)

## S3 method for class 'RCX'
updateCartesianLayout(
  x,
  cartesianLayout,
  replace = T,
  stopOnDuplicates = F,
  checkReferences = T,
  ...
)

Arguments

x

RCX or CartesianLayout object; (to which the new layout will be added)

cartesianLayout

CartesianLayout object; (the layout, that will be added)

replace

logical; if existing values are updated (or ignored)

stopOnDuplicates

logical; whether to stop, if duplicates in nodes (and view if present) column are found

...

additional parameters

checkReferences

logical; whether to check if references to other aspects are present in the RCX object

Details

Networks, or more precisely its nodes may have a cartesian layout, that is represented as CartesianLayout object. CartesianLayout objects can be added to an RCX or an other CartesianLayout object.

In the case, that a CartesianLayout object is added to an other, or the RCX object already contains a CartesianLayout object, some attributes might be present in both. By default, the properties are updated with the values of the latest one. This can prevented by setting the replace parameter to FALSE, in that case only new properties are added and the existing properties remain untouched.

Furthermore, if duplicated properties are considered as a preventable mistake, an error can be raised by setting stopOnDuplicates to TRUE. This forces the function to stop and raise an error, if duplicated properties are present.

Value

CartesianLayoutAspect or RCX object with added layout

Examples

 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
## For CartesianLayoutAspects: 
## prepare some aspects:
cartesianLayout = createCartesianLayout(
  node=c(0, 1),
  x=c(5.5, 110.1), 
  y=c(200.3, 210.2),
  z=c(-1, 3.1),
)

## node 0 is updated, new view is added 
cartesianLayout2 = createCartesianLayout(
  node=c(0, 0),
  x=c(5.7, 7.2), 
  y=c(98, 13.9),
  view=c(NA, 1476)
)

## Simply update with new values
cartesianLayout3 = updateCartesianLayout(cartesianLayout, cartesianLayout2)

## Ignore already present keys
cartesianLayout3 = updateCartesianLayout(cartesianLayout, cartesianLayout2, 
                                         replace=FALSE)

## Raise an error if duplicate keys are present
try(updateCartesianLayout(cartesianLayout, cartesianLayout2, 
                          stopOnDuplicates=TRUE))
## =>ERROR: 
## Provided IDs (node, view) countain duplicates!

## For RCX:
## prepare RCX object:
nodes = createNodes(name = c("a","b"))
edges = createEdges(source = 0, target = 1)
cySubNetworks = createCySubNetworks(
  id = 1476,
  nodes = "all",
  edges = "all"                    
)
rcx = createRCX(nodes,
                edges = edges,
                cySubNetworks=cySubNetworks)

## add the network attributes
rcx = updateCartesianLayout(rcx, cartesianLayout)

## add additional network attributes and update existing
rcx = updateCartesianLayout(rcx, cartesianLayout2)

frankkramer-lab/RCX documentation built on Oct. 26, 2021, 1:33 a.m.