MATLAB · chapter 3 of 13

Networks: motifs and random topologies

A network is just a signed adjacency matrix, so you can build one by hand, take a registered motif, or draw one at random.

By hand

S = zeros(3);
S(2, 1) = 1;      % G1 activates G2
S(3, 2) = -1;     % G2 represses G3
model = grn.buildModel(S, Labels = ["A", "B", "C"]);

Registered motifs

grn.motif(name) returns a struct with fields name, S, labels, and description. A second output is the parameter preset that grn.buildModel applies automatically when it is given the motif name. grn.catalog() lists them.

NameGenesStructurePreset behaviour
"toggle"2u and v repress each otherBistable: Hill 2, alpha = 5
"repressilator"3lacI -\tetR -\cI -\lacILimit-cycle oscillator: Hill 4, alpha = 10
"nar"1x represses itselfFast, robust response
"par"1x activates itselfSlow response, possibly bistable
"ffl_coherent"3X -> Y, X -> Z, Y -> ZSign-sensitive delay (AND gate with multiplicative logic)
"ffl_incoherent"3X -> Y, X -> Z, Y -\ZPulse generator
"cascade"Size (4)G1 -> G2 -> ...Linear activation chain
"sim"Size (4)TF -> T1, T2, ...Single-input module
"bifan"4A, B -> C, DTwo regulators, two targets
"goodwin"3X -> Y -> Z -\XOscillator: Hill 8, alpha = 10
m = grn.motif("cascade", Size = 6);
model = grn.buildModel(m);                         % labels kept, no preset
model = grn.buildModel("cascade");                 % with the preset, Size 4

The presets set k, vmax, K, hill, gamma, and basal where the textbook behaviour depends on them. You can override any of them through Params.

grn.plotMotifs(): every registered motif in pathway notation.
grn.plotMotifs(): every registered motif in pathway notation.

Random topologies

[S, info] = grn.randomNetwork(n, ...) draws a signed adjacency with n genes.

OptionDefaultMeaning
Topology"erdosrenyi""erdosrenyi", "scalefree", "smallworld", or "modular"
MeanDegree2Expected number of regulators per gene
FractionRepressors0.4Probability that an edge represses
SelfRegulation0Probability that a gene regulates itself
Modules, WithinFraction4, 0.8Modular topology: number of modules and fraction of edges inside modules
Rewire0.1Small-world topology: rewiring probability
Seed0rng seed

How each topology is drawn:

After the topology, each edge is made repressing with probability FractionRepressors, and each gene gets a self-loop with probability SelfRegulation (sign drawn the same way). info.meanDegree reports the realised mean in-degree.

The four topologies at 40 genes and mean in-degree 2. Scale-free networks concentrate outgoing edges on a few hub regulators; modular networks show dense blocks with sparse links between them.
The four topologies at 40 genes and mean in-degree 2. Scale-free networks concentrate outgoing edges on a few hub regulators; modular networks show dense blocks with sparse links between them.
Out-degree (targets per gene) and in-degree (regulators per gene) at 300 genes. The scale-free generator produces hubs with tens of targets while keeping the in-degree narrow, which is how real transcription networks look.
Out-degree (targets per gene) and in-degree (regulators per gene) at 300 genes. The scale-free generator produces hubs with tens of targets while keeping the in-degree narrow, which is how real transcription networks look.
[S, info] = grn.randomNetwork(60, Topology = "modular", Modules = 3, ...
    MeanDegree = 2.5, Seed = 4);
info
nnz(S), sum(S ~= 0, 2).'
Output
info = 

  <a href="matlab:helpPopup('struct')" style="font-weight:bold">struct</a> with fields:

      topology: "modular"
       modules: [60×1 double]
    meanDegree: 2.4500
       options: [1×1 struct]

ans =

   147

ans =

  Columns 1 through 13

     3     3     2     1     3     3     4     6     3     3     1     4     0

  Columns 14 through 26

     4     2     3     3     4     4     0     1     0     1     1     1     3

  Columns 27 through 39

     2     3     0     4     3     4     4     5     3     0     2     3     2

  Columns 40 through 52

     2     0     6     5     4     0     3     3     4     1     3     0     4

  Columns 53 through 60

     1     2     3     2     2     2     0     2

Checking a network

A few one-liners that are useful before building a model:

nnz(S)                       % number of edges
sum(S ~= 0, 2).'             % in-degree (regulators per gene)
sum(S ~= 0, 1)               % out-degree (targets per gene)
find(~any(S, 2)).'           % source genes: constitutive, no regulators
nnz(diag(S))                 % self-regulating genes