Bases: object
Class containing the wells and holding plate-wide parameters.
Constructor.
If filename is not None and fileformat is None some heuristics are used to identify the file format.
Parameters: |
|
---|
Saves the plate content in a file.
Parameters: | filename (str) – Name of the file. |
---|---|
Returns: | StatusMessage/None – non-fatal notifications. |
Capitalise id if in given list.
Parameters: |
|
---|---|
Returns: | str – sample id (capitalised if it matches one of capitaliseThese) |
Check that the given metadata (i.e. sample id, growth condition) is valid and can be applied.
This basically checks that there is the right amount of metadata entries and these contain sample ids and conditions.
Parameters: | metadata (list(dict)) – array of metadata dictionaries |
---|---|
Returns: | bool, StatusMessage – True if ok, False otherwise (and a StatusMessage with details) |
Set the metadata (e.g. sample id, growth condition) of the wells.
Parameters: | metadata (list(dict)) – array of metadata dictionaries |
---|
Return the metadata of the wells.
Returns: | list(dict) – metadata |
---|
Return indices into self.replicateGroups for replicate groups being listed as background.
Returns: | list(int) – indices of background replicate groups |
---|
Return replicate groups being listed as background.
Returns: | list(Replicate) – replicate groups listed as background |
---|
Return indices into self.wells for wells being listed as background.
Returns: | list(int) – indices of background wells |
---|
Return wells being listed as background.
Returns: | list(Replicate) – wells listed as background |
---|
Return index of replicate group with the given sample Id and condition.
Parameters: |
|
---|---|
Returns: | int – Index (into self.replicateGroups) of Replicate with given id and condition. |
Return index of replicate group with the given sample Id and condition.
Parameters: |
|
---|---|
Returns: | Replicate – replicate group with given id and condition. |
Return a list of indices of replicate groups with the given condition.
Parameters: | condition (string) – Condition under which the samples were grown. |
---|---|
Returns: | list(int) – Indices (into self.replicateGroups) of replicate groups with the given condition. |
Return a list of replicate groups with the given condition.
Parameters: | condition (string) – Condition under which the samples were grown. |
---|---|
Returns: | list(Replicate) – Replicate groups with given condition. |
Return a list of conditions.
Returns: | list(str) – Conditions. |
---|
Returns: | list(Replicate) – replicate groups that are not background samples. |
---|
Returns: | list(Replicate) – Indices of replicate groups that are not background samples. |
---|
Returns: | list(Replicate) – wells that are not background samples. |
---|
Return the requested parameter.
Parameters: | par (str) – The name of the parameter. |
---|
If the parameter is explicitly set for the plate, this value returned. Otherwise return None.
See chapter parameters for details of parameter handling and available parameters.
Return True if this is a parameter can have a plate-wide default.
Returns: | bool – True if parameter can be edited. |
---|
Some parameters can only be changed per Replicate, some only per Plate. This method is used to distinguish between them.
See chapter parameters for details of parameter handling and available parameters.
Return True if this is parameter is explicitly set.
Parameters: | par (str) – The name of the parameter. |
---|---|
Returns: | bool – True if parameter is explicitly set. |
If a parameter is explicitly set for a replicate it overrides an inherited value. This method is used to tell whether this is the case. Since this object is a plate it tells whether a default value has been set.
See chapter parameters for details of parameter handling and available parameters.
Return True if for at least one of the replicate groups the given parameter is explicitly set.
Parameters: | par (str) – The name of the parameter. |
---|---|
Returns: | bool – True if parameter is explicitly set in one of the replicate groups. |
See chapter parameters for details of parameter handling and available parameters.
Set lower limit of interval in which the maximal growth should be searched.
Set upper limit of interval in which the maximal growth should be searched.
Set cutoff value of log(OD).
Set value of log(OD) used to define the lag time.
Set coefficient of linear term of high density correction.
Set coefficient of quadratic term of high density correction.
Set coefficient of cubic term of high density correction.
Set degree of the smoothing spline.
Set smoothing factor used to choose the number of knots.
Set number of datapoints of sliding windows.
The value that is used for local exponential fit (growth rate) and linear regression (growth yield).
Return well ids by guessing the plate layout based on number of wells.
This function will return A1-P24 or A1-H12.
Parameters: | numberOfWells (int) – number of wells of the plate |
---|---|
Returns: | list(str) – the guessed well ids (None if layout could not be guessed) |
List the available properties that can be chosen for csv export.
Parameters: | logOdDerivativeProperties (bool) – include properties determined from log(OD) derivative |
---|---|
Returns: | list(str), list(str) – fixed columns (ids), properties |
The ‘fixed columns’ list contains the sample/condition tuples which should always be exported in order to identify the replicates. For the other properties (except ‘wellids’) the variance can be chosen by adding ‘_var’ to the property name.
Write a “comma seperated values” (csv) file of properties for all replicate groups.
Parameters: |
|
---|
Write a “comma seperated values” (csv) file of time series for all replicate groups.
Parameters: |
|
---|
Parameters: | metadata (list(dict)) – the metadata |
---|
Read metadata from a csv file.
For each metadata key a table is read. The table should be laid out as according to the plate layout. To get a template, call writeMetadata(outfile,[{} for i in range(numOfColumns)],Plate.metadataKeys)
Bases: exceptions.Exception
Base class for exceptions in this module.
Bases: platereader.plate.Error
Exception raised if there are different IDs for background wells.
Bases: platereader.plate.Error
Exception raised when an unsupported serialisation format is opened.
Bases: platereader.plate.Error
Exception raised when an unsupported serialisation format is opened.
Bases: object
A time series of optical density measurements for a single well or a group of replicates.
Constructor.
Parameters: |
|
---|
Note
The following two parameters should only be used when implementing a deserialiser.
Parameters: |
|
---|
Return string containing enough information to uniquely identify this Replicate.
Parameters: | withPlateId (bool) – If True includes the identifier string of the plate. |
---|---|
Returns: | str – A human readable string identifying this well/set of wells. |
The string contains enough information to uniquely identify the well (sample id, condition, well location, active child wells)
Returns: | Replicate – The replicate group this well is a child of. |
---|
A single-well usually is part of a replicate group. The child objects of a replicate group are used to calculate properties such as growth rate, lag time etc. This method returns the replicate group parent if this is a single-well object.
Returns: | bool – True if this is a replicate group (not a single well). |
---|
For details see the documentation of replicateGroupParent.
Return the indices into the plate’s single-well object array.
Returns: | list(int) – Absolute indices of all child wells. |
---|
Note
the indices are global indices into the array of single-well objects of the plate.
Return the single-well child objects.
Returns: | list(Replicate) – child wells of this replicate. |
---|
Set the active wells of this Replicate.
Parameters: | activeWellIndices (list(int)) – Indices into the vector of child wells of this replicate group. |
---|
A replicate group object consists of multiple wells (its children). This method changes which of these are used when calculating properties such as growth rate, lag time etc.
Note
these indices are local indices into the list of well indices of this replicate group, i.e. the maximal value should be (number of child wells - 1).
The child with the given index will be (de-)activated.
Parameters: |
|
---|
For details see the documentation of setActiveChildWellIndices.
Return the indices of the active child-wells.
Returns: | list(int) – Local indices of active child wells. |
---|
Note
these indices are local indices into the list of well indices of this replicate, i.e. the maximal value should be (number of child wells - 1).
For details see the documentation of setActiveChildWellIndices.
Return the objects of the active child-wells.
Returns: | list(Replicate) – active child wells of this Replicate. |
---|
For details see the documentation of setActiveChildWellIndices.
Return ids of active child-wells as list of strings.
If well ids are set, return these, otherwise return the indices of the wells.
Returns: | list(str) – A list of human readable strings identifying this’ active well/set of wells. |
---|
For details see the documentation of setActiveChildWellIndices.
Return ids of active child-wells as string.
If well ids are set, return these, otherwise return the indices of the wells.
Returns: | str – A human readable string identifying this’ active well/set of wells. |
---|
Return the requested parameter.
Parameters: | par (str) – The name of the parameter. |
---|
If the parameter is explicitly set for this replicate this value returned. Otherwise return an inherited value from either the replicate group this one is part of, or the plate default.
See chapter parameters for details of parameter handling and available parameters.
Return True if this is a parameter that is editible for a Replicate.
Returns: | bool – True if parameter can be edited. |
---|
Some parameters can only be changed per Replicate, some only per Plate. This method is used to distinguish between them.
See chapter parameters for details of parameter handling and available parameters.
Return True if this is parameter is explicitly set.
Parameters: | par (str) – The name of the parameter. |
---|---|
Returns: | bool – True if parameter is explicitly set. |
If a parameter is explicitly set for a replicate it overrides an inherited value. This method is used to tell whether this is the case.
See chapter parameters for details of parameter handling and available parameters.
Return True if this is a ReplicateGroup and for at least one of the active child-wells the given parameter is explicitly set.
Parameters: | par (str) – The name of the parameter. |
---|---|
Returns: | bool – True if parameter is explicitly set in one of the active child wells. |
See chapter parameters for details of parameter handling and available parameters.
Returns: | float – Coefficient of linear term of high density correction. |
---|
Returns: | float – Coefficient of quadratic term of high density correction. |
---|
Returns: | float – Coefficient of cubic term of high density correction. |
---|
Returns: | int – Degree of the smoothing spline. |
---|
Returns: | float – Smoothing factor used to choose the number of knots. |
---|
Returns: | float – Lower limit of interval in which the maximal growth should be searched. |
---|
Returns: | float – Upper limit of interval in which the maximal growth should be searched. |
---|
Returns: | float – Cutoff value of log(OD). |
---|
Returns: | int – Number of datapoints of sliding windows. |
---|
The value that is used for local exponential fit (growth rate) and linear regression (growth yield).
Returns: | float – Value of log(OD) used to define the lag time. |
---|
Returns: | bool – Whether or not the maximal growth rate is allowed at the interval limits. |
---|
Returns: | int – Number of standard errors the slope may be away from zero to detect stationary state of yield. |
---|
Set lower limit of interval in which the maximal growth should be searched.
Set upper limit of interval in which the maximal growth should be searched.
(Dis)allow the maximal growth rate at the lower interval limit.
Set number of standard errors the slope may be away from zero to detect stationary state of yield.
Return the raw readout of the optical density.
The raw optical density is not preprocessed, i.e. the background has not been subtracted and it is not corrected for non-linearities at high densities.
Return the variance of raw readout of the optical density.
Return the background- and high-density corrected optical density.
Return the variance of the background- and high-density corrected optical density.
Return the (left) derivative of the background- and high-density corrected optical density.
Return smoothing spline of optical density.
Returns: | numpy.array(float) – Smoothed optical density. |
---|
Return derivative of smoothed optical density.
Returns: | numpy.array(float) – Derivative of smoothed optical density. |
---|
Return the logarithm of the background- and high-density corrected optical density.
Return smoothed logarithm optical density.
Returns: | numpy.array(float) – Smoothed log(OD). |
---|
Return derivative of logarithmised optical density.
Returns: | numpy.array(float) – Derivative of logarithmised optical density. |
---|
Return derivative of logarithmised optical density (by chain rule).
Returns: | numpy.array(float) – Derivative of logarithmised optical density. |
---|
Return smoothed derivative of logarithmised optical density (by chain rule).
Returns: | numpy.array(float) – Derivative of logarithmised optical density. |
---|
Return parameters for fitted exponential functions (two parameters: OD0 and mu).
Returns: | numpy.array(float), numpy.array(float), numpy.array(float), numpy.array(float) – mean(mu), var(mu), mean(od0), var(od0) |
---|
Exponential functions are fitted piecewise to (see Fit window) data points. Note that the inital value assumes that for the first data point of the fit window; to convert it to the real time you should use the formula .
Return parameters for fitted exponential functions (one parameter: mu).
Returns: | numpy.array(float), numpy.array(float) – mean(mu), var(mu) |
---|
Exponential functions are fitted piecewise to (see Fit window) data points. Only the growth rate is fitted, the first data point from is used as initial value of the exponential function.
Return parameters for exponential function at maximal growth rate (determined from log(OD) derivative).
Returns: | mean(mu), var(mu), mean(od0), var(od0), mean(maxt), var(maxt), mean(lag), var(lag), method, statuses |
---|
Return parameters for exponential function at maximal growth rate (determined from fitted exponential functions).
Returns: | mean(mu), var(mu), mean(od0), var(od0), mean(maxt), var(maxt), mean(lag), var(lag), method, statuses |
---|
Return maximal slope, intercept, time of maximal slope and time index of the (linear) OD.
Returns: | float, float, float, float, float, float, numpy.array(int), StatusMessage – mean(slope), var(slope), mean(intercept), var(intercept), mean(timemax), var(timemax), timemaxIdcs, status |
---|
Return estimate of the growth yield by looking for a slope (from linear regression in a time window) compatible with zero.
Returns: | float, float, float, float, StatusMessage – mean(yield), var(yield), mean(timeOfYield), var(timeOfYield), status |
---|
Calculate doubling time from growth rate.
Parameters: |
|
---|---|
Returns: | float, float – doubling time, variance of doubling time |
Bases: object
Partially serialise CLS data and save to file.
Parameters: | filename (str) – Name of the file. |
---|---|
Returns: | StatusMessage/None – non-fatal notifications. |
Allows to preserve the state of activated wells. The plates are not saved, therefore their relative file location must not change for the loading to work.
Returns: | list(ClsReplicate) – ClsReplicate that are not background samples. |
---|
Returns: | list(ClsReplicate) – Indices of ClsReplicate that are not background samples. |
---|
Parameters: | csvkwargs (dict()) – Parameters which are passed on to the csv module; defaults to { ‘dialect’: ‘excel’ } |
---|
Return differences in sample/condition of wells of two plates.
Returns: | StatusMessage – None if no differences, otherwise a status message with the differences. |
---|
Bases: exceptions.Exception
Base class for exceptions in this module.
Bases: platereader.cls.Error
Exception raised if a plate does not exist (anymore).
Cls does not store the data in itself, but rather uses existing Plate files. If these got (re)moved we cannot initialise Cls.
Bases: platereader.cls.Error
Exception raised when an unsupported serialisation format is opened.
Bases: object
Returns: | bool – True if this is a replicate group. |
---|
For details see the documentation of replicateGroupParent.
Return the indices into the plate’s single-well object array.
Returns: | list(int) – Absolute indices of all child wells. |
---|
Note
the indices are global indices into the array of single-well objects of the plate.
Return the single-well cls objects.
Returns: | list(Replicate) – child cls wells of this replicate. |
---|
Set the active wells indices.
A replicate group object consists of multiple wells (its children). This method changes which of these are used when calculating properties such as viability etc.
Note
these indices are local indices into the list of well indices of this replicate group, i.e. the maximal value should be (number of child wells - 1).
The child with the given index will be (de-)activated.
Parameters: |
|
---|
For details see the documentation of setActiveChildWellIndices.
Return the indices of the active children.
Returns: | list(int) – Local indices of active child wells. |
---|
Note
these indices are local indices into the list of well indices of this replicate, i.e. the maximal value should be (number of child wells - 1).
For details see the documentation of setActiveChildWellIndices.
Returns: | list(Replicate) – active child wells of this Replicate. |
---|
Return ids of active wells as list of strings.
If well ids are set, return these, otherwise return the indices of the wells.
Returns: | list(str) – A list of human readable strings identifying this’ active well/set of wells. |
---|
Return ids of active wells as string.
If well ids are set, return these, otherwise return the indices of the wells.
Returns: | str – A human readable string identifying this’ active well/set of wells. |
---|
Returns: | list(Replicate), list(float) – replicate objects of the underlying plates, days. |
---|
Return string containing enough information to uniquely identify this ClsReplicate.
Returns: | str – A human readable string identifying this well/set of wells. |
---|
The string contains enough information to uniquely identify the well (sample id, condition, well location, active child wells)
Calculate the viability.
Returns: | list(float), list(float), list(float), StatusMessage – days, viability, var(viability), status. |
---|
Calculate the survival integral.
Returns: | float, float, StatusMessage – survival integral, var(survival integral), status. |
---|
Bases: object
Holds (multiple) status information.
This class allows to collect status information (e.g. for a dataset).
This class can be either a list of statuses or a single status.
For a single status, the message method returns a string representation of the status.
For a list of statuses, the message method returns a single string, consisting of one string representation for each status-type. If a status-type exists multiple times, only the highest priority message of this type is shown.
As an alternative to the message method, you can use type2status and assemble the required string yourself.
Initialise with a keyword and a dict of further parameters, or with a list of (sub)statuses.
Parameters: |
|
---|
Return True if this is an empty StatusMessage.
Returns: | bool – True if empty. |
---|
Return a list of all substatuses that have the given key.
Parameters: | key (string) – The key-type that substatus should match. |
---|---|
Returns: | list(StatusMessage) – status messages of type key. |
Add a substatus to this status.
Parameters: | status (StatusMessage) – The substatus that should be added. |
---|
Raises exception if this object was not initialised as list of statuses.
Remove all substatuses that have the given key.
Parameters: | key (string) – The key-type that substatus should match. |
---|---|
Returns: | int – number of removed status messages. |
Short message for this status (only works for primary status, not for list of statuses)
Returns: | str – Short message describing this status. |
---|
Long message for this status (only works for primary status, not for list of statuses)
Returns: | str – Long message describing this status. |
---|
Message type for this status (only works for primary status, not for list of statuses)
Returns: | str – String describing the type of this status. |
---|
Returns: | dict – Dictionary that for each message type contains the highest priority message. |
---|
Returns: | str – Status message. |
---|
For a list of (sub)statuses, only shows the one with the highest priority/severity for each category (message type).
Returns: | Severity – The severity/priority of this status. |
---|
If this is a list of (sub)statuses return the higest.
Returns: | Severity – The second-level severity/priority of this status. |
---|
For this to work the parameter dict has to contain the ‘severity2’ entry; if this is not set return 0.
If this is a list of (sub)statuses return the higest.