omniplate.Omniplate.platereader
omniplate.Omniplate.platereader#
- class platereader(dnames=False, anames=False, wdir='.', platereadertype='Tecan', dsheetnumbers=False, asheetnumbers=False, ODfname=None, info=True, ls=True)[source]#
- Bases: - object- for analyzing plate-reader data, correcting for autofluorescence, and determining growth rates. - All data is stored used Panda’s dataframes and plotted using Seaborn. - Three dataframes are created. If p is an instance of the platereader class, then p.r contains the raw data for each well in the plate; p.s contains the processed time-series using the data from all relevant wells; and p.sc constains any summary statistics, such as ‘max gr’. - For time series sampled from a Gaussian process, the mean is used as the statistics and errors are estimated by the standard deviation. For statistics calculated from time series, the median is used and errors are estimated by half the interquartile range, with the distribution of the statistic calculated by sampling time series. - A typical work flow is: - >>> import omniplate as om - then either - >>> p= om.platereader('GALdata.xlsx', 'GALcontents.xlsx', ... wdir= 'data/') - or - >>> p= om.platereader() >>> p.load('GALdata.xls', 'GALcontents.xlsx') - and to analyse OD data - >>> p.plot('OD', plate= True) >>> p.correctOD() >>> p.correctmedia() >>> p.plot(y= 'OD') >>> p.plot(y= 'OD', hue= 'strain', ... conditionincludes= ['Gal', 'Glu'], ... strainexcludes= 'HXT7') >>> p.getstats('OD') - and for fluorescence data - >>> p.correctauto(['GFP', 'AutoFL']) >>> p.plot(y= 'c-GFPperOD', hue= 'condition') - and to save the results - >>> p.savefigs() >>> p.exportdf() - General properties of the data and of previous processing are shown with: - >>> p.info >>> p.attributes() >>> p.corrections() >>> p.log - See also - for a tutorial, which can be opened directly using - >>> p.webhelp() - Attributes
- attributes
- Displays the names of the attributes of the current instance of platereader and acts as a check to see what variables have been calculated or determined. 
- close
- Close all figures. 
- info
- Displays conditions, strains, and datatypes. 
- log
- Prints a log of all methods called and their arguments. 
- ls
- List all files in the working directory. 
 
 - Methods - add_to_sc([newcolumn, s_column, func, ...])- Applies func to a column in the s dataframe and stores the results in the sc dataframe. - addcolumn(newcolumnname, oldcolumn, ...)- Adds a new column to all dataframes by parsing an existing column. - addcommonvar([var, dvar, varmin, varmax, ...])- Adds to time-dependent dataframes a common variable whose values only come from a fixed array so that they are from the same array for all experiments. - addnumericcolumn(newcolumnname, oldcolumn[, ...])- Adds a new numeric column by parsing the numbers from the entries of an existing column. - averageoverexpts(condition, strain[, tvr, ...])- Uses a Matern Gaussian process to average a time-dependent variable over all experiments. - changewdir(wdir)- Change working directory. - contentsofwells(wlist)- Displays contents of wells - correctOD([figs, odmatch, experiments, ...])- Corrects OD data for the non-linear relationship between OD and cell number. - correctauto([f, refstrain, figs, ...])- Corrects fluorescence data for autofluorescence by comparing with the fluorescence of an untagged reference strain. - corrections([experiments, conditions, ...])- Displays the status of corrections made for the specified strains, conditions, and experiments. - correctmedia([datatypes, commonmedia, ...])- Corrects OD or fluorescence for the OD or fluorescence of the media using data from wells marked Null. - exportdf([commonname, type])- Exports the dataframes as either tab-delimited or csv or json files. - getdataframe([dfname, experiments, ...])- Obtain a subset of the data in a dataframe, which can be used plotting directly. - getstats([dtype, bd, cvfn, ...])- Calls fitderiv.py to estimate the first and second time-derivatives of, typically, OD using a Gaussian process (Swain et al., 2016) and find corresponding summary statistics. - ignorewells([exclude, experiments, ...])- Allows wells to be ignored in any future processing. - importdf(commonnames[, info, sep])- Import dataframes saved as either json or csv or tsv files. - load(dnames[, anames, platereadertype, ...])- Loads raw data files generated by the plate reader and the corresponding annotation files. - plot([x, y, hue, style, size, kind, col, ...])- Plots from the underlying dataframes (chosen automatically) using Seaborn's relplot, which is described at https://seaborn.pydata.org/generated/seaborn.relplot.html - rename(translatedict)- Uses a dictionary to replace all occurrences of a strain or a condition with an alternative. - restricttime([tmin, tmax])- Restrict the processed data to a range of time, ignoring points outside this time range. - savefigs([fname, onefile])- Saves all current figures to PDF, either to one file or each to a separate file. - savelog([fname])- Save log to file. - showwells([concise, sortby, experiments, ...])- Displays wells for specified experiments, conditions, and strains. - webhelp([browser])- Opens detailed examples of how to use in omniplate in a web browser. - Initiate and potentially immediately load data for processing. - Parameters
- dnames: string or list of strings, optional
- The name of the file containing the data from the plate reader or a list of file names. 
- anames: string or list of strings, optional
- The name of file containing the corresponding annotation or a list of file names. 
- wdir: string, optional
- The working directory where the data files are stored and where output will be saved. 
- platereadertype: string
- The type of plate reader, currently either ‘Tecan’ or ‘Sunrise’ or ‘old Tecan’. 
- dsheetnumbers: integer or list of integers, optional
- The relevant sheets of the Excel files storing the data. 
- asheetnumbers: integer or list of integers, optional
- The relevant sheets of the corresponding Excel files for the annotation. 
- ODfname: string, optional
- The name of the file with the dilution data used to correct OD for its non-linear dependence on numbers of cells. If unspecified, data for haploid budding yeast growing in glucose is used. 
- info: boolean
- If True (default), display summary information on the data once loaded. 
- ls: boolean
- If True (default), display contents of working directory. 
 
- Attributes
- attributes
- Displays the names of the attributes of the current instance of platereader and acts as a check to see what variables have been calculated or determined. 
- close
- Close all figures. 
- info
- Displays conditions, strains, and datatypes. 
- log
- Prints a log of all methods called and their arguments. 
- ls
- List all files in the working directory. 
 
 - Methods - add_to_sc([newcolumn, s_column, func, ...])- Applies func to a column in the s dataframe and stores the results in the sc dataframe. - addcolumn(newcolumnname, oldcolumn, ...)- Adds a new column to all dataframes by parsing an existing column. - addcommonvar([var, dvar, varmin, varmax, ...])- Adds to time-dependent dataframes a common variable whose values only come from a fixed array so that they are from the same array for all experiments. - addnumericcolumn(newcolumnname, oldcolumn[, ...])- Adds a new numeric column by parsing the numbers from the entries of an existing column. - averageoverexpts(condition, strain[, tvr, ...])- Uses a Matern Gaussian process to average a time-dependent variable over all experiments. - changewdir(wdir)- Change working directory. - contentsofwells(wlist)- Displays contents of wells - correctOD([figs, odmatch, experiments, ...])- Corrects OD data for the non-linear relationship between OD and cell number. - correctauto([f, refstrain, figs, ...])- Corrects fluorescence data for autofluorescence by comparing with the fluorescence of an untagged reference strain. - corrections([experiments, conditions, ...])- Displays the status of corrections made for the specified strains, conditions, and experiments. - correctmedia([datatypes, commonmedia, ...])- Corrects OD or fluorescence for the OD or fluorescence of the media using data from wells marked Null. - exportdf([commonname, type])- Exports the dataframes as either tab-delimited or csv or json files. - getdataframe([dfname, experiments, ...])- Obtain a subset of the data in a dataframe, which can be used plotting directly. - getstats([dtype, bd, cvfn, ...])- Calls fitderiv.py to estimate the first and second time-derivatives of, typically, OD using a Gaussian process (Swain et al., 2016) and find corresponding summary statistics. - ignorewells([exclude, experiments, ...])- Allows wells to be ignored in any future processing. - importdf(commonnames[, info, sep])- Import dataframes saved as either json or csv or tsv files. - load(dnames[, anames, platereadertype, ...])- Loads raw data files generated by the plate reader and the corresponding annotation files. - plot([x, y, hue, style, size, kind, col, ...])- Plots from the underlying dataframes (chosen automatically) using Seaborn's relplot, which is described at https://seaborn.pydata.org/generated/seaborn.relplot.html - rename(translatedict)- Uses a dictionary to replace all occurrences of a strain or a condition with an alternative. - restricttime([tmin, tmax])- Restrict the processed data to a range of time, ignoring points outside this time range. - savefigs([fname, onefile])- Saves all current figures to PDF, either to one file or each to a separate file. - savelog([fname])- Save log to file. - showwells([concise, sortby, experiments, ...])- Displays wells for specified experiments, conditions, and strains. - webhelp([browser])- Opens detailed examples of how to use in omniplate in a web browser. - __init__(dnames=False, anames=False, wdir='.', platereadertype='Tecan', dsheetnumbers=False, asheetnumbers=False, ODfname=None, info=True, ls=True)[source]#
