pyprecag.table_ops¶
-
pyprecag.table_ops.
calculate_strip_stats
(input_table, treatment_column, control_columns=[], size=5)[source]¶ Calculate statistics for a strip
A moving window is used for some of the statistics. This window is centred so for a window size of 5, 2 NAN or blanks will be added to start and end of the output column.
- Statistics include (output column names):
- controls_mean - row by row mean of the control columns treat_diff - row by row difference between the treatment and controls_mean columns av_treat_diff - calculate mean of values using a moving window using the treat_diff column p_value - calculate p_value using a moving window using treatment and controls_mean columns RI - Response Index using the treatment and controls_mean columns
Parameters: - input_table (pandas.core.frame.DataFrame) – the table to calculate statistics for
- treatment_column (str) – The column containing the treatment values
- control_columns (List[str]) – The column containing the control values. This can be one or two columns
- size (int) – The size of the moving window.
Returns: The output table containing new statistics columns control_mean (str): The column used as the control mean.
Return type: pandas.core.frame.DataFrame
-
pyprecag.table_ops.
response_index
(arr)[source]¶ Moving window response index function to get two columns in to the function, one must be set as the index. .. rubric:: Example
input_table = input_table.set_index(treatment_column, drop=False) input_table[‘RI’] = input_table[‘controls_mean’].rolling(
window=size, center=True).apply(response_index, raw=False)
-
pyprecag.table_ops.
t_test
(arr)[source]¶ Moving window t-test function. to get two columns in to the function, one must be set as the index.
Example
input_table = input_table.set_index(treatment_column, drop=False)
- input_table[‘p_value’] = input_table[‘controls_mean’].rolling(
- window=size, center=True).apply(t_test, raw=False)