Skip to contents

An object to query, record and modify an edibble graph

An object to query, record and modify an edibble graph

Details

The Provenance contains a set of operations to manipulate the nodes and edges of the edibble graph object.

Active bindings

fct_nodes

Get the factor nodes

lvl_nodes

Get the level nodes

fct_edges

Get the factor edges

lvl_edges

Get the level edges

fct_n

Get the number of nodes in factor graph

lvl_n

Get the number of nodes in level graph

rcrd_ids

Get the ids for all edbl_rcrd factors.

unit_ids

Get the ids for all edbl_unit factors.

trt_ids

Get the ids for all edbl_trt factors.

is_connected

Check if nodes are connected. Get a new factor id. Get a new level id. Given a particular DAG, return a topological order Remember that there could be more than one order.

Methods

Public methods


Method new()

Initialise function

Usage

Provenance$new(graph = NULL)

Arguments

graph

An edibble graph.


Method set_title()

Set the title.

Usage

Provenance$set_title(title)

Arguments

title

The title of the experiment


Method set_name()

Set the name.

Usage

Provenance$set_name(name)

Arguments

name

The name of the edibble graph object.


Method set_validation()

Set the validation.

Usage

Provenance$set_validation(validation, type = "rcrds")

Arguments

validation

The validation statement.

type

The type of validation.


Method set_simulate()

Set the simulation process

Usage

Provenance$set_simulate(name, process, rcrds)

Arguments

name

The name of the process

process

A function to simulate the record

rcrds

The record factor name simulating for.


Method reactivate()

Reactivate the graph in the provenance object.

Usage

Provenance$reactivate(
  design,
  overwrite = c("graph", "anatomy", "recipe", "validation", "simulate",
    "simualte_result")
)

Arguments

design

An edibble design

overwrite

A vector of character to overwrite from the supplied design object.


Method deactivate()

Deactivate the provenance object.

Usage

Provenance$deactivate(delete = c("graph", "anatomy", "recipe", "validation"))

Arguments

delete

A vector of character to delete.


Method fct_id()

Get the id based on either the name of the factor node. If none supplied then it will give all.

Usage

Provenance$fct_id(name = NULL, role = NULL)

Arguments

name

The name of the node.

role

The role for the node.


Method fct_id_parent()

Get the factor parent ids

Usage