- Initiate and potentially immediately load data for processing. - Parameters
- dnames: string or list of strings, optional
- The name of the file containing the data from the plate reader or a list of file names. 
- anames: string or list of strings, optional
- The name of file containing the corresponding annotation or a list of file names. 
- wdir: string, optional
- The working directory where the data files are stored and where output will be saved. 
- platereadertype: string
- The type of plate reader, currently either ‘Tecan’ or ‘Sunrise’ or ‘old Tecan’. 
- dsheetnumbers: integer or list of integers, optional
- The relevant sheets of the Excel files storing the data. 
- asheetnumbers: integer or list of integers, optional
- The relevant sheets of the corresponding Excel files for the annotation. 
- ODfname: string, optional
- The name of the file with the dilution data used to correct OD for its non-linear dependence on numbers of cells. If unspecified, data for haploid budding yeast growing in glucose is used. 
- info: boolean
- If True (default), display summary information on the data once loaded. 
- ls: boolean
- If True (default), display contents of working directory. 
 
 
 - Methods - __init__([dnames, anames, wdir, ...])- Initiate and potentially immediately load data for processing. - add_to_sc([newcolumn, s_column, func, ...])- Applies func to a column in the s dataframe and stores the results in the sc dataframe. - addcolumn(newcolumnname, oldcolumn, ...)- Adds a new column to all dataframes by parsing an existing column. - addcommonvar([var, dvar, varmin, varmax, ...])- Adds to time-dependent dataframes a common variable whose values only come from a fixed array so that they are from the same array for all experiments. - addnumericcolumn(newcolumnname, oldcolumn[, ...])- Adds a new numeric column by parsing the numbers from the entries of an existing column. - averageoverexpts(condition, strain[, tvr, ...])- Uses a Matern Gaussian process to average a time-dependent variable over all experiments. - changewdir(wdir)- Change working directory. - contentsofwells(wlist)- Displays contents of wells - correctOD([figs, odmatch, experiments, ...])- Corrects OD data for the non-linear relationship between OD and cell number. - correctauto([f, refstrain, figs, ...])- Corrects fluorescence data for autofluorescence by comparing with the fluorescence of an untagged reference strain. - corrections([experiments, conditions, ...])- Displays the status of corrections made for the specified strains, conditions, and experiments. - correctmedia([datatypes, commonmedia, ...])- Corrects OD or fluorescence for the OD or fluorescence of the media using data from wells marked Null. - exportdf([commonname, type])- Exports the dataframes as either tab-delimited or csv or json files. - getdataframe([dfname, experiments, ...])- Obtain a subset of the data in a dataframe, which can be used plotting directly. - getstats([dtype, bd, cvfn, ...])- Calls fitderiv.py to estimate the first and second time-derivatives of, typically, OD using a Gaussian process (Swain et al., 2016) and find corresponding summary statistics. - ignorewells([exclude, experiments, ...])- Allows wells to be ignored in any future processing. - importdf(commonnames[, info, sep])- Import dataframes saved as either json or csv or tsv files. - load(dnames[, anames, platereadertype, ...])- Loads raw data files generated by the plate reader and the corresponding annotation files. - plot([x, y, hue, style, size, kind, col, ...])- Plots from the underlying dataframes (chosen automatically) using Seaborn's relplot, which is described at https://seaborn.pydata.org/generated/seaborn.relplot.html - rename(translatedict)- Uses a dictionary to replace all occurrences of a strain or a condition with an alternative. - restricttime([tmin, tmax])- Restrict the processed data to a range of time, ignoring points outside this time range. - savefigs([fname, onefile])- Saves all current figures to PDF, either to one file or each to a separate file. - savelog([fname])- Save log to file. - showwells([concise, sortby, experiments, ...])- Displays wells for specified experiments, conditions, and strains. - webhelp([browser])- Opens detailed examples of how to use in omniplate in a web browser. - Attributes - Displays the names of the attributes of the current instance of platereader and acts as a check to see what variables have been calculated or determined. - Close all figures. - Displays conditions, strains, and datatypes. - Prints a log of all methods called and their arguments. - List all files in the working directory. - add_to_sc(newcolumn=None, s_column=None, func=None, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False, strains='all', strainincludes=False, strainexcludes=False)[source]#
