Cell Culture Analysis

Load your .csv file

In [1]:
filenamea ='celltest.csv'

Run the Program

In [2]:
#Import necessary libraries
import pandas
from pandas import DataFrame, read_csv
import matplotlib.pyplot 
import matplotlib 
import seaborn
import math

# Enable inline plotting
%matplotlib inline
/home/main/anaconda2/envs/python3/lib/python3.5/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
/home/main/anaconda2/envs/python3/lib/python3.5/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
In [3]:
def data(filenamea):
   
    
    #import file
    df1 = pandas.read_csv(filenamea) #import file
    df1 = pandas.DataFrame(df1) #convert to dataframe
    large = df1
    
    #figure asthetics
    biobots = ["#b30000","#e63131","#008081","#00d098","#e1e1e1"];
    palette = seaborn.set_palette(biobots);
    seaborn.set_context("paper");
    seaborn.set_style('ticks')
    fig, ax = matplotlib.pyplot.subplots()
    
    #Set up boxplot
    fig.set_size_inches(5, 4)
    g= seaborn.boxplot(y=large.CellYieldFlask);
    g.set(title='Cell Yield Per Flask');
    matplotlib.pyplot.savefig("boxplot.png")
    palette = seaborn.set_palette(biobots);
    seaborn.set_context("paper");
    
    # Set second figure
    f,(ax1,ax2,ax3,ax4) = matplotlib.pyplot.subplots(ncols=4,figsize=(12,5));
    seaborn.regplot(data=large,x="Passage",y="CellYieldFlask",ax=ax1,color="#e63131");
    seaborn.regplot(data=large,x="DaysCultured",y="CellYieldFlask", color="#008081",ax=ax2);
    seaborn.regplot(data=large,x="DensityPlated",y="CellYieldFlask", color="#00d098",ax=ax3);
    seaborn.regplot(data=large,x="Flask",y="CellYieldFlask",color="#b30000",ax=ax4)
    #ylabels
    ax1.set(ylabel='Cell Yield Per Flask (Millions)')
    ax2.set(ylabel='')
    ax3.set(ylabel='')
    ax4.set(ylabel='')

    #xlabels
    ax1.set(xlabel='Passage')
    ax2.set(xlabel='Days Cultured')
    ax3.set(xlabel='Cell Density Plated per cm^2')
    ax4.set(xlabel= 'Flask Size')

    #Titles
    ax1.set(title='Cell Yield By Passage')
    ax2.set(title='Cell Yield By Days Cultured')
    ax3.set(title='Cell Yield By Density Plated')
    ax4.set(title='Cell Yield by Flask Size')
    matplotlib.pyplot.show()

    f.savefig("trends.png")
    
    #Data stats
    data_matrix = large["CellYieldFlask"].describe()
    data_matrix = pd.DataFrame(large["CellYieldFlask"].describe())
    print(data_matrix)
In [4]:
def cultureanalysis(filenamea):
    data(filenamea)

Results

Images are saved as .png files and can be downloaded from the home page

In [5]:
cultureanalysis(filenamea)

Visit www.buildwithlife.com to learn more! Interested in contributing or have feedback? Email [email protected]