2024 π Daylatest newsbuy art
Feel the vibe, feel the terror, feel the painHooverphonicMad about you, orchestrally.more quotes
very clickable
data visualization + databases

Schemaball

Circular visualization of database schemas

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
SCHEMABALL CAN ACCOMODATE VARIOUS SCHEMA SIZES | (left) A Medline citation database with 12 tables. (middle) A ugene database with 35 tables. (right) A massive sequencing LIMS database with 135 tables.

Schemaball was published in SysAdmin Magazine (Krzywinski, M. Schemaball: A New Spin on Database Visualization (2004) Sysadmin Magazine Vol 13 Issue 08). Who cites Schemaball?

These tutorials illustrate different features of Schemaball. Tutorials are divided into sections. Each section covers a particular aspect of a feature or set of features. Each section has its own documentation, configuration file and schema ball image.

all tutorials

tutorial 3

Adjusting colour and visiblity of schema diagram elements.

NAME

sbtut_03 - adjusting colour and visiblity

SYNOPSIS

  <image>
  background = c2cdef
  foreground = 61,95,197
  <image>

  <link>
  color  = 3d5fc5
  </link>
  <table>
  fill    = 255,219,150
  outline = 3d5fc5
  </table>

  <table>
  <hide_rx>
  misc
  gene
  feature
  .{15,}
  <hide_rx>
  <table>

  <table>
  invisible_hide = yes
  </table>

  <link>
  link_to_invisible = yes
  </link>

  <link>
  show_links = no
  </link>

  <link>
  <hide_rx>
  ^seq_region__
  __analysis$
  ^object_xref__go_xref$
  </hide_rx>
  <link>

  <link>
  <hide_rx>
  !_(seq_region|analysis)
  </hide_rx>
  <link>

PURPOSE

In this tutorial, we'll look at some of the parameters which are used to adjust the way the diagram is drawn. Specifically, we'll focus on colour and visibility.

TUTORIAL

Table glyphs are circles whose outline colour, outline thickness and fill colour can be adjusted. The constraint lines, regardless whether they are lines or bezier curves, may have their colour and width adjusted.

Adjusting Element Colour

Let's adjust the background and foreground of the image. The foreground colour will be used for the colour of all labels and text.

  <image>
  ...
  background = c2cdef
  foreground = 61,95,197
  ...
  <image>

Colours may be defined using HEX or RGB notation. Do not include # in the hex definition.

Let's also adjust the link and table colours.

  <link>
  ...
  color  = 3d5fc5
  ...
  </link>

  <table>
  ...
  fill    = 255,219,150
  outline = 3d5fc5
  ...
  </table>

The diagram with the adjusted colours is sbtut_03_01.png.

Adjusting Table Visibility

The visibility of tables and links can be adjusted using regular expressions. Adjusting visibility is a good way to isolate elements of the schema. Let's first look at how tables may be hidden or removed from the schema altogether.

We'll get rid of all tables with the string ``misc'', ``gene'' and ``feature'' in them, as well as any table whose name is longer than 15 characters.

  <table>
  ...
  <hide_rx>
  misc
  gene
  feature
  .{15,}
  <hide_rx>
  ...
  <table>

The diagram with adjusted colours and hidden tables is sbtut_03_02.png

You'll notice that all the hidden tables have been removed from the schema and the remaining tables have been uniformly redistributed around the circle. Hidden tables may be made invisible by using

  <table>
  ...
  invisible_hide = yes
  ...
  </table>

This has the effect of keeping the hidden tables in the schema diagram, but makes them invisible. The resulting effect is that a gap is created along the circle where the table glyph would have been. The diagram with adjusted colours and invisible tables is sbtut_03_03.png

Normally, links are not drawn to invisible tables. To force links to be drawn to such tables use

  <link>
  ...
  link_to_invisible = yes
  ...
  </link>

The diagram with adjusted colours and invisible but linked tables is sbtut_03_04.png

Adjusting Constraint Visibility

To turn off all links, toggle the 'show_links' parameter.

  <link>
  ...
  show_links = no
  ...
  </link>