- Applies func to a column in the s dataframe and stores the results in the sc dataframe. - Parameters
- newcolumn: string
- The name of the new column in the sc dataframe 
- s_column: string
- The name of the column in s dataframe from which the data is to be processed 
- func: function
- The function to be applied to the data in the s dataframe. 
 
 - Examples - >>> p.add_to_sc(newcolumn= "max GFP", s_column= "GFP mean", ... func= np.nanmax) >>> p.add_to_sc(newcolumn= "GFP lower quartile", s_column= "GFP mean", ... func= lambda x: np.nanquantile(x, 0.25)) 
 - addcolumn(newcolumnname, oldcolumn, newcolumnvalues)[source]#
- Adds a new column to all dataframes by parsing an existing column. All possible entries for the new column are specified as strings and the entry in the new column will be whichever of these strings is present in the entry of the existing column. - Parameters
- newcolumnname: string
- The name of the new column. 
- oldcolumn: string
- The name of the column to be parsed to create the new column. 
- newcolumnvalues: list of strings
- All of the possible values for the entries in the new column. 
 
 
 - addcommonvar(var='time', dvar=None, varmin=None, varmax=None, figs=True, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False, strains='all', strainincludes=False, strainexcludes=False)[source]#
- Adds to time-dependent dataframes a common variable whose values only come from a fixed array so that they are from the same array for all experiments. This common variable allows averaging across experiments and typically is time. - For example, the plate reader often does not perfectly increment time between measurements and different experients can have slightly different time points despite the plate reader having the same settings. These unique times prevent seaborn from taking averages. - If experiments have measurements that start at the same time point and have the same interval between measurements, then setting a commontime for all experiments will allow seaborn to perform averaging. - The array of the common variable runs from varmin to varmax with an interval dvar. These parameters are automatically calculated, but may be specified. - Each instance of var is assigned a common value - the closest instance of the common variable to the instance of var. Measurements are assumed to the same for the true instance of var and for the assigned common value, which may generate errors if these two are sufficiently distinct. - An alternative method is averageoverexpts. - Parameters
- var: string
- The variable from which the common variable is generated, typically ‘time’. 
- dvar: float, optional
- The interval between the values comprising the common array. 
- varmin: float, optional
- The minimum of the common variable. 
- varmax: float, optional
- The maximum of the common variable. 
- figs: boolean
- If True, generate plot to check if the variable and the common variable generated from it are sufficiently close in value. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
 
 
 - addnumericcolumn(newcolumnname, oldcolumn, picknumber=0, leftsplitstr=None, rightsplitstr=None, asstr=False)[source]#
- Adds a new numeric column by parsing the numbers from the entries of an existing column. It is best to run this command only after the basic analyses - ignorewells, correctOD, and correctmedia - have been performed because it changes the structure of the dataframes and may cause errors. - Parameters
- newcolumnname: string
- The name of the new column. 
- oldcolumn: string
- The name of column to be parsed. 
- picknumber: integer
- The number to pick from the list of numbers extracted from the existing column’s entry. 
- leftsplitstr: string, optional
- Split the entry of the column using whitespace and parse numbers from the substring to the immediate left of leftsplitstr rather than the whole entry. 
- rightsplitstr: string, optional
- Split the entry of the column using whitespace and parse numbers from the substring to the immediate right of rightsplitstr rather than the whole entry. 
- asstr: boolean
- If True, convert the numeric value to a string to improve plots with seaborn. 
 
 - Examples - To extract concentrations from conditions use - >>> p.addnumericcolumn('concentration', 'condition') - For a condition like ‘0.5% Raf 0.05ug/mL Cycloheximide’, use - >>> p.addnumericcolumn('raffinose', 'condition', ... picknumber= 0) >>> p.addnumericcolumn('cycloheximide', 'condition', ... picknumber= 1) 
 - property attributes#
- Displays the names of the attributes of the current instance of platereader and acts as a check to see what variables have been calculated or determined. 
 - averageoverexpts(condition, strain, tvr='OD mean', bd=False, addnoise=True, plot=False)[source]#
- Uses a Matern Gaussian process to average a time-dependent variable over all experiments. - An alternative and best first choice is to use addcommonvar. - Parameters
- condition: string
- The condition of interest. 
- strain: string
- The strain of interest. 
- tvr: float
- The time-dependent variable to be averaged. For example, ‘c-GFPperOD’ or ‘OD mean’. 
- bd: dictionary, optional
- The limits on the hyperparameters for the Matern Gaussian process. For example, {0: (-5,5), 1: (-4,4), 2: (-5,2)} where the first element controls amplitude, setting the bounds to 1e-5 and 1e5, the second controls flexibility, and the third determines the magnitude of the measurement error. 
- addnoise: boolean
- If True, add the fitted magnitude of the measurement noise to the predicted standard deviation for better comparison with the spread of the data. 
 
