Skip to content

A package which extends Plotly to generate dynamic bacterial growth curves. Has arguments for automated grouping, annotations, titles and subplotting in a single function

License

Notifications You must be signed in to change notification settings

jakechamblee/lysis-curve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI

Lysis-curve

This package generates automated lysis curves (bacterial growth curves) for biological research via Plotly and uses code to generate automated grouping, titles, annotations and subplotting within a single custom graphing function. Simply changing the function arguments can generate a variety of bacterial growth curves.

This makes generating growth/lysis curves as simple and quick as possible, even for people with minimal programming skills.

The graphs are dynamic when generated within a webpage (e.g. Jupyter) which can be useful when teasing apart data.

For a very similar package which generates non-dynamic but prettier bacterial growth curves / lysis curves using R rather than Python, see Cody Martin's lysis_curves package.

Install Package Using Pip

At the command line, run

pip install lysis-curve

This should also install all necessary dependencies.

Running (in Jupyter or in the Python shell)

First, make sure your x-axis (time) data is your zeroth (first) column (this script always plots the first column in the csv file as the x-axis). Next, make sure you save your data in the .csv file format.

Next, navigate to the directory containing your .csv file (in the terminal, or in Jupyter).

import os
os.chdir('your_path_here')

Next, import the lysis_curve() function using

from lysis_curve import lysis_curve

Alternatively, copy/paste the file into a jupyter cell from github and you can modify the code yourself.

Generate basic plot

lysis_curve('yourcsvfile.csv')

basic plot

Generate plot with grouping

This argument is useful if you wish to visually group your data by color. It automatically sets each line in each group the same color, but assigns them a variation of the same marker, plus different line markers (solid line, dashed line, dash-dot line). Maximum of 3 per group. Pass the argument group as a list of strings, with each column in a group separated by vertical bars.

lysis_curve('122120JSC.csv',
           group = ['1', '4','3|5'],
           annotate=True)

basic_plot_with_grouping

Generate plot with annotations

Use the argument annotate=True and follow the prompts. Useful for adding simple annotations at a specific timepoint.

Generate plot with subplots

Use the argument subplots=True to split your data into subplots. Does not work with grouping.

lysis_curve('051321JSC.csv',
           subplots=True)

basic_plot_with_subplots

Generate plot with custom title

Use the argument title='Your Custom Title Here' By default, the title will be taken from your csv file name - thus 'yourcsvfile' if 'yourcsvfile.csv' is passed.

Pass custom colors

lysis_curve('yourcsvfile.csv', colors=['red', 'blue', 'blah'])

You should be able to pass any color to colors that you can find in this link.

Save as .png

Set the argument png=True and the function will generate a .png file of the graph in your current directory.

Save as .svg

Set the argument svg=True and the function will generate a .svg file of the graph in your current directory. Requires Kaleido or Orca

Save .png, .svg and legendless .svg

save=True Saves three versions of the graph: (1) a .png version with a legend (2) a .svg version with a legend (3) a .svg version without a legend and square dimensions

Dependencies

  • Python 3.5+
  • Pandas pip install pandas
  • Plotly pip install plotly
  • Requests pip install requests
  • Kaleido pip install kaleido (Kaleido is recommended over Orca according to Plotly)

About

A package which extends Plotly to generate dynamic bacterial growth curves. Has arguments for automated grouping, annotations, titles and subplotting in a single function

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages