Gene arrow map (gggenes-style)

Genome graphs represent a revolutionary advancement in genomics, moving beyond linear reference genomes to encompass the vast diversity of genomic variation within populations. These complex data structures integrate multiple genome sequences, enabling more accurate and comprehensive analysis of genetic information. Applications range from improving disease diagnostics to facilitating more effective personalized medicine, as genome graphs provide a richer context for understanding individual genetic differences and their implications for health. This technology offers significant potential for advancing biological and medical research.


Economist GGPlot Excel Paul Tol Black And White Solarized Stata Tableau Wall Street CanvasXpress
<html>

  <head>
    <!-- Include the CanvasXpress library in your HTML file -->
    <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
    <script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script>
  </head>

  <body>

    <!-- Create a canvas element for the chart with the desired dimensions -->
    <div>
      <canvas id="canvasId" width="600" height="600"></canvas>
    </div>


    <!-- Create a script to initialize the chart -->
    <script>

      // Create the data for the graph
      var data = {
       "tracks": [
        {
         "name": "Genome A",
         "type": "box",
         "hideFeatureNames": true,
         "data": [
          {
           "id": "genE",
           "data": [
            [
             200,
             1400
            ]
           ],
           "dir": "right",
           "fill": "rgb(141,211,199)"
          },
          {
           "id": "genA",
           "data": [
            [
             1800,
             3600
            ]
           ],
           "dir": "right",
           "fill": "rgb(255,255,179)"
          },
          {
           "id": "genB",
           "data": [
            [
             4000,
             5200
            ]
           ],
           "dir": "left",
           "fill": "rgb(190,186,218)"
          },
          {
           "id": "genC",
           "data": [
            [
             5600,
             7400
            ]
           ],
           "dir": "right",
           "fill": "rgb(251,128,114)"
          },
          {
           "id": "genD",
           "data": [
            [
             7800,
             8600
            ]
           ],
           "dir": "left",
           "fill": "rgb(128,177,211)"
          }
         ]
        },
        {
         "name": "Genome B",
         "type": "box",
         "hideFeatureNames": true,
         "data": [
          {
           "id": "genA",
           "data": [
            [
             600,
             2400
            ]
           ],
           "dir": "right",
           "fill": "rgb(255,255,179)"
          },
          {
           "id": "genB",
           "data": [
            [
             2800,
             4000
            ]
           ],
           "dir": "left",
           "fill": "rgb(190,186,218)"
          },
          {
           "id": "genC",
           "data": [
            [
             4400,
             6200
            ]
           ],
           "dir": "right",
           "fill": "rgb(251,128,114)"
          },
          {
           "id": "genF",
           "data": [
            [
             6600,
             7800
            ]
           ],
           "dir": "right",
           "fill": "rgb(253,180,98)"
          }
         ]
        },
        {
         "name": "Genome C",
         "type": "box",
         "hideFeatureNames": true,
         "data": [
          {
           "id": "genE",
           "data": [
            [
             300,
             1500
            ]
           ],
           "dir": "right",
           "fill": "rgb(141,211,199)"
          },
          {
           "id": "genA",
           "data": [
            [
             1900,
             3700
            ]
           ],
           "dir": "left",
           "fill": "rgb(255,255,179)"
          },
          {
           "id": "genC",
           "data": [
            [
             4100,
             5900
            ]
           ],
           "dir": "right",
           "fill": "rgb(251,128,114)"
          },
          {
           "id": "genD",
           "data": [
            [
             6300,
             7100
            ]
           ],
           "dir": "left",
           "fill": "rgb(128,177,211)"
          },
          {
           "id": "genF",
           "data": [
            [
             7500,
             8700
            ]
           ],
           "dir": "right",
           "fill": "rgb(253,180,98)"
          }
         ]
        }
       ]
      }

      // Create the configuration for the graph
      var config = {
         "graphType": "Genome",
         "featureStyle": "arrow",
         "featureArrowheadWidth": 14,
         "featureHeightDefault": 16,
         "background": "rgb(255,255,255)",
         "featureStaggered": true,
         "featureLegend": true
      }

      // Event used to create graph (optional)
      var events = false

            // Call the CanvasXpress function to create the graph
      var cX = new CanvasXpress("canvasId", data, config, events);

    </script>

  </body>

