Gene Regulatory network
I do not have any experience with this, so I went to wikipedia and grabbed the example network from it.
Now let’s try to construct it in nadi
to_file("
PAT1 -> CHS
P1F3 -> CHS
P1F3 -> LHY
P1F3 -> CAB1
P1F3 -> RBCS1A
APRR -> LHY
GI -> LHY
LHY -> GBSS
LHY -> CAT3
STO -> CHS
HOG1 -> CHS
CAT3 -> RCD1
DND1 -> RCD1
", "./output/gene.network")
net.load_file("./output/gene.network")
net.cairo.network("./output/grn-gene-net.svg")
Results:
The image looks a bit weird because nadi is made for river networks, so let’s just place the nodes differently.
net.load_file("./output/gene.network")
nodes set_xy(random(), random())
leaves set_xy(1, node.INDEX)
roots set_xy(0, node.INDEX)
net.cairo.draw("./output/grn-gene-net2.svg")
Results:
Let’s just give up and use graphviz
net.load_file("./output/gene.network")
# net save_gv("gene-net.gv", name="n")
# command("dot gene-net.gv -o gene-net-pos.gv")
# commenting out because we need to manually remove the label="\N" there because it is invalid string in nadi
net load_positions("gene-net-pos.gv")
net.cairo.draw("./output/grn-gene-net3.svg")
*Error*:
FunctionError at Line 5 Column 1: function load_positions: No such file or directory (os error 2)
It at least looks like something.
We can see how visualization of graphs other than river is not something that is currently made well in NADI. But as shown here you can use graphviz, or write algorithms to positions the node yourself.
nm inputs.NAME
nm outputs.NAME
Results:
{
RCD1 = ["CAT3", "DND1"],
DND1 = [],
CAT3 = ["LHY"],
LHY = ["P1F3", "APRR", "GI"],
GI = [],
APRR = [],
P1F3 = [],
CHS = ["PAT1", "P1F3", "STO", "HOG1"],
HOG1 = [],
STO = [],
PAT1 = [],
GBSS = ["LHY"],
RBCS1A = ["P1F3"],
CAB1 = ["P1F3"]
}
{
RCD1 = [],
DND1 = ["RCD1"],
CAT3 = ["RCD1"],
LHY = ["GBSS", "CAT3"],
GI = ["LHY"],
APRR = ["LHY"],
P1F3 = ["CHS", "LHY", "CAB1", "RBCS1A"],
CHS = [],
HOG1 = ["CHS"],
STO = ["CHS"],
PAT1 = ["CHS"],
GBSS = [],
RBCS1A = [],
CAB1 = []
}