- Returns
- res: dictionary
- {‘t’ : time, tvr : time-dependent data, ‘mn’ : mean, ‘sd’ : standard deviation} where ‘mn’ is the average found and ‘sd’ is its standard deviation. ‘tvr’ is the data used to find the average. 
 
 - Examples - >>> p.averageoverexpts('1% Gal', 'GAL2', bd= {1: [-1,-1])}) 
 - changewdir(wdir)[source]#
- Change working directory. - Parameters
- wdir: string
- The new working directory specified from the current directory. 
 
 
 - property close#
- Close all figures. 
 - contentsofwells(wlist)[source]#
- Displays contents of wells - Parameters
- wlist: string or list of string
- Specifies the well or wells of interest. 
 
 - Examples - >>> p.contentsofwells(['A1', 'E4']) 
 - correctOD(figs=True, odmatch=0.3, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False)[source]#
- Corrects OD data for the non-linear relationship between OD and cell number. Requires a set of dilution data set, with the default being haploid yeast growing in glucose (collected by L Bandiera). An alternative can be loaded from a file - a txt file of two columns with OD specified in the first column and the dilution factor specified in descending order in the second. - figs: boolean, optional
- If True, a plot of the fit to the dilution data is produced. 
- odmatch: float, optional
- If non-zero, then the corrected OD is rescaled to equal the measured OD at this value. Only large ODs typically need to be corrected. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
 - >>> p.correctOD() >>> p.correctOD(figs= False) 
 - correctauto(f=['GFP', 'AutoFL'], refstrain='WT', figs=True, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False, strains='all', strainincludes=False, strainexcludes=False)[source]#
