Visualizing YAML well metadata

Many of the features of rushd load metadata using YAML files. However, writing these files can be error-prone, especially with complicated experimental setups.

rushd also includes plotting functions that can generate well maps automatically for you! Enter plot_well_metadata, which has the following interface:

rushd.plot.plot_well_metadata(filename, *, output_dir=None, plate_size=None, columns=None, style=None)[source]

Plot the specified metadata columns listed in a YAML file.

Parameters:
  • filename (str or pathlib.Path) – The path to the YAML file containing the mapping

  • output_dir (optional pathlib.Path) – If given, outputs plate maps as PNGs, PDFs, and SVGs into this folder. If not given, plots are plt.show’d interactively.

  • plate_size (optional Tuple[int,int]) – The width and height of the plate, in number of wells. Defaults to a 96- or 384-well plate.

  • columns (optional List[str]) – The list of columns to plot. If not specified, all metadata columns are plotted.

Automatic plotting of well metadata

Consider the following YAML metadata file:

By default, plot_well_metadata will use a default color scheme for every column listed in the metadata file. For numerical columns, it will auto-detect if a linear or log plot is better, and use a Viridis color scheme (with the yellow part of viridis removed).

For the above YAML file, we can get the following plots:

tutorial/_static/built_output/plot_metadata_overall/inducible_fluorophore.svg
tutorial/_static/built_output/plot_metadata_overall/orientation.svg
tutorial/_static/built_output/plot_metadata_overall/inducible_spacerlength.svg
tutorial/_static/built_output/plot_metadata_overall/dox.svg

Here, you can see the automatic color assignment for both categorical variables, linear numerical variables, and log-distributed variables.

Note

The automatic detection of log-distributed data examines the median of the values. If all values are non-negative and the median is outside of the percentile range [0.15, 0.85], the data is detected as log-distributed.

You can override this as discussed below.

Modifying output color mapping

You can override the default color set in multiple ways. First, you can specify the style of a column to be 'category', 'linear', or 'log' to override autodetection:

tutorial/_static/built_output/plot_metadata_custom/dox.svg

Importantly, you don’t have to specify a style for each column plotted; it will default to style autodetection.

You can also specify an explicit colormap that specifies a color for each entry:

tutorial/_static/built_output/plot_metadata_custom/orientation.svg

Plotting non-96 wells

By using the plate_size parameter, you can plot smaller plates, like a 6 well plate:

tutorial/_static/built_output/plot_metadata_custom/virus.svg