2024 π Daylatest newsbuy art
Embrace me, surround me as the rush comes.Motorcycledrift deeper into the soundmore 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 5

Tracing constraints relationships using highlight inheritance.

NAME

sbtut_05 - tracing constraints using highlight inheritance

SYNOPSIS

  <highlight>
  highlight_by_table = yes | no
  highlight_by_table_forward = yes | no
  highlight_by_table_reverse = yes | no
  highlight_by_iterations = [ 1 | 2 | 3 ... ]
  fade_factor_table = 0 .. 1
  fade_factor_link = 0 .. 1
  </highlight>

PURPOSE

This tutorial will illustrate how to use highlighting to apply a different colour scheme to elements in the schema diagram.

TUTORIAL

Starting from a Highlighted Table

Suppose we're interested in how the analysis table is connected to other tables. Start by highlight the analysis table.

  <table>
  ...
  <highlight_rx>
  ^seq_region$
  </highlight_rx>
  ...
  fill_hi    = acff96
  outline_hi = ffffff
  ...
  </table>

The resulting image is sbtut_05_01.png. This is pretty boring. To have Schemball automatically highlight tables refered to by the seq_region table,

  <link>
  stroke_hi = 3
  color_hi  = acff96
  </link>

  <highlight>
  highlight_by_table = yes
  highlight_by_table_forward = yes
  highlight_by_iterations = 1
  </highlight>

Links are highlighted by tables when 'highlight_by_table' is toggled. Links which start at the highlighted table will be highlighted, since 'highlight_by_table_forward' is toggled. Links terminating at this table will not be highlighted. The 'highlight_by_iterations' parameter determines how deep the highlight inheritance extends. Because links do not highlight tables in this example, raising the number of iterations will not make a difference.

The produced image is sbtut_05_02.png.

To automatically highlight links which terminate at the seq_region table,

  <highlight>
  ...
  highlight_by_table_forward = no
  highlight_by_table_reverse = yes
  ...
  </highlight>

The produced image is sbtut_05_03.png.

So far, this type of highlighting is no different than manually highlighting links using a regular expression, such as ^seq_region__ or __seq_region$. The virtue of automatic highlighting is made clear when both highlight_by_table and highlight_by_link are toggled.

Starting from a Highlighted Link

If you start with a highlighted link, or links, you can automatically highlight the participating tables.

  <link>
  ...
  <highlight_rx>
  __seq_region$
  </highlight_rx>
  ...
  stroke_hi = 3
  color_hi = acff96
  ...
  </link>

  <highlight>
  highlight_by_link = yes
  highlight_by_iterations = 1
  </highlight>

Even with a single iteration, inheritance of highlight from links achieves more than highlighting tables manually. There is no way to highlight a table based on what tables it connects to (because the highlight regular expression applies only to the table name), except with highlight inheritance. The produced image is sbtut_05_04.png.

Tracing Constraints

Highlights can be inherited across multiple levels of tables and constraints. To illustrate this, we'll start with a single highlighted table, translation_stable_id.

  <table>
  ...
  <highlight_rx>
  translation_stable_id
  </highlight_rx>
  ...
  </table>

To trace highlights through multiple levels, you need to allow links to inherit table highlights (highlight_by_table) and tables to inherit link highlights (highlight_by_link). In this example, we'll apply highlights to links in the forward direction, meaning that links which start at highlighted tables will be highlighted.

  <highlight>
  highlight_by_link  = yes
  highlight_by_table = yes
  highlight_by_table_forward = yes
  highlight_by_iterations = 1
  </highlight>

A single iteration of inheritance is produced in sbtut_05_05.png. Links starting at translation_stable_id are highlighted. In this case, this is the single link to the translation table. The table at which this link terminates is also highlighted, since both types of inheritance (by table and by link) are performed once.

When the number of iterations is increased to 2, links touching tables highlighted in the first iteration become highlighted.

  <highlight>
  ...
  highlight_by_iterations = 2
  ...
  </highlight>

The produced image is sbtut_05_06.png. The Looking ahead, let's set the number of iterations to some large number to see how deeply into the database the constraints that start at translation_stable_id extend.

  <highlight>
  ...
  highlight_by_iterations = 99
  ...
  </highlight>