- Corrects fluorescence data for autofluorescence by comparing with the fluorescence of an untagged reference strain. - The reference strain is used to estimate the autofluoresence via either the method of Licthen et al., 2014, where measurements of fluoescence at two wavelengths is required, or by using the fluorescence of the reference strain interpolated to the OD of the strain of interest (Berthoumieux et al., 2013). - Using two measurements of fluorescence is thought to be more accurate, particularly for low fluorescence measurements (Mihalcescu et al., 2015). - Arguments – f: string or list of strings - The fluorescence measurements, typically either [‘mCherry’] or [‘GFP’, ‘AutoFL’]. - refstrain: string
- The reference strain. 
- figs: boolean
- If True, display plots showing the fits to the reference strain’s fluorescnce. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
 - Notes - In principle - >>> p.correctmedia() - should be run before running correctauto when processing data with two fluorescence measurements. - It is unnecessary with only one fluorescence measurement because the normalisation is then done directly with the reference strain’s fluorescence and this fluorescence can include the fluorescence from the media. - In practice, running correctmedia may generate negative values of the fluorescence at some time points. These negative values will create NaNs in the corrected fluorescence, which are normally harmless. - With sufficiently many negative values of the fluorescence, however, correcting data with two fluorescence measurements can become corrupted. - If correctmedia generates negative fluorescence values, we therefore recommend comparing the corrected fluorescence between - >>> p.correctmedia() >>> p.correctauto(['GFP', 'AutoFL') - and - >>> p.correctauto('GFP') - to determine if these negative values are deleterious. - References - S Berthoumieux, H De Jong, G Baptist, C Pinel, C Ranquet, D Ropers, J Geiselmann (2013). Shared control of gene expression in bacteria by transcription factors and global physiology of the cell. Mol Syst Biol, 9, 634. - CA Lichten, R White, IB Clark, PS Swain (2014). Unmixing of fluorescence spectra to resolve quantitative time-series measurements of gene expression in plate readers. BMC Biotech, 14, 1-11. - I Mihalcescu, MVM Gateau, B Chelli, C Pinel, JL Ravanat (2015). Green autofluorescence, a double edged monitoring tool for bacterial growth and activity in micro-plates. Phys Biol, 12, 066016. - Examples - To correct data with one type of fluorescence measurement, use: - >>> p.correctauto('GFP') >>> p.correctauto('mCherry', refstrain= 'BY4741') - To correct data with two types of fluorescence measurement, use: - >>> p.correctauto(['GFP', 'AutoFL']) >>> p.correctauto(['GFP', 'AutoFL'], refstrain= 'wild-type') 
 - corrections(experiments='all', conditions='all', strains='all', experimentincludes=False, experimentexcludes=False, conditionincludes=False, conditionexcludes=False, strainincludes=False, strainexcludes=False)[source]#
- Displays the status of corrections made for the specified strains, conditions, and experiments. - Parameters
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
 
- Returns
- df: dataframe
- Contains the status of the corrections for the specified strains, conditions, and experiments. 
 
 - Examples - >>> p.corrections() >>> p.corrections(strainincludes= 'GAL') 
 - correctmedia(datatypes='all', commonmedia=False, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False, figs=False, log=True, frac=0.33)[source]#
- Corrects OD or fluorescence for the OD or fluorescence of the media using data from wells marked Null. Uses lowess to smooth measurements of from all Null wells and subtracts this smoothed time series from the raw data. - Parameters
- datatypes: string or list of strings
- Data types to be corrected. 
- commonmedia: string
- A condition containing Null wells that should be used to correct media for other conditions. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- figs: boolean, optional
- If True, display fits to data for the Null wells. 
- frac: float
- The fraction of the data used for smoothing via lowess. https://www.statsmodels.org/devel/generated/statsmodels.nonparametric.smoothers_lowess.lowess.html 
 
 - Examples - >>> p.correctmedia() >>> p.correctmedia('OD') >>> p.correctmedia(commonmedia= '1% Glu') 
 - exportdf(commonname=False, type='tsv')[source]#
- Exports the dataframes as either tab-delimited or csv or json files. Dataframes for the (processed) raw data, for summary data, and for summary statistics and corrections, as well as a log file, are exported. - Parameters
- commonname: string, optional
- The name used for the output files. If unspecified, the experiment or experiments is used. 
- type: string
- The type of file for export, either ‘json’ or ‘csv’ or ‘tsv’. 
 
 - Examples - >>> p.exportdf() >>> p.exportdf('processed', type= 'json') 
 - getdataframe(dfname='s', experiments='all', conditions='all', strains='all', experimentincludes=False, experimentexcludes=False, conditionincludes=False, conditionexcludes=False, strainincludes=False, strainexcludes=False, nonull=True)[source]#
- Obtain a subset of the data in a dataframe, which can be used plotting directly. - dfname: string
- The dataframe of interest either ‘r’ (raw data), ‘s’ (default; processed data), or ‘sc’ (summary statistics). 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
- nonull: boolean, optional
- If True, ignore ‘Null’ strains 
 - Returns
- ndf: dataframe
 
 
 - getstats(dtype='OD', bd=False, cvfn='matern', empirical_errors=False, noruns=10, exitearly=True, noinits=100, nosamples=100, logs=True, iskip=False, stats=True, figs=True, findareas=False, plotlocalmax=True, showpeakproperties=False, experiments='all', experimentincludes=False, experimentexcludes=False, conditions='all', conditionincludes=False, conditionexcludes=False, strains='all', strainincludes=False, strainexcludes=False, **kwargs)[source]#
- Calls fitderiv.py to estimate the first and second time-derivatives of, typically, OD using a Gaussian process (Swain et al., 2016) and find corresponding summary statistics. - The derivatives are stored in the .s dataframe; summary statistics are stored in the .sc dataframe. - Parameters
- dtype: string, optional
- The type of data - ‘OD’, ‘GFP’, ‘c-GFPperOD’, or ‘c-GFP’ - for which the derivatives are to be found. The data must exist in the .r or .s dataframes. 
- bd: dictionary, optional
- The bounds on the hyperparameters for the Gaussian process. For example, bd= {1: [-2,0])} fixes the bounds on the hyperparameter controlling flexibility to be 1e-2 and 1e0. The default for a Matern covariance function is {0: (-5,5), 1: (-4,4), 2: (-5,2)}, where the first element controls amplitude, the second controls flexibility, and the third determines the magnitude of the measurement error. 
- cvfn: string, optional
- The covariance function used in the Gaussian process, either ‘matern’ or ‘sqexp’ or ‘nn’. 
- empirical_errors: boolean, optional
- If True, measurement errors are empirically estimated from the variance across replicates at each time point and so vary with time. If False, the magnitude of the measurement error is fit from the data assuming that this magnitude is the same at all time points. 
- noruns: integer, optional
- The number of attempts made for each fit. Each attempt is made with random initial estimates of the hyperparameters within their bounds. 
- exitearly: boolean, optional
- If True, stop at the first successful fit. If False, use the best fit from all successful fits. 
- noinits: integer, optional
- The number of random attempts to find a good initial condition before running the optimization. 
- nosamples: integer, optional
- The number of samples used to calculate errors in statistics by bootstrapping. 
- logs: boolean, optional
- If True, find the derivative of the log of the data and should be True to determine the specific growth rate when dtype= ‘OD’. 
- iskip: integer, optional
- Use only every iskip’th data point to increase speed. 
- stats: boolean, optional
- If False, do not calculate statistics. 
- figs: boolean, optional
- If True, plot both the fits and inferred derivative. 
- findareas: boolean, optional
- If True, find the area under the plot of gr vs OD and the area under the plot of OD vs time. Setting to True can make getstats slow. 
- plotlocalmax: boolean, optional
- If True, mark the highest local maxima found, which is used to calculate statistics, on any plots. 
- showpeakproperties: boolean, optional
- If True, show properties of any local peaks that have found by scipy’s find_peaks. Additional properties can be specified as kwargs and are passed to find_peaks. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
- kwargs: for scipy’s find_peaks
- To set the minimum property of a peak. e.g. prominence= 0.1 and width= 15 (specified in numbers of x-points or y-points and not real units). https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html 
 
 - References - PS Swain, K Stevenson, A Leary, LF Montano-Gutierrez, IB Clark, J Vogel, T Pilizota. (2016). Inferring time derivatives including cell growth rates using Gaussian processes. Nat Commun, 7, 1-8. - Examples - >>> p.getstats() >>> p.getstats(conditionincludes= 'Gal') >>> p.getstats(noruns= 10, exitearly= False) - If the fits are poor, often changing the bounds on the hyperparameter for the measurement error helps: - >>> p.getstats(bd= {2: (-3,0)}) 
 - ignorewells(exclude=[], experiments='all', experimentincludes=False, experimentexcludes=False, clearall=False)[source]#