Provenance$fct_id_parent(id = NULL, role = NULL, type = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.

type

The type of edge link.


Method fct_id_child()

Get the factor child ids. If role is supplied then the child has to fit role

Usage

Provenance$fct_id_child(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method fct_id_ancestor()

Get the factor ancestor ids

Usage

Provenance$fct_id_ancestor(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method fct_id_descendant()

Get the factor descendant ids

Usage

Provenance$fct_id_descendant(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method fct_id_leaves()

Get the leave factor ids.

Usage

Provenance$fct_id_leaves(role = NULL)

Arguments

role

The role for the node.


Method lvl_id()

Get the id based on name of level node. Assumes that level ids obtained are all from the same fid

Usage

Provenance$lvl_id(value = NULL, role = NULL, fid = NULL)

Arguments

value

The value of the node.

role

The role for the node.

fid

The factor id.


Method lvl_id_parent()

Get the level parent ids

Usage

Provenance$lvl_id_parent(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method lvl_id_child()

Get the level child ids

Usage

Provenance$lvl_id_child(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method lvl_id_ancestor()

Get the level ancestor ids

Usage

Provenance$lvl_id_ancestor(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method fct_id_from_lvl_id()

Find the factor id from level ids.

Usage

Provenance$fct_id_from_lvl_id(id = NULL, fid_search = NULL)

Arguments

id

The id of the corresponding node.

fid_search

A vector of fids to search from.


Method fct_id_from_lvl_values()

Find the factor id from level values.

Usage

Provenance$fct_id_from_lvl_values(value = NULL, fid_search = NULL)

Arguments

value

The value of the node.

fid_search

A vector of fids to search from.


Method lvl_id_from_fct_id()

Find the level id from the given fid

Usage

Provenance$lvl_id_from_fct_id(fid = NULL)

Arguments

fid

The factor id.


Method fct_names()

Get the factor names based on id or role

Usage

Provenance$fct_names(id = NULL, role = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.


Method unit_names()

Get the unit names

Usage

Provenance$unit_names(id = NULL)

Arguments

id

The id of the corresponding node.


Method trt_names()

Get the treatment names

Usage

Provenance$trt_names(id = NULL)

Arguments

id

The id of the corresponding node.


Method rcrd_names()

Get the record names.

Usage

Provenance$rcrd_names(id = NULL)

Arguments

id

The id of the corresponding node.


Method rcrd_class()

Get the class for record with validation.

Usage

Provenance$rcrd_class(name = NULL)

Arguments

name

The name of the node.


Method lvl_values()

Get the level values based on id or role cannot have just role only defined. id must be from the same fid

Usage

Provenance$lvl_values(id = NULL, role = NULL, fid = NULL)

Arguments

id

The id of the corresponding node.

role

The role for the node.

fid

The factor id.


Method unit_values()

Get the unit values.

Usage

Provenance$unit_values(id = NULL, fid = NULL)

Arguments

id

The id of the corresponding node.

fid

The factor id.


Method trt_values()

Get the treatment values.

Usage

Provenance$trt_values(id = NULL, fid = NULL)

Arguments

id

The id of the corresponding node.

fid

The factor id.


Method rcrd_values()

Get the record values.

Usage

Provenance$rcrd_values(uid = NULL, fid = NULL)

Arguments

uid

The unit level id

fid

The factor id.


Method fct_role()

Get the role of the vertex given the factor id

Usage

Provenance$fct_role(id = NULL)

Arguments

id

The id of the corresponding node.


Method fct_levels()

Get the levels for each factor

Usage

Provenance$fct_levels(id = NULL, name = NULL, return = c("id", "value"))

Arguments

id

The id of the corresponding node.

name

The name of the node.

return

To return in "id" or "value" format.


Method fct_levels_id_to_edbl_fct()

Factor levels to edble factor

Usage

Provenance$fct_levels_id_to_edbl_fct(fct_levels, role)

Arguments

fct_levels

The factor levels in id.

role

The role for the node.


Method fct_levels_id_to_value()

Get the factor levels in value given id format

Usage

Provenance$fct_levels_id_to_value(fct_levels)

Arguments

fct_levels

A list of factor levels in id format.


Method fct_levels_value_to_id()

Get the factor levels in id given value format.

Usage

Provenance$fct_levels_value_to_id(fct_levels)

Arguments

fct_levels

A list of factor levels in id format.


Method fct_exists()

One of name, id or role is defined to check if it exists. If more than one of the arguments name, id and role are supplied, then the intersection of it will be checked.

Usage

Provenance$fct_exists(id = NULL, name = NULL, role = NULL, abort = TRUE)

Arguments

id

The id of the corresponding node.

name

The name of the node.

role

The role for the node.

abort

Whether to abort.


Method trt_exists()

Check if treatment exists.

Usage

Provenance$trt_exists(id = NULL, name = NULL, abort = TRUE)

Arguments

id

The id of the corresponding node.

name

The name of the node.

abort

Whether to abort.


Method unit_exists()

Check if unit exists.

Usage

Provenance$unit_exists(id = NULL, name = NULL, abort = TRUE)

Arguments

id

The id of the corresponding node.

name

The name of the node.

abort

Whether to abort.


Method rcrd_exists()

Check if record exists.

Usage

Provenance$rcrd_exists(id = NULL, name = NULL, abort = TRUE)

Arguments

id

The id of the corresponding node.

name

The name of the node.

abort

Whether to abort.


Method append_fct_nodes()

Given node data, append the factor nodes

Usage

Provenance$append_fct_nodes(name, role, attrs = NULL)

Arguments

name

The name of the node.

role

The role for the node.

attrs

The attributes.


Method append_lvl_nodes()

Given node data, append the level nodes

Usage

Provenance$append_lvl_nodes(
  value,
  n = NULL,
  label = NULL,
  attrs = NULL,
  fid = NULL
)

Arguments

value

The value of the node.

n

The number of replications.

label

The labels for the levels.

attrs

The attributes.

fid

The factor id.


Method append_fct_edges()

Given edge data, append the factor edges

Usage

Provenance$append_fct_edges(from, to, type = NULL, group = FALSE, attrs = NULL)

Arguments

from

The node id from.

to

The node id to.

type

The type of edges.

group

A logical value to indicate whether to create new group id or not.

attrs

The attributes.


Method append_lvl_edges()

Given edge data, append the level edges

Usage

Provenance$append_lvl_edges(from, to, attrs = NULL)

Arguments

from

The node id from.

to

The node id to.

attrs

The attributes.


Method serve_units()

Serve the units.

Usage

Provenance$serve_units(id = NULL, return = c("id", "value"))

Arguments

id

The id of the corresponding node.

return

To return in "id" or "value" format.


Method serve_trts()

Serve treatments

Usage

Provenance$serve_trts(id = NULL, return = c("id", "value"))

Arguments

id

The id of the corresponding node.

return

To return in "id" or "value" format.


Method serve_rcrds()

Serve records

Usage

Provenance$serve_rcrds(id = NULL, return = c("id", "value"))

Arguments

id

The id of the corresponding node.

return

To return in "id" or "value" format.


Method make_trts_table()

Make the treatments table

Usage

Provenance$make_trts_table(id = NULL, return = c("id", "value"))

Arguments

id

The id of the corresponding node.

return

To return in "id" or "value" format.

Returns

A treatment table


Method graph_subset()

Subset graph

Usage

Provenance$graph_subset(
  id = NULL,
  include = c("self", "child", "parent", "ancestors")
)

Arguments

id

The id of the corresponding node.

include

"self" for only input id, "child" for child also, "parent" for parent also, nodes immediately related, and "ancestors" for all ancestors

Returns

subsetted graph


Method save_seed()

Save the seed

Usage

Provenance$save_seed(seed, type)

Arguments

seed

A seed.

type

Type.


Method get_title()

Get the title

Usage

Provenance$get_title()


Method get_validation()

Get the validation

Usage

Provenance$get_validation(type = NULL)

Arguments

type

A type.


Method get_trail()

Get the trail.

Usage

Provenance$get_trail()


Method get_graph()

Get the graph

Usage

Provenance$get_graph()


Method get_seed()

Get the seed

Usage

Provenance$get_seed()


Method get_session_info()

Get the session information

Usage

Provenance$get_session_info()


Method get_edibble_version()

Get the edibble version.

Usage

Provenance$get_edibble_version()


Method get_simulate()

Get the simulation information

Usage

Provenance$get_simulate(name = NULL)

Arguments

name

The process name. Only one name allowed.


Method get_simulate_result_env()

Get the simulation results

Usage

Provenance$get_simulate_result_env(name = NULL)

Arguments

name

The process name. Only one name allowed.


Method mapping()

Mapping of a role to role

Usage

Provenance$mapping(role_from, role_to)

Arguments

role_from

The role from.

role_to

The role to.


Method mapping_to_unit()

Mapping of an id to a unit

Usage

Provenance$mapping_to_unit(id = NULL)

Arguments

id

The id of the corresponding node.


Method record_step()

Record step.

Usage

Provenance$record_step()


Method lvl_mapping()

Get the level edges by factor

Usage

Provenance$lvl_mapping(from, to, return = c("vector", "table"))

Arguments

from, to

The factor id.

return

To return in "id" or "value" format.


Method record_track_external()

Record track external.

Usage

Provenance$record_track_external(code)

Arguments

code

The code to record.


Find all id that is linked.

Usage

Provenance$fct_id_links(id = NULL, role = NULL, link = c("direct", "indirect"))

Arguments

id

The id of the corresponding node.

role

The role for the node.

link

Whether the link should be direct or indirect

Returns

id of linked factors, excluding itself.


Method fct_graph_components()

Get the nodes with components (subgraph number)

Usage

Provenance$fct_graph_components(id = NULL)

Arguments

id

The id of the corresponding node.


Method lvl_graph_components()

Get the nodes with components (subgraph number)

Usage

Provenance$lvl_graph_components()


Method clone()

The objects of this class are cloneable with this method.

Usage

Provenance$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.