hts.plate package¶
Submodules¶
hts.plate.plate module¶
- synopsis
The Plate Class.
-
class
hts.plate.plate.
Plate
(data, name, **kwargs)[source]¶ Bases:
object
Plate
describes all information connected to the readout_dict of a high throughput screen. This could be either several readouts of a plate, or the same plate across several plates.-
name
¶ Name of the plate
- Type
str
-
width
¶ Width of the plate
- Type
int
-
height
¶ Height of the plate
- Type
int
-
KNOWN_DATA_TYPES[i]
The data associated to this Plate, e.g. a plate layout, or readouts.
- Type
subclass of plate_data.PlateData
-
add_data
(data_type, data, force=False, tag=None)[source]¶ Add data of data_type to self.config_data
Add data of data_type to self.config_data
-
calculate_control_normalized_signal
(data_tag_readout, negative_control_key, positive_control_key, data_tag_normalized_readout=None, local=True, **kwargs)[source]¶ Normalize the signal in data_tag_readout, normalized by negative_control_key and positive_control_key.
Normalize the signal in data_tag_readout, normalized by negative_control_key and positive_control_key.
The normalization is calculated as: .. math:
y’ =
rac{y - mu_{nc}}{| mu_{nc} - mu_{pc}| }
For local==True, $mu_{nc}$ and $mu_{pc}$ are predicted locally to the well (using Gaussian processes). For local==False, $mu_{nc}$ and $mu_{pc}$ are estimated by the average control values across the plate.
- Args:
data_tag_readout (str): The key for self.readout.data where the readouts are stored. negative_control_key (str): The name of the negative control in the plate layout. positive_control_key (str): The name of the positive control in the plate layout. data_tag_normalized_readout (str): The key for self.readout.data where the normalized readouts will be stored. local (Bool): If True, use Gaussian processes to locally predict the control distributions. Else, use
plate-wise control distributions.
-
calculate_linearly_normalized_signal
(unnormalized_key, normalized_0, normalized_1, normalized_key)[source]¶ Linearly normalize the data
\[\]normalized__i =
rac{ x_{unnormalized_i} - hat{x_{low}} } { hat{x_{high}} - hat{x_{low}} }
normalized_0 are all wells (according to the plate layout) with mean(wells)==0 after normalization. normalized_1 are all wells (according to the plate layout) with mean(wells)==1 for normalization.
- Args:
unnormalized_key (str): The key for self.readout.data where the unnormalized
Readout
instance is stored. normalized_key (str): The key for self.readout.data where the resulting normalizedReadout
instance will be stored. x_low (list of str): The list of names of all low fixtures in the plate layout (self.plate_data). x_high (list of str): The list of names of the high fixture in the plate layout (self.plate_data).
-
calculate_local_ssmd
(data_tag_mean_pos, data_tag_mean_neg, data_tag_std_pos, data_tag_std_neg, data_tag_ssmd, **kwargs)[source]¶ Calculate local SSMD values.
- Parameters
data_tag_mean_pos –
data_tag_mean_neg –
data_tag_std_pos –
data_tag_std_neg –
data_tag_ssmd –
Returns:
-
calculate_net_fret
(donor_channel, acceptor_channel, fluorophore_donor='fluorophore_donor', fluorophore_acceptor='fluorophore_acceptor', buffer='buffer', net_fret_key='net_fret')[source]¶ Calculate the net FRET signal for a donor acceptor FRET setup.
Calculate the net FRET signal for a donor acceptor FRET setup. Typical donor -> aceptor pairs include
414nm CFP -> 475nm -> YFP 525nm
EU -> 615nm -> APC 665nm
The following wells are needed, for both channels
donor Donor_fluorophor blank
acceptor Acceptor_fluorophor blank
buffer Buffer blank
The proportionality factor for donor compensation is then calculation as .. math:
p =
rac{hat{donor_{acceptor_channel}} - hat{buffer_{acceptor_channel}}}{hat{donor_{donor_channel}} - hat{buffer_{donor_channel}}}
Further, the net FRET signal f for all wells x may be calculated as: .. math:
netfret = x_{acceptor_channel} - hat{acceptor_{acceptor_channel}} - p cdot (x_{donor_channel} - hat{buffer_{donor_channel}})
- Args:
donor_channel (str): The key for self.readout.data where the donor_channel
Readout
instance is stored. acceptor_channel (str): The key for self.readout.data where the acceptor_channelReadout
instance is stored. fluorophore_donor (str): The name of the donor fluorophore in self.plate_data. fluorophore_acceptor (str): The name of the acceptor fluorophore in self.plate_data. buffer (str): The name of the buffer in self.plate_data. net_fret_key (str): The key for self.readout.data where the resulting net fretReadout
instance will be stored.
-
calculate_normalization_by_division
(unnormalized_key, normalizer_key, normalized_key)[source]¶ The normalize data set is equal to a division of all data by the mean of a subset of the data. :param unnormalized_key: The key for self.readout.data where the unnormalized
Readout
instance is stored. :type unnormalized_key: str :param normalized_key: The key for self.readout.data where the resulting normalizedReadout
instance will be stored. :type normalized_key: str
-
calculate_significance_compared_to_null_distribution
(data_tag_readout, sample_tag_null_distribution, data_tag_standard_score, data_tag_p_value, is_higher_value_better, **kwargs)[source]¶ Calculate the standard score and p-value for all data (in data_tag_readout) compared to the null distribution defined by all data of sample_tag_null_distribution in data_tag_readout. Save as readouts with tags data_tag_standard_score and data_tag_p_value.
Assume that the samples in sample_tag_null_distribution follows a Gaussian distribution.
WARNING! For pvalue calculation, we assume that the control, which has lower mean values, is also supposed to show lower mean values. [Otherwise, we would have to introduce a boolean “pos_control_lower_than_neg_control.”]
- Parameters
data_tag_readout (str) – The key for self.readout.data where the readouts are stored.
sample_tag_null_distribution (str) – The sample key (defined in plate layout) defining what sample will make up the null distribution that we compare all other samples to.
data_tag_standard_score (str) – The key for self.readout.data where the standard scores will be stored.
data_tag_p_value (str) – The key for self.readout.data where the p-values will be stored.
**kwargs –
Returns:
-
classify_by_cutoff
(data_tag_readout, data_tag_classified_readout, threshold, is_higher_value_better=True, is_twosided=False, **kwargs)[source]¶ Map a dataset of float values to either binary (is_twosided==False) or [-1,0,1] (is_twosided==True), depending on whether values fall below threshold
- Parameters
data_tag_readout – The key for self.readout.data where the readouts are stored.
data_tag_classified_readout – The key for self.readout.data where the True/False classification values will be stored.
threshold –
Returns:
-
create
(name=None, **kwargs)[source]¶ Create
Plate
instance.Create
Plate
instance.- Parameters
path (str) – Path to input file or directory
format (str) – Format of the input file, at current not specified
-
cross_validate_predictions
(data_tag_readout, sample_tag, method_name, **kwargs)[source]¶ Cross validate sample value predictions for sample type sample_tag and readout data_tag_readout, using prediction method method_name.
- Parameters
data_tag_readout (str) – The key for self.readout.data where the
Readout
instance is stored.sample_tag (str) – The sample for which the gaussian process will be modeled according to the position in self.plate_layout.data. E.g. for positive controls “pos”
method_name (str) – The prediction method. E.g. gp for Gaussian processes.
-
evaluate_well_value_prediction
(data_predictions, data_tag_readout, sample_key=None)[source]¶ Calculate mean squared prediction error.
ToDo: Debug. Better: REWRITE!
-
filter
(value_data_type, value_data_tag, value_type=None, condition_data_type=None, condition_data_tag=None, condition=None, return_list=True)[source]¶ Get list of values for defined wells of the data tagged with data_tag. If value_type is set, check if all values conform with value_type.
- Parameters
condition_data_type (str) – Reference to PlateData instance on which wells are filtered for the condition.
condition_data_tag (str) – Data tag for condition_data_type
condition (method) – The condition expressed as a method.
value_data_type (str) – Reference to PlateData instance from which (for filtered wells) the values are retrieved.
value_data_tag (str) – Data tag for value_data_type.
value_type (str) – The type of the return values.
return_list (bool) – Returns a flattened list of all values
- Returns
(list of x), where x are of type value_type, if value_type is set.
..todo: rename method from filter to get_data
-
randomize_values
(data_tag_readout, data_tag_randomized_readout, randomized_samples='s', **kwargs)[source]¶ Randomize the signal in a readout per plate and for a specific sample. The result of this method has only visualization purposes.
- Parameters
data_tag_readout (str) – The key for self.readout.data where the readouts are stored.
data_tag_randomized_readout (str) – The key for self.readout.data where the randomized data will be stored.
**kwargs –
-