</html>
library(canvasXpress)
library(jsonlite)
genome <- read_json("https://www.canvasxpress.org/data/r/cX-genome10.json")
canvasXpress(
data=genome,
background="rgb(255,255,255)",
featureArrowheadWidth=14,
featureHeightDefault=16,
featureLegend=TRUE,
featureStaggered=TRUE,
featureStyle="arrow",
graphType="Genome"
)
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import show_in_browser

if __name__ == "__main__":
  # Define the chart with its data and configuration
  chart: CanvasXpress = CanvasXpress(
    render_to = "genome10",
    data = {
      "tracks": [
        {
          "name": "Genome A",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genE",
              "data": [
                [200, 1400]
              ],
              "dir": "right",
              "fill": "rgb(141,211,199)"
            },
            {
              "id": "genA",
              "data": [
                [1800, 3600]
              ],
              "dir": "right",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genB",
              "data": [
                [4000, 5200]
              ],
              "dir": "left",
              "fill": "rgb(190,186,218)"
            },
            {
              "id": "genC",
              "data": [
                [5600, 7400]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genD",
              "data": [
                [7800, 8600]
              ],
              "dir": "left",
              "fill": "rgb(128,177,211)"
            }
          ]
        },
        {
          "name": "Genome B",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genA",
              "data": [
                [600, 2400]
              ],
              "dir": "right",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genB",
              "data": [
                [2800, 4000]
              ],
              "dir": "left",
              "fill": "rgb(190,186,218)"
            },
            {
              "id": "genC",
              "data": [
                [4400, 6200]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genF",
              "data": [
                [6600, 7800]
              ],
              "dir": "right",
              "fill": "rgb(253,180,98)"
            }
          ]
        },
        {
          "name": "Genome C",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genE",
              "data": [
                [300, 1500]
              ],
              "dir": "right",
              "fill": "rgb(141,211,199)"
            },
            {
              "id": "genA",
              "data": [
                [1900, 3700]
              ],
              "dir": "left",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genC",
              "data": [
                [4100, 5900]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genD",
              "data": [
                [6300, 7100]
              ],
              "dir": "left",
              "fill": "rgb(128,177,211)"
            },
            {
              "id": "genF",
              "data": [
                [7500, 8700]
              ],
              "dir": "right",
              "fill": "rgb(253,180,98)"
            }
          ]
        }
      ]
    },
    config = {
      "graphType": "Genome",
      "featureStyle": "arrow",
      "featureArrowheadWidth": 14,
      "featureHeightDefault": 16,
      "background": "rgb(255,255,255)",
      "featureStaggered": True,
      "featureLegend": True
    },
    width = 600,
    height = 600
  )

  # Display the chart in its own Web page
  show_in_browser(chart)
Run this notebook: Open in Binder
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import graph

graph(
  CanvasXpress(
    render_to = "genome10",
    data = {
      "tracks": [
        {
          "name": "Genome A",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genE",
              "data": [
                [200, 1400]
              ],
              "dir": "right",
              "fill": "rgb(141,211,199)"
            },
            {
              "id": "genA",
              "data": [
                [1800, 3600]
              ],
              "dir": "right",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genB",
              "data": [
                [4000, 5200]
              ],
              "dir": "left",
              "fill": "rgb(190,186,218)"
            },
            {
              "id": "genC",
              "data": [
                [5600, 7400]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genD",
              "data": [
                [7800, 8600]
              ],
              "dir": "left",
              "fill": "rgb(128,177,211)"
            }
          ]
        },
        {
          "name": "Genome B",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genA",
              "data": [
                [600, 2400]
              ],
              "dir": "right",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genB",
              "data": [
                [2800, 4000]
              ],
              "dir": "left",
              "fill": "rgb(190,186,218)"
            },
            {
              "id": "genC",
              "data": [
                [4400, 6200]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genF",
              "data": [
                [6600, 7800]
              ],
              "dir": "right",
              "fill": "rgb(253,180,98)"
            }
          ]
        },
        {
          "name": "Genome C",
          "type": "box",
          "hideFeatureNames": True,
          "data": [
            {
              "id": "genE",
              "data": [
                [300, 1500]
              ],
              "dir": "right",
              "fill": "rgb(141,211,199)"
            },
            {
              "id": "genA",
              "data": [
                [1900, 3700]
              ],
              "dir": "left",
              "fill": "rgb(255,255,179)"
            },
            {
              "id": "genC",
              "data": [
                [4100, 5900]
              ],
              "dir": "right",
              "fill": "rgb(251,128,114)"
            },
            {
              "id": "genD",
              "data": [
                [6300, 7100]
              ],
              "dir": "left",
              "fill": "rgb(128,177,211)"
            },
            {
              "id": "genF",
              "data": [
                [7500, 8700]
              ],
              "dir": "right",
              "fill": "rgb(253,180,98)"
            }
          ]
        }
      ]
    },
    config = {
      "graphType": "Genome",
      "featureStyle": "arrow",
      "featureArrowheadWidth": 14,
      "featureHeightDefault": 16,
      "background": "rgb(255,255,255)",
      "featureStaggered": True,
      "featureLegend": True
    },
    width = 600,
    height = 600
  )
)
using CanvasXpress

canvasxpress(Dict(
  "tracks" => [
    Dict(
      "name" => "Genome A",
      "type" => "box",
      "hideFeatureNames" => true,
      "data" => [
        Dict(
          "id" => "genE",
          "data" => [
            [200, 1400]
          ],
          "dir" => "right",
          "fill" => "rgb(141,211,199)"
        ),
        Dict(
          "id" => "genA",
          "data" => [
            [1800, 3600]
          ],
          "dir" => "right",
          "fill" => "rgb(255,255,179)"
        ),
        Dict(
          "id" => "genB",
          "data" => [
            [4000, 5200]
          ],
          "dir" => "left",
          "fill" => "rgb(190,186,218)"
        ),
        Dict(
          "id" => "genC",
          "data" => [
            [5600, 7400]
          ],
          "dir" => "right",
          "fill" => "rgb(251,128,114)"
        ),
        Dict(
          "id" => "genD",
          "data" => [
            [7800, 8600]
          ],
          "dir" => "left",
          "fill" => "rgb(128,177,211)"
        )
      ]
    ),
    Dict(
      "name" => "Genome B",
      "type" => "box",
      "hideFeatureNames" => true,
      "data" => [
        Dict(
          "id" => "genA",
          "data" => [
            [600, 2400]
          ],
          "dir" => "right",
          "fill" => "rgb(255,255,179)"
        ),
        Dict(
          "id" => "genB",
          "data" => [
            [2800, 4000]
          ],
          "dir" => "left",
          "fill" => "rgb(190,186,218)"
        ),
        Dict(
          "id" => "genC",
          "data" => [
            [4400, 6200]
          ],
          "dir" => "right",
          "fill" => "rgb(251,128,114)"
        ),
        Dict(
          "id" => "genF",
          "data" => [
            [6600, 7800]
          ],
          "dir" => "right",
          "fill" => "rgb(253,180,98)"
        )
      ]
    ),
    Dict(
      "name" => "Genome C",
      "type" => "box",
      "hideFeatureNames" => true,
      "data" => [
        Dict(
          "id" => "genE",
          "data" => [
            [300, 1500]
          ],
          "dir" => "right",
          "fill" => "rgb(141,211,199)"
        ),
        Dict(
          "id" => "genA",
          "data" => [
            [1900, 3700]
          ],
          "dir" => "left",
          "fill" => "rgb(255,255,179)"
        ),
        Dict(
          "id" => "genC",
          "data" => [
            [4100, 5900]
          ],
          "dir" => "right",
          "fill" => "rgb(251,128,114)"
        ),
        Dict(
          "id" => "genD",
          "data" => [
            [6300, 7100]
          ],
          "dir" => "left",
          "fill" => "rgb(128,177,211)"
        ),
        Dict(
          "id" => "genF",
          "data" => [
            [7500, 8700]
          ],
          "dir" => "right",
          "fill" => "rgb(253,180,98)"
        )
      ]
    )
  ]
);
  graphType = "Genome",
  featureStyle = "arrow",
  featureArrowheadWidth = 14,
  featureHeightDefault = 16,
  background = "rgb(255,255,255)",
  featureStaggered = true,
  featureLegend = true
)
⇧