This is not as exciting as selectively toggling link visiblity. Constraints are made invisible in a manner similar to hiding tables. Regular expressions are defined in a <hide_rx> subblock and applied to the string table1__table2. Let's hide the following constraints: all constraints from seq_region, all constraints to analysis and the constraint between object_xref and go_xref.

  <link>
  ...
  <hide_rx>
  ^seq_region__
  __analysis$
  ^object_xref__go_xref$
  </hide_rx>
  ...
  <link>

It's not always necessary to include the anchors ^ and $ in the regular expressions, but here they're left in for clarity.

The diagram with adjusted colours, invisible tables and hidden constraints is sbtut_03_05.png. Some constraint lines at the seq_region table remain because we have hidden all constraints in which the seq_region table is the referer, but not when it is the referent.

To delete all constraints except those for some tables, a regular expression with a leading ``!'' flag should be used. This flag negates the result of the regular expression check. This flag implements the equivalent of a ``hide all except'' mechanism. Thus, any constraint which *does not* match the regular expression (seq_region|analysis) will be hidden.

  <link>
  ...
  <hide_rx>
  !_(seq_region|analysis)
  </hide_rx>
  ...
  <link>

The diagram links only to/from seq_region and analysis tables is sbtut_03_06.png

Creating Multiple Layers

Continuing on the last example, what if you wanted the constraints that connected to the seq_region table to be a different colour than those that connected to the analysis table? You can create multiple schema diagrams and compose them with your favourite image editing program.

In the first image, show only the seq_region links (sbtut_03_07.png). In the second image, hide all the tables, and show only analysis links, while toggling 'link_to_invisible' (sbtut_03_08.png). A composite image created from these two layers is sbtut_03_09.png.

A more flexible way to accomplish this effect is to highlight link elements. This is covered in the next tutorial.

HISTORY

BUGS

Please report errors and suggestions to martink@bcgsc.ca

AUTHOR

Martin Krzywinski, mkweb.bcgsc.ca, martink@bcgsc.ca

$Id: schemaball,v 1.5 2003/10/27 20:25:11 martink Exp $

CONTACT

  Martin Krzywinski
  Genome Sciences Centre
  Vancouver BC Canada
  mkweb.bcgsc.ca
  www.bcgsc.ca
  martink@bcgsc.ca

configuration


################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_01.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_02.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_04.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_04.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
link_to_invisible = yes
</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_05.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier

<hide_rx>
^seq_region__
__analysis$
^object_xref__go_xref$
</hide_rx>

</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_06.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier

<hide_rx>
!_(seq_region|analysis)
</hide_rx>

</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_07.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier

<hide_rx>
!_(seq_region)
</hide_rx>

</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
misc
gene
feature
.{15,}
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 03
#
# sbtut_03_08.conf - modifying schema diagram properties: colour and hiding
#

<db>
sqlfile = tutorial/03/hs.sql
</db>

<linkrule fieldregex>
fieldrx   = ^(\w+)_([a-z]+)$
use       = yes
avoidself = yes
<fields>
table = 0
field = 1
</fields>
</linkrule>

<image>

file        = /home/httpd/htdocs/worldatwar/schema.png
size        = 1000
glyphradius = 0.7

image_element_dump = yes

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
link_to_invisible = yes
<hide_rx>
!_(analysis)
</hide_rx>

</link>

<bezier>
resolution = 100
radius = 0.1
</bezier>

<label>
font   = tahoma.ttf
size   = 10
</label>

<table>
size    = 25
fill    = 255,219,150
stroke  = 2
outline = 3d5fc5

invisible_hide = yes

<hide_rx>
.
</hide_rx>

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
news + thoughts

Nasa to send our human genome discs to the Moon

Sat 23-03-2024

We'd like to say a ‘cosmic hello’: mathematics, culture, palaeontology, art and science, and ... human genomes.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
SANCTUARY PROJECT | A cosmic hello of art, science, and genomes. (details)
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
SANCTUARY PROJECT | Benoit Faiveley, founder of the Sanctuary project gives the Sanctuary disc a visual check at CEA LeQ Grenoble (image: Vincent Thomas). (details)
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
SANCTUARY PROJECT | Sanctuary team examines the Life disc at INRIA Paris Saclay (image: Benedict Redgrove) (details)

Comparing classifier performance with baselines

Sat 23-03-2024

All animals are equal, but some animals are more equal than others. —George Orwell

