label_responsive_genes
Labels genes in a DataFrame as responsive or not based on thresholds for expression effect and p-value. Note that the comparisons on the thresholds are strictly greater than for the abs_expression_effect_threshold and strictly less than for the expression_pvalue_threshold.
The function adds a new boolean column ‘responsive’ to the DataFrame, where each gene is labeled as responsive if its absolute effect expression is strictly greater than a threshold and its p-value is strictly less than a specified threshold. If normalization is enabled, only the top genes meeting the criteria up to the minimum number found in the normalized subset are labeled as responsive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
DataFrame containing gene data. Must include ‘expression_effect’ and ‘expression_pvalue’ columns. |
required |
abs_expression_effect_threshold |
float
|
Absolute value threshold for the absolute value of the expression effect. Values strictly greater than this threshold are considered responsive if the pvalue threshold passes. |
required |
expression_pvalue_threshold |
float
|
Threshold for the expression p-value. Values strictly less than this threshold are considered responsive if the effect threshold passes. |
required |
normalization_cutoff |
int
|
The maximum number of responsive genes to consider prior to labelling. This serves to normalize rank response across expression data sets. Defaults to -1, which disables normalization. |
-1
|
Returns:
Type | Description |
---|---|
pd.DataFrame: The input DataFrame with an added ‘responsive’ column. |
Raises:
Type | Description |
---|---|
KeyError
|
If ‘expression_effect’ or ‘expression_pvalue’ are not in |
Examples:
>>> df = pd.DataFrame({'effect_expression': [0.5, 0.7, 1.2],
'p_expression': [0.01, 0.05, 0.2]})
>>> label_responsive_genes(df, 0.6, 0.05).responsive
[False, True, False]
Source code in callingcardstools/Analysis/yeast/rank_response/label_responsive_genes.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|