Sets
NodeSet
__init__(super_cell, idx_low, idx_high, attribute_dict=None)
Class responsible for representing nodes of a given type (e.g. "genes" or "protein complexes", "oligonucleotides", "small molecules").
Its attribute "state" points to a subset of the state of the cell "super_cell". The subset is defined by the range [idx_low, idx_high] along the second axis.
Similarly, the decay_rate and production_rate attributes point to subsets of the corresponding attributes of "super_cell".
Multiple nodesets should not have overlapping idx ranges.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
super_cell |
obj
|
The cell this NodeSet belongs to. |
required |
idx_low |
int
|
Beginning index of this NodeSet in the NodeTensor. |
required |
idx_high |
int
|
Ending index of this NodeSet in the NodeTensor. Note this code corrects for the fact that arrays are indexed using half intervals by adding +1 to idx_high for all operations. |
required |
attribute_dict |
dict
|
Dict of node attributes. Each node attribute is an array e.d., decay rate for each gene. This is done because for the ODE solver, the state of cell must be in a single tensor. We want the total state to encompass multiple nodesets, so we index the super cell so we can pass a nodeset tensor to the ODE solver. |
None
|
EdgeSet
__init__(edges=None, attribute_dict=None)
Class responsible for representing edges of a given type. An edge type is defined by a tuple (source_node_type, interaction_type, target_node_type). Examples of node types would be "gene", "codes", or "protein". Example interaction types would be "inhibits", "facilitates".
The attribute state
points to a subset of the state of the cell "super_cell".
The subset is defined by the range [idx_low, idx_high] along the second
axis. Similarly, the decay_rate and production_rate attributes point to
subsets of the corresponding attributes of "super_cell".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges |
torch.Tensor
|
shape (n_edges, 2). The first column corresponds to the indices of the source nodes in cell[source_node_type]. The second column corresponds to the indices of the target nodes in cell[target_node_type]. |
None
|
attribute_dict |
Dict[str, torch.Tensor]
|
TODO? |
None
|
add_edges(edges, attribute_dict=None)
Adds provided edges with optional attibutes to the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges |
tensor
|
A set of (src, target) pairs. |
required |
attribute_dict |
dict
|
Optional attributes for each edge. |
None
|
get_edges(indices)
Retrieves edges indexed by indices, with their attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
shape (n_edges) boolean. |
required |
heads()
property
Returns parents.
remove_edges(indices)
Removes edges specified by indices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
torch.Tensor
|
shape (n_edges) boolean. |
required |
tails()
property
Returns children.