I'm trying to represent a bidirectional graph structure using graphviz. Say I have 3 nodes A
, B
, C
, corresponding to DNA fragments. I want to represent some structure inside each node, but also the relationship among the nodes, which let's say is A+ -> B- -> C+
. That is, the positive strand in A
is followed by the negative strand in B
, then by the positive strand in C
. The best I could come up with is:
digraph G {
subgraph cluster_A {
Aa0 -> Ab0
Ab1 -> Aa1
{rank=same; Aa0 Aa1}
{rank=same; Ab0 Ab1}
}
subgraph cluster_B {
Ba0 -> Bb0
Bb1 -> Ba1
{rank=same; Ba0 Ba1}
{rank=same; Bb0 Bb1}
}
subgraph cluster_C {
Ca0 -> Cb0
Cb1 -> Ca1
{rank=same; Ca0 Ca1}
{rank=same; Cb0 Cb1}
}
Ab0 -> Bb1
Bb0 -> Ab1
Ba1 -> Ca0
Ca1 -> Ba0
}
Here, the a
/b
labels correspond to the 5'
/3'
ends, and 0
/1
labels correspond to positive/negative strands. What I get is:
My main question is: Is it possible to tell dot
to freely rotate individual subgraphs, while keeping their inner structure intact? In this example, I would've liked B
to be rotated upside down. If it's not possible, are there any hacks that could accomplish this? Like introducing hidden nodes, placing weights on nodes/edges? I'm not that familiar with graphviz/dot, and I don't know exactly what it can do.
To clarify, there is more structure that I want to represent inside each cluster (other than its 5'
and 3'
ends), and that structure should be consistent within the cluster. But I don't know the best orientation of each cluster a priori, and I want to let dot
compute that.