Skip to content

Instantly share code, notes, and snippets.

@ccario83
Last active March 5, 2020 22:43
Show Gist options
  • Save ccario83/2fc713571e7ddab01486a7f487adeafb to your computer and use it in GitHub Desktop.
Save ccario83/2fc713571e7ddab01486a7f487adeafb to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ccario83
Copy link
Author

ccario83 commented Feb 21, 2020

A simple python script to render a SVG image of a 96 well plate with wells labeled and/or colored.

Quickstart

  1. Make sure the notebook, color_96_wells.ipynb, and svg template file, plate_template.svg, are in the same directory and fire up a jupyter notebook in that directory.
  2. Create a pandas dataframe (called data here) with the columns Sample, Row, Col, and Values.
  3. Optionally define labels and colors dictionaries that respectively map wells (A1 - H96) to labels (defaults to empty) and hex/rgb(a) color values (defaults to white).
  4. Run the code using your data instead of the dummy data generated in cell 2.

Labels and colors can be turned off by passing None to the mytemplate.render() function call (e.g. labels=None)

@ccario83
Copy link
Author

See https://github.com/Wittelab/samasy for a more fully featured interface

@ccario83
Copy link
Author

ccario83 commented Feb 27, 2020

Plate dimensions are from a Greiner Bio-One Non-binding 96 well plate

Custom dimensions can be specified in the top portion of the plate_template.svg file

@ccario83
Copy link
Author

ccario83 commented Feb 27, 2020

This SVG outputs are designed to be the exact size of the defined 96 well plate when printed, but YMMV. To fine tune printed plate size, use the print_error margin parameter in the plate_template.svg file. To adjust it, try the following:

  1. Set print_error to 0 in the plate template, save the file, render the plate, and then print it.
  2. Using a ruler, measure the difference between the printed size and specified size on one dimension (e.g. plate width).
  3. Update print_error, setting it to that difference.
  4. Print the plate image again and see if the size not matches an actual plate.

@ccario83
Copy link
Author

This can be super useful for tracking and loading samples into 96 well plates!
IMG_20200226_200413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment