pub struct RegulatoryGraph {
    pub(crate) variables: Vec<Variable>,
    pub(crate) regulations: Vec<Regulation>,
    pub(crate) variable_to_index: HashMap<String, VariableId>,
}
Expand description

A directed graph representing relationships between a collection of Boolean variables using Regulations.

It can be explored using regulators, targets, transitive_regulators, or transitive_targets (for example to determine if two variables depend on each other). We can also compute the SCCs of this graph.

A regulatory graph can be described using a custom string format. In this format, each line represents a regulation or a comment (starting with #).

Regulations can be represented as strings in the form of "regulator_name 'relationship' target_name". The ‘relationship’ is one of the arrow strings ->, ->?, -|, -|?, -?, -??. Here, > means activation, | is inhibition and ? is unspecified monotonicity. The last question mark signifies observability — if it is present, the regulation is not necessarily observable. See Regulation and tutorial module for a more detailed explanation.

Example of a RegulatoryGraph:

 a ->? a
 b -|? a

 a -> b
 b -| b

Fields

variables: Vec<Variable>regulations: Vec<Regulation>variable_to_index: HashMap<String, VariableId>

Implementations

Methods for parsing RegulatoryGraphs from string representations.

Create a RegulatoryGraph from a collection of regulation strings.

The variables of the RegulatoryGraph are determined from the regulations and are ordered alphabetically. Otherwise, this is equivalent to iteratively calling add_string_regulation.

Add a new Regulation to this RegulatoryGraph where the regulation is given in its string representation (e.g. “v1 ->? v2”).

The regulation parameter must be a valid string representation of a regulation, plus all conditions of add_regulation must be satisfied as well.

(internal) A utility method for adding regulations once they are parsed.

Methods for safely constructing new instances of RegulatoryGraphs.

Create a new RegulatoryGraph with variables using the given names and no regulations.

The ordering of the variables is preserved.

Add a new Regulation to this RegulatoryGraph.

Returns Err if regulator or target are not valid graph variables or when the regulation between the two variables already exists.

Set the name of a network variable. The name must not be used by any other variable.

Note that you don’t have to rename anything else in the network, since all other structures reference variables with ids.

(internal) Utility method to safely obtain a regulator variable (using an appropriate error message).

(internal) Utility method to safely obtain a target variable (using an appropriate error message).

(internal) Utility method to ensure there is no regulation between the two variables yet.

Some basic utility methods for inspecting the RegulatoryGraph.

The number of variables in this RegulatoryGraph.

Find a VariableId for the given name, or None if the variable does not exist.

Return a Variable corresponding to the given VariableId.

Shorthand for self.get_variable(id).get_name().

Find a Regulation between two variables if it exists, None otherwise.

Return a sorted list of variables that regulate the given target variable.

Return the set of direct as well as transitive regulators of target.

Return a sorted list of variables that are regulated by the given regulator variable.

Return a set of direct as well as transitive targets of regulator.

Compute the strongly connected components of this regulatory graph. The components are sorted topologically based on their position in the graph condensation.

When sorting topologically incomparable components, we use component size as the secondary criterion. Also, note that the algorithm is not particularly efficient, so it should be used on large networks with caution!

Return an iterator over all variable ids of this graph.

A static check that allows to verify validity of a variable name.

Export this regulatory graph to a .dot format.

In the representation, we use red and green color to distinguish positive and negative regulations. Dashed edges show regulations without observability requirement.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Allow indexing RegulatoryGraph using VariableId objects.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

To consider two regulatory graphs equivalent, we generally assume that they have the same number of variables, with the same names, and stored in the same order. Furthermore, they also need to have the same regulations, however, these do not have a specific order that needs to be preserved. The reason why we enforce variable order and not regulation order is that VariableId objects should be compatible across equivalent graphs, but there is no RegulationId or a similar requirement.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.