- Allows wells to be ignored in any future processing. If called several times, the default behaviour is for any previously ignored wells not to be re-instated. - exclude: list of strings
- List of labels of wells on the plate to be excluded. 
- experiments: string or list of strings
- The experiments to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- clearall: boolean
- If True, all previously ignored wells are re-instated. 
 
 - importdf(commonnames, info=True, sep='\t')[source]#
- Import dataframes saved as either json or csv or tsv files. - Parameters
- commonnames: list of strings
- A list of names for the files to be imported with one string for each experiment. 
 
 - Examples - >>> p.importdf('Gal') >>> p.importdf(['Gal', 'Glu', 'Raf']) 
 - property info#
- Displays conditions, strains, and datatypes. 
 - load(dnames, anames=False, platereadertype='Tecan', dsheetnumbers=False, asheetnumbers=False, ODfname=None, info=True)[source]#
- Loads raw data files generated by the plate reader and the corresponding annotation files. - Parameters
- dnames: string or list of strings, optional
- The name of the file containing the data from the plate reader or a list of file names. 
- anames: string or list of strings, optional
- The name of file containing the corresponding annotation or a list of file names. 
- platereadertype: string
- The type of plate reader, currently either ‘Tecan’ or ‘Sunrise’ or ‘old Tecan’. 
- dsheetnumbers: integer or list of integers, optional
- The relevant sheets of the Excel files storing the data. 
- asheetnumbers: integer or list of integers, optional
- The relevant sheets of the corresponding Excel files for the annotation. 
- ODfname: string, optional
- The name of the file with the dilution data used to correct OD for its non-linear dependence on numbers of cells. If unspecified, data for haploid budding yeast growing in glucose is used. 
- info: boolean
- If True (default), display summary information on the data once loaded. 
- Examples
- ——-
- >>> p.load(‘Data.xlsx’, ‘DataContents.xlsx’)
- >>> p.load(‘Data.xlsx’, ‘DataContents.xlsx’, info= False)
- >>> p.load(‘Data.xlsx’, ‘DataContents.xlsx’,
- … ODfname= ‘ODcorrection_Glucose_Diploid.txt’)
 
 
 - property log#
- Prints a log of all methods called and their arguments. 
 - property ls#
- List all files in the working directory. A dictionary of available datasets is created as a shortcut. 
 - plot(x='time', y='OD', hue='strain', style='condition', size=None, kind='line', col=None, row=None, height=5, aspect=1, ymin=None, figsize=False, returnfacetgrid=False, title=None, plate=False, wells=False, nonull=False, messages=False, sortby=False, experiments='all', conditions='all', strains='all', experimentincludes=False, experimentexcludes=False, conditionincludes=False, conditionexcludes=False, strainincludes=False, strainexcludes=False, **kwargs)[source]#