The produced image is sbtut_05_07.png. In this image, it's hard to tell how many constraints were followed to any of the highlighted tables. The colour of the highlighted elements may be adjusted for each iteration of highlighting. This is described below.

Tracing Constraints with Variable Highlights

The highlight colours can be diluted in HSB space, to come closer to the regular colour, using

  <highlight>
  ...
  fade_factor_table =
  fade_factor_link  =
  ...
  </highlight>

The lower the fade factor, the faster the highlighted colours fade into regular colours. This type of fading is handy to distinguish inheritance depth. For example,

  <highlight>
  ...
  fade_factor_table = 0.6
  fade_factor_link  = 0.6
  ...
  </highlight>

produces sbtut_05_08.png.

Tracing Constraints with Fading Highlights

If the regular colour of the link and table is chosen to be the background colour, traced highlights and their tables will appear to fade into the background. This is a neat effect, and it is shown in sbtut_05_09.png.

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
  www.bcgsc.ca
  mkweb.bcgsc.ca
  martink@bcgsc.ca

configuration


################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_01.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

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

<highlight_rx>
^seq_region$
</highlight_rx>

fill_hi    = acff96
outline_hi = ffffff

</table>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_02.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
stroke_hi = 3
color_hi = acff96
</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

<highlight_rx>
^seq_region$
</highlight_rx>

fill_hi    = acff96
outline_hi = ffffff

</table>

<highlight>
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 1
</highlight>


</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_03.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

<link>
show_links = yes
color  = 3d5fc5
stroke = 2
anchor = edge
type = bezier
stroke_hi = 3
color_hi = acff96
</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

<highlight_rx>
^seq_region$
</highlight_rx>

fill_hi    = acff96
outline_hi = ffffff

</table>

<highlight>
highlight_by_table = yes
highlight_by_table_forward = no
highlight_by_table_reverse = yes
highlight_by_iterations = 1
</highlight>


</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_04.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

<highlight_rx>
__seq_region$
</highlight_rx>

stroke_hi = 3
color_hi = acff96
</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

fill_hi = acff96
outline_hi = ffffff

</table>

<highlight>
highlight_by_link = yes
highlight_by_iterations = 1
</highlight>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_05.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

stroke_hi = 3
color_hi = acff96
</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

fill_hi = acff96
outline_hi = ffffff

<highlight_rx>
translation_stable_id
</highlight_rx>

</table>

<highlight>
highlight_by_link = yes
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 1
</highlight>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_06.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

stroke_hi = 3
color_hi = acff96
</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

fill_hi = acff96
outline_hi = ffffff

<highlight_rx>
translation_stable_id
</highlight_rx>

</table>

<highlight>
highlight_by_link = yes
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 2
</highlight>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_07.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

stroke_hi = 3
color_hi = acff96
</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

fill_hi = acff96
outline_hi = ffffff

<highlight_rx>
translation_stable_id
</highlight_rx>

</table>

<highlight>
highlight_by_link = yes
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 99
</highlight>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_08.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

stroke_hi = 3
color_hi = acff96
</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

fill_hi = acff96
outline_hi = ffffff

<highlight_rx>
translation_stable_id
</highlight_rx>

</table>

<highlight>
highlight_by_link = yes
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 99

fade_factor_table = 0.6
fade_factor_link = 0.6

</highlight>

</elements>

</image>

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca

################################################################
#
# Schemaball configuration file
#
# Tutorial 05
#
# sbtut_05_09.conf - tracing constraints
#

<db>
sqlfile = tutorial/04/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

background  = c2cdef
foreground  = 61,95,197

<elements>

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

stroke_hi = 2
color_hi  = 61,95,197
</link>

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

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

<table>
size    = 25
fill    = c2cdef
stroke  = 2
outline = c2cdef

fill_hi = acff96
outline_hi = ffffff

<highlight_rx>
translation_stable_id
</highlight_rx>

</table>

<highlight>
highlight_by_link = yes
highlight_by_table = yes
highlight_by_table_forward = yes
highlight_by_iterations = 99

fade_factor_table = 0.4
fade_factor_link = 0.4

</highlight>

</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 }