This month, we will illustrate the importance of establishing a baseline performance level.

Baselines are typically generated independently for each dataset using very simple models. Their role is to set the minimum level of acceptable performance and help with comparing relative improvements in performance of other models.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Comparing classifier performance with baselines. (read)

Unfortunately, baselines are often overlooked and, in the presence of a class imbalance5, must be established with care.

Megahed, F.M, Chen, Y-J., Jones-Farmer, A., Rigdon, S.E., Krzywinski, M. & Altman, N. (2024) Points of significance: Comparing classifier performance with baselines. Nat. Methods 20.

Happy 2024 π Day—
sunflowers ho!

Sat 09-03-2024

Celebrate π Day (March 14th) and dig into the digit garden. Let's grow something.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
2024 π DAY | A garden of 1,000 digits of π. (details)

How Analyzing Cosmic Nothing Might Explain Everything

Thu 18-01-2024

Huge empty areas of the universe called voids could help solve the greatest mysteries in the cosmos.

My graphic accompanying How Analyzing Cosmic Nothing Might Explain Everything in the January 2024 issue of Scientific American depicts the entire Universe in a two-page spread — full of nothing.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
How Analyzing Cosmic Nothing Might Explain Everything. Text by Michael Lemonick (editor), art direction by Jen Christiansen (Senior Graphics Editor), source: SDSS

The graphic uses the latest data from SDSS 12 and is an update to my Superclusters and Voids poster.

Michael Lemonick (editor) explains on the graphic:

“Regions of relatively empty space called cosmic voids are everywhere in the universe, and scientists believe studying their size, shape and spread across the cosmos could help them understand dark matter, dark energy and other big mysteries.

To use voids in this way, astronomers must map these regions in detail—a project that is just beginning.

Shown here are voids discovered by the Sloan Digital Sky Survey (SDSS), along with a selection of 16 previously named voids. Scientists expect voids to be evenly distributed throughout space—the lack of voids in some regions on the globe simply reflects SDSS’s sky coverage.”

voids

Sofia Contarini, Alice Pisani, Nico Hamaus, Federico Marulli Lauro Moscardini & Marco Baldi (2023) Cosmological Constraints from the BOSS DR12 Void Size Function Astrophysical Journal 953:46.

Nico Hamaus, Alice Pisani, Jin-Ah Choi, Guilhem Lavaux, Benjamin D. Wandelt & Jochen Weller (2020) Journal of Cosmology and Astroparticle Physics 2020:023.

Sloan Digital Sky Survey Data Release 12

constellation figures

Alan MacRobert (Sky & Telescope), Paulina Rowicka/Martin Krzywinski (revisions & Microscopium)

stars

Hoffleit & Warren Jr. (1991) The Bright Star Catalog, 5th Revised Edition (Preliminary Version).

cosmology

H0 = 67.4 km/(Mpc·s), Ωm = 0.315, Ωv = 0.685. Planck collaboration Planck 2018 results. VI. Cosmological parameters (2018).

Error in predictor variables

Tue 02-01-2024

It is the mark of an educated mind to rest satisfied with the degree of precision that the nature of the subject admits and not to seek exactness where only an approximation is possible. —Aristotle

In regression, the predictors are (typically) assumed to have known values that are measured without error.

Practically, however, predictors are often measured with error. This has a profound (but predictable) effect on the estimates of relationships among variables – the so-called “error in variables” problem.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Error in predictor variables. (read)

Error in measuring the predictors is often ignored. In this column, we discuss when ignoring this error is harmless and when it can lead to large bias that can leads us to miss important effects.

Altman, N. & Krzywinski, M. (2024) Points of significance: Error in predictor variables. Nat. Methods 20.

Background reading

Altman, N. & Krzywinski, M. (2015) Points of significance: Simple linear regression. Nat. Methods 12:999–1000.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of significance: Logistic regression. Nat. Methods 13:541–542 (2016).

Das, K., Krzywinski, M. & Altman, N. (2019) Points of significance: Quantile regression. Nat. Methods 16:451–452.

Martin Krzywinski | contact | Canada's Michael Smith Genome Sciences CentreBC Cancer Research CenterBC CancerPHSA
Google whack “vicissitudinal corporealization”
{ 10.9.234.151 }