- Plots from the underlying dataframes (chosen automatically) using Seaborn’s relplot, which is described at https://seaborn.pydata.org/generated/seaborn.relplot.html - Parameters
- x: string
- The variable - column of the dataframe - for the x-axis. 
- y: string
- The variable - column of the dataframe - for y-axis. 
- hue: string
- The variable whose variation will determine the colours of the lines plotted. From Seaborn. 
- style: string
- The variable whose variation will determine the style of each line. From Seaborn. 
- size: string
- The variable whose vairation will determine the size of each marker. From Seaborn. 
- kind: string
- Either ‘line’ or ‘scatter’, which determines the type of plot. From Seaborn. 
- col: string, optional
- The variable that varies over the columns in a multipanel plot. From Seaborn. 
- row: string, optional
- The variable that varies over the rows in a multipanel plot. From Seaborn. 
- height: float, optional
- The height of the individual panels in a multipanel plot. From Seaborn. 
- aspect: float, optional
- The aspect ratio of the individual panels in a multipanel plot. From Seaborn. 
- ymin: float, optional
- The minimum y-value 
- figsize: tuple, optional
- A tuple of (width, height) for the size of figure. Ignored if wells= True or plate= True. 
- returnfacetgrid: boolean, optional
- If True, return Seaborn’s facetgrid object created by relplot 
- title: float, optional
- The title of the plot (overwrites any default titles). 
- plate: boolean, optional
- If True, data for each well for a whole plate are plotted in one figure. 
- wells: boolean, optional
- If True, data for the individual wells is shown. 
- nonull: boolean, optional
- If True, ‘Null’ strains are not plotted. 
- sortby: list of strings, optional
- A list of columns to sort the data in the dataframe and passed to pandas sort_values. 
- messsages: boolean, optional
- If True, print warnings for any data requested but not found. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
- kwargs: for Seaborn’s relplot
 
- Returns
- sfig: Seaborn’s facetgrid object generated by relplot if
- returnfacetgrid= True
 
 - Examples - >>> p.plot(y= 'OD', plate= True) >>> p.plot(y= 'OD', wells= True, strainincludes= 'Gal10:GFP') >>> p.plot(y= 'OD') >>> p.plot(x= 'OD', y= 'gr') >>> p.plot(y= 'c-GFPperOD', nonull= True, ymin= 0) >>> p.plot(y= 'c-GFPperOD', conditionincludes= '2% Mal', ... hue= 'strain') >>> p.plot(y= 'c-mCherryperOD', conditions= ['0.5% Mal', ... '1% Mal'], hue= 'strain', style= 'condition', ... nonull= True, strainincludes= 'mCherry') >>> p.plot(y= 'c-GFPperOD', col= 'experiment') >>> p.plot(y= 'max gr') 
 - rename(translatedict)[source]#
- Uses a dictionary to replace all occurrences of a strain or a condition with an alternative. Note that instances of self.progress will not be updated. - Parameters
- translatedict: dictionary
- A dictionary of old name - new name pairs 
 
 
 - restricttime(tmin=None, tmax=None)[source]#
- Restrict the processed data to a range of time, ignoring points outside this time range. - Note that data in the .s dataframe outside the time range is lost. Exporting the dataframes before running restricttime is recommended. - Parameters
- tmin: float
- The minimum value of time, with data kept only for t >= tmin. 
- tmax: float
- The maximum value of time, with data kept only for t <= tmax. 
 
 
 - savefigs(fname=None, onefile=True)[source]#
- Saves all current figures to PDF, either to one file or each to a separate file. - Parameters
- fname: string, optional
- Name of file. If unspecified, the name of the experiment is used. 
- onefile: boolean, optional
- If False, each figures is save to its own PDF file. 
 
 
 - savelog(fname=None)[source]#
- Save log to file. - Parameters – fname: string, optional - The name of the file. If unspecified, the name of the experiment. 
 - showwells(concise=False, sortby=False, experiments='all', conditions='all', strains='all', experimentincludes=False, experimentexcludes=False, conditionincludes=False, conditionexcludes=False, strainincludes=False, strainexcludes=False)[source]#
- Displays wells for specified experiments, conditions, and strains. - Parameters
- concise: boolean
- If True, display as experiment: condition: strain. 
- sortby: list of strings, optional
- List of column names on which to sort the results. 
- experiments: string or list of strings
- The experiments to include. 
- conditions: string or list of strings
- The conditions to include. 
- strains: string or list of strings
- The strains to include. 
- experimentincludes: string, optional
- Selects only experiments that include the specified string in their name. 
- experimentexcludes: string, optional
- Ignores experiments that include the specified string in their name. 
- conditionincludes: string, optional
- Selects only conditions that include the specified string in their name. 
- conditionexcludes: string, optional
- Ignores conditions that include the specified string in their name. 
- strainincludes: string, optional
- Selects only strains that include the specified string in their name. 
- strainexcludes: string, optional
- Ignores strains that include the specified string in their name. 
 
 - Examples - >>> p.showwells() >>> p.showwells(strains= 'Mal12:GFP', conditions= '1% Mal')