Skip to content

Instantly share code, notes, and snippets.

@CatChenal
Last active February 2, 2023 20:36
Show Gist options
  • Save CatChenal/48b33726e0f9a0fa64eee1a5d65c11be to your computer and use it in GitHub Desktop.
Save CatChenal/48b33726e0f9a0fa64eee1a5d65c11be to your computer and use it in GitHub Desktop.
Graphviz decision tree redrawn from @standage

Redrawing of the Graphviz decision tree by @standage (rendered using http://magjac.com/graphviz-visual-editor).

  • Output:
    standage_gv

  • Code:

digraph
{    
    # start & end nodes
    node [fontcolor=brown, fontsize=20, shape=rectangle, style=rounded, border=bold]
    
    ilocus [label="iLocus"]
    # all yes branch:
    # start -> y
    gilocus [label="giLocus"]
    # start -> y -> y
    pilocus [label="piLocus"]
    # start -> y -> y -> y
    cilocus [label="ciLocus"]
    # start -> n -> y
    iilocus [label="iiLocus"]
    # start -> n -> n
    filocus [label="fiLocus"]
    # start -> y -> n
    nilocus [label="niLocus"]
    # start -> y -> y -> n
    silocus [label="siLocus"]
    
    # decision nodes:
    node [color=Blue, fontcolor=Blue, fontsize=18, shape=diamond, style=""]
    
    containgene [label="Contains\ngene(s)?"]
    proteincoding [label="Protein\ncoding?"]
    multiplegenes [label="Multiple\n  genes?  "]
    geneflank [label="Flanked by\ngenes on\nboth sides?"]

    {rank=same; containgene; gilocus}
    {rank=same; geneflank; proteincoding; pilocus; multiplegenes}
    
    # connections:
    ilocus -> containgene

    containgene:e -> gilocus:w [xlabel=" Y ", color=green, style=bold]
    containgene:w -> geneflank:n [xlabel="N  ", color=red, style=bold]
    
    geneflank:e -> iilocus:e [label="  Y", color=green, style=bold]
    geneflank:w -> filocus:w [label="  N", color=red, style=bold]
    
    
    gilocus -> proteincoding
    proteincoding:e -> pilocus:w [xlabel="Y", color=green, style=bold]
    proteincoding:w -> nilocus:w [label="  N", color=red, style=bold]
    pilocus -> multiplegenes:w
    multiplegenes:e -> cilocus:e [label="  Y", color=green, style=bold]
    multiplegenes:w -> silocus:w [label="  N", color=red, style=bold]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment