pflex 1.1__tar.gz → 1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pflex-1.1 → pflex-1.3}/PKG-INFO +37 -16
- {pflex-1.1 → pflex-1.3}/README.md +35 -14
- {pflex-1.1 → pflex-1.3}/docs/getting-started.md +9 -9
- {pflex-1.1 → pflex-1.3}/docs/index.md +1 -1
- {pflex-1.1 → pflex-1.3}/docs/user-guide.md +36 -30
- {pflex-1.1 → pflex-1.3}/pyproject.toml +2 -2
- {pflex-1.1 → pflex-1.3}/src/pflex/__init__.py +11 -12
- {pflex-1.1 → pflex-1.3}/src/pflex/analysis.py +336 -207
- {pflex-1.1 → pflex-1.3}/src/pflex/examples/basic_usage.py +28 -16
- {pflex-1.1 → pflex-1.3}/src/pflex/plotting.py +647 -909
- {pflex-1.1 → pflex-1.3}/src/pflex/preprocessing.py +4 -4
- pflex-1.3/tests/test_mpr_filters.py +176 -0
- pflex-1.3/tests/test_plotting_labels.py +205 -0
- {pflex-1.1 → pflex-1.3}/.gitignore +0 -0
- {pflex-1.1 → pflex-1.3}/.python-version +0 -0
- {pflex-1.1 → pflex-1.3}/LICENSE +0 -0
- {pflex-1.1 → pflex-1.3}/docs/installation.md +0 -0
- {pflex-1.1 → pflex-1.3}/mkdocs.yml +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/__init__.py +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/example_input/__init__.py +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/example_input/skin_cell_lines_corum_genes.parquet +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/example_input/soft_tissue_cell_lines_corum_genes.parquet +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/CORUM.parquet +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/GOBP.parquet +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/PATHWAY.parquet +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/__init__.py +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/corum.csv +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/gobp.csv +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/data/functional_standard/pathway.csv +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/logging_config.py +0 -0
- {pflex-1.1 → pflex-1.3}/src/pflex/utils.py +0 -0
- {pflex-1.1 → pflex-1.3}/uv.lock +0 -0
{pflex-1.1 → pflex-1.3}/PKG-INFO
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pflex
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological functional standards. The toolkit computes gene-level and
|
|
3
|
+
Version: 1.3
|
|
4
|
+
Summary: pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological functional standards. The toolkit computes gene-level and module-level performance metrics, helping researchers systematically assess the biological relevance and resolution of their CRISPR screening data.
|
|
5
5
|
Author-email: Yasir Demirtas <tyasird@hotmail.com>
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -41,15 +41,15 @@ Description-Content-Type: text/markdown
|
|
|
41
41
|
|
|
42
42
|
**Abstract**
|
|
43
43
|
|
|
44
|
-
Genetic networks derived from omics data are a powerful tool for systematic gene function prediction. Performance evaluation of such predictions is crucial to judge the data and computational pipeline
|
|
44
|
+
Genetic networks derived from omics data are a powerful tool for systematic gene function prediction. Performance evaluation of such predictions is crucial to judge the data and computational pipeline for network construction, but unbalanced functional standards often cause hidden evaluation biases. To visualize and mitigate such biases, we previously developed the R package FLEX. Here, we present the pFLEX genetic network benchmarking tool as Python library with new and improved functionality. pFLEX improves overall runtime 4.1 to 15.8-fold. It offers additional evaluation metrics that allow for easy comparison of precision recall performance at the module or pathway resolution between genetic networks. We demonstrate the utility of pFLEX for evaluating tissue-specific co-essentiality networks and data normalization strategies of the Cancer Dependency Map, as well as for cell line-specific Perturb-Seq-derived networks. This illustrates the requirement for biological module-resolved precision recall metrics in pFLEX for sensitive and fast evaluation of genetic networks.
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
48
48
|
## Features
|
|
49
49
|
|
|
50
50
|
- Precision-recall curve generation for ranked gene lists
|
|
51
|
-
- Evaluation using CORUM
|
|
52
|
-
-
|
|
51
|
+
- Evaluation using CORUM-derived modules, GO terms, and pathways
|
|
52
|
+
- Module-level resolution analysis and visualization
|
|
53
53
|
- Easy integration into CRISPR screen workflows
|
|
54
54
|
- Packaged DepMap example inputs filtered to CORUM genes
|
|
55
55
|
|
|
@@ -103,7 +103,7 @@ pFLEX expects each input dataset as a matrix with genes in rows and screens, sam
|
|
|
103
103
|
| AATF | 0.042 | -0.088 | -0.016 |
|
|
104
104
|
| BCL6 | -0.019 | 0.112 | -0.074 |
|
|
105
105
|
|
|
106
|
-
CSV, Excel,
|
|
106
|
+
CSV, Excel, and Parquet files are supported. Parquet is recommended for larger matrices.
|
|
107
107
|
|
|
108
108
|
The packaged example inputs are real DepMap 25Q2 tissue subsets filtered to genes present in CORUM:
|
|
109
109
|
|
|
@@ -134,8 +134,8 @@ inputs = {
|
|
|
134
134
|
```python
|
|
135
135
|
config = {
|
|
136
136
|
"functional_standard": "CORUM",
|
|
137
|
-
"
|
|
138
|
-
"
|
|
137
|
+
"min_genes_in_module": 2,
|
|
138
|
+
"min_genes_per_module_analysis": 2,
|
|
139
139
|
"output_folder": "output",
|
|
140
140
|
"analysis_genes": "shared",
|
|
141
141
|
"jaccard": True,
|
|
@@ -143,7 +143,7 @@ config = {
|
|
|
143
143
|
"fill_na": True,
|
|
144
144
|
},
|
|
145
145
|
"corr_function": "numpy_without_mask",
|
|
146
|
-
"
|
|
146
|
+
"per_module": {
|
|
147
147
|
"n_jobs": 8,
|
|
148
148
|
},
|
|
149
149
|
"plotting": {
|
|
@@ -160,7 +160,7 @@ Common choices:
|
|
|
160
160
|
- `sort`: `"high"` or `"low"` per input dataset
|
|
161
161
|
- `preprocessing.fill_na`: fill missing values with gene means
|
|
162
162
|
- `corr_function`: `"numpy"`, `"numpy_without_mask"`, `"numba"`, or `"pandas"`
|
|
163
|
-
- `
|
|
163
|
+
- `per_module.n_jobs`: worker count for per-module analysis
|
|
164
164
|
|
|
165
165
|
### Analysis Flow
|
|
166
166
|
|
|
@@ -172,20 +172,41 @@ terms, _ = flex.load_functional_standard()
|
|
|
172
172
|
for name, dataset in data.items():
|
|
173
173
|
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
174
174
|
flex.pra(name, corr, is_corr=True)
|
|
175
|
-
flex.
|
|
176
|
-
flex.
|
|
175
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
176
|
+
flex.module_contributions(name)
|
|
177
177
|
flex.mpr_prepare(name)
|
|
178
178
|
|
|
179
179
|
flex.plot_precision_recall_curve()
|
|
180
180
|
flex.plot_auc_scores()
|
|
181
|
-
flex.
|
|
182
|
-
flex.
|
|
183
|
-
flex.
|
|
184
|
-
flex.
|
|
181
|
+
flex.plot_significant_modules()
|
|
182
|
+
flex.plot_per_module_scatter(n_top=10)
|
|
183
|
+
flex.plot_per_module_scatter_by_size(n_top=10)
|
|
184
|
+
flex.plot_module_contributions()
|
|
185
185
|
flex.plot_mpr_summary()
|
|
186
186
|
flex.save_results_to_csv()
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
+
`mpr_prepare()` computes only the standard, unfiltered module-coverage mPR
|
|
190
|
+
curve. `plot_mpr_summary()` plots that curve and the corresponding dataset-level
|
|
191
|
+
mPR AUC values; it does not produce a duplicate global precision-recall plot.
|
|
192
|
+
|
|
193
|
+
The predefined complex-filter comparisons are optional and computed lazily:
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
for name in data:
|
|
197
|
+
flex.mpr_filter(name)
|
|
198
|
+
flex.globalpr_filter(name)
|
|
199
|
+
|
|
200
|
+
# Compare all complexes, removal of mtRibo / ETC I, and removal of
|
|
201
|
+
# small high-AUPRC complexes.
|
|
202
|
+
mpr_ax, mpr_filter_auc = flex.plot_mpr_filter()
|
|
203
|
+
globalpr_ax = flex.plot_globalpr_filter()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The calculation and plotting calls are intentionally separate. Calling a
|
|
207
|
+
filter plotting function before its matching calculation raises an error that
|
|
208
|
+
identifies the required preparation function.
|
|
209
|
+
|
|
189
210
|
See the [User Guide](https://tyasird.github.io/pFLEX/user-guide/) for a detailed explanation of every input field, configuration key, function, return value, and output.
|
|
190
211
|
|
|
191
212
|
---
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
**Abstract**
|
|
12
12
|
|
|
13
|
-
Genetic networks derived from omics data are a powerful tool for systematic gene function prediction. Performance evaluation of such predictions is crucial to judge the data and computational pipeline
|
|
13
|
+
Genetic networks derived from omics data are a powerful tool for systematic gene function prediction. Performance evaluation of such predictions is crucial to judge the data and computational pipeline for network construction, but unbalanced functional standards often cause hidden evaluation biases. To visualize and mitigate such biases, we previously developed the R package FLEX. Here, we present the pFLEX genetic network benchmarking tool as Python library with new and improved functionality. pFLEX improves overall runtime 4.1 to 15.8-fold. It offers additional evaluation metrics that allow for easy comparison of precision recall performance at the module or pathway resolution between genetic networks. We demonstrate the utility of pFLEX for evaluating tissue-specific co-essentiality networks and data normalization strategies of the Cancer Dependency Map, as well as for cell line-specific Perturb-Seq-derived networks. This illustrates the requirement for biological module-resolved precision recall metrics in pFLEX for sensitive and fast evaluation of genetic networks.
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
19
|
- Precision-recall curve generation for ranked gene lists
|
|
20
|
-
- Evaluation using CORUM
|
|
21
|
-
-
|
|
20
|
+
- Evaluation using CORUM-derived modules, GO terms, and pathways
|
|
21
|
+
- Module-level resolution analysis and visualization
|
|
22
22
|
- Easy integration into CRISPR screen workflows
|
|
23
23
|
- Packaged DepMap example inputs filtered to CORUM genes
|
|
24
24
|
|
|
@@ -72,7 +72,7 @@ pFLEX expects each input dataset as a matrix with genes in rows and screens, sam
|
|
|
72
72
|
| AATF | 0.042 | -0.088 | -0.016 |
|
|
73
73
|
| BCL6 | -0.019 | 0.112 | -0.074 |
|
|
74
74
|
|
|
75
|
-
CSV, Excel,
|
|
75
|
+
CSV, Excel, and Parquet files are supported. Parquet is recommended for larger matrices.
|
|
76
76
|
|
|
77
77
|
The packaged example inputs are real DepMap 25Q2 tissue subsets filtered to genes present in CORUM:
|
|
78
78
|
|
|
@@ -103,8 +103,8 @@ inputs = {
|
|
|
103
103
|
```python
|
|
104
104
|
config = {
|
|
105
105
|
"functional_standard": "CORUM",
|
|
106
|
-
"
|
|
107
|
-
"
|
|
106
|
+
"min_genes_in_module": 2,
|
|
107
|
+
"min_genes_per_module_analysis": 2,
|
|
108
108
|
"output_folder": "output",
|
|
109
109
|
"analysis_genes": "shared",
|
|
110
110
|
"jaccard": True,
|
|
@@ -112,7 +112,7 @@ config = {
|
|
|
112
112
|
"fill_na": True,
|
|
113
113
|
},
|
|
114
114
|
"corr_function": "numpy_without_mask",
|
|
115
|
-
"
|
|
115
|
+
"per_module": {
|
|
116
116
|
"n_jobs": 8,
|
|
117
117
|
},
|
|
118
118
|
"plotting": {
|
|
@@ -129,7 +129,7 @@ Common choices:
|
|
|
129
129
|
- `sort`: `"high"` or `"low"` per input dataset
|
|
130
130
|
- `preprocessing.fill_na`: fill missing values with gene means
|
|
131
131
|
- `corr_function`: `"numpy"`, `"numpy_without_mask"`, `"numba"`, or `"pandas"`
|
|
132
|
-
- `
|
|
132
|
+
- `per_module.n_jobs`: worker count for per-module analysis
|
|
133
133
|
|
|
134
134
|
### Analysis Flow
|
|
135
135
|
|
|
@@ -141,20 +141,41 @@ terms, _ = flex.load_functional_standard()
|
|
|
141
141
|
for name, dataset in data.items():
|
|
142
142
|
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
143
143
|
flex.pra(name, corr, is_corr=True)
|
|
144
|
-
flex.
|
|
145
|
-
flex.
|
|
144
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
145
|
+
flex.module_contributions(name)
|
|
146
146
|
flex.mpr_prepare(name)
|
|
147
147
|
|
|
148
148
|
flex.plot_precision_recall_curve()
|
|
149
149
|
flex.plot_auc_scores()
|
|
150
|
-
flex.
|
|
151
|
-
flex.
|
|
152
|
-
flex.
|
|
153
|
-
flex.
|
|
150
|
+
flex.plot_significant_modules()
|
|
151
|
+
flex.plot_per_module_scatter(n_top=10)
|
|
152
|
+
flex.plot_per_module_scatter_by_size(n_top=10)
|
|
153
|
+
flex.plot_module_contributions()
|
|
154
154
|
flex.plot_mpr_summary()
|
|
155
155
|
flex.save_results_to_csv()
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
`mpr_prepare()` computes only the standard, unfiltered module-coverage mPR
|
|
159
|
+
curve. `plot_mpr_summary()` plots that curve and the corresponding dataset-level
|
|
160
|
+
mPR AUC values; it does not produce a duplicate global precision-recall plot.
|
|
161
|
+
|
|
162
|
+
The predefined complex-filter comparisons are optional and computed lazily:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
for name in data:
|
|
166
|
+
flex.mpr_filter(name)
|
|
167
|
+
flex.globalpr_filter(name)
|
|
168
|
+
|
|
169
|
+
# Compare all complexes, removal of mtRibo / ETC I, and removal of
|
|
170
|
+
# small high-AUPRC complexes.
|
|
171
|
+
mpr_ax, mpr_filter_auc = flex.plot_mpr_filter()
|
|
172
|
+
globalpr_ax = flex.plot_globalpr_filter()
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The calculation and plotting calls are intentionally separate. Calling a
|
|
176
|
+
filter plotting function before its matching calculation raises an error that
|
|
177
|
+
identifies the required preparation function.
|
|
178
|
+
|
|
158
179
|
See the [User Guide](https://tyasird.github.io/pFLEX/user-guide/) for a detailed explanation of every input field, configuration key, function, return value, and output.
|
|
159
180
|
|
|
160
181
|
---
|
|
@@ -28,8 +28,8 @@ inputs = {
|
|
|
28
28
|
|
|
29
29
|
config = {
|
|
30
30
|
"functional_standard": "CORUM",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"min_genes_in_module": 2,
|
|
32
|
+
"min_genes_per_module_analysis": 2,
|
|
33
33
|
"output_folder": "output",
|
|
34
34
|
"analysis_genes": "shared",
|
|
35
35
|
"jaccard": True,
|
|
@@ -37,7 +37,7 @@ config = {
|
|
|
37
37
|
"fill_na": True,
|
|
38
38
|
},
|
|
39
39
|
"corr_function": "numpy_without_mask",
|
|
40
|
-
"
|
|
40
|
+
"per_module": {
|
|
41
41
|
"n_jobs": 8,
|
|
42
42
|
},
|
|
43
43
|
"plotting": {
|
|
@@ -53,16 +53,16 @@ terms, _ = flex.load_functional_standard()
|
|
|
53
53
|
for name, dataset in data.items():
|
|
54
54
|
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
55
55
|
flex.pra(name, corr, is_corr=True)
|
|
56
|
-
flex.
|
|
57
|
-
flex.
|
|
56
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
57
|
+
flex.module_contributions(name)
|
|
58
58
|
flex.mpr_prepare(name)
|
|
59
59
|
|
|
60
60
|
flex.plot_precision_recall_curve()
|
|
61
61
|
flex.plot_auc_scores()
|
|
62
|
-
flex.
|
|
63
|
-
flex.
|
|
64
|
-
flex.
|
|
65
|
-
flex.
|
|
62
|
+
flex.plot_significant_modules()
|
|
63
|
+
flex.plot_per_module_scatter(n_top=10)
|
|
64
|
+
flex.plot_per_module_scatter_by_size(n_top=10)
|
|
65
|
+
flex.plot_module_contributions()
|
|
66
66
|
flex.plot_mpr_summary()
|
|
67
67
|
flex.save_results_to_csv()
|
|
68
68
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pFLEX
|
|
2
2
|
|
|
3
|
-
pFLEX is a Python toolkit for evaluating CRISPR screen and co-essentiality networks against biological functional standards such as CORUM
|
|
3
|
+
pFLEX is a Python toolkit for evaluating CRISPR screen and co-essentiality networks against biological functional standards such as CORUM-derived modules, Gene Ontology Biological Processes, and pathways.
|
|
4
4
|
|
|
5
5
|
Use pFLEX to:
|
|
6
6
|
|
|
@@ -56,8 +56,8 @@ Initialize pFLEX once at the start of a run:
|
|
|
56
56
|
```python
|
|
57
57
|
config = {
|
|
58
58
|
"functional_standard": "CORUM",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
59
|
+
"min_genes_in_module": 2,
|
|
60
|
+
"min_genes_per_module_analysis": 2,
|
|
61
61
|
"output_folder": "output",
|
|
62
62
|
"analysis_genes": "shared",
|
|
63
63
|
"jaccard": True,
|
|
@@ -65,7 +65,7 @@ config = {
|
|
|
65
65
|
"fill_na": True,
|
|
66
66
|
},
|
|
67
67
|
"corr_function": "numpy_without_mask",
|
|
68
|
-
"
|
|
68
|
+
"per_module": {
|
|
69
69
|
"n_jobs": 8,
|
|
70
70
|
},
|
|
71
71
|
"plotting": {
|
|
@@ -83,14 +83,14 @@ flex.initialize(config)
|
|
|
83
83
|
Configuration keys:
|
|
84
84
|
|
|
85
85
|
- `functional_standard`: built-in values are `"CORUM"`, `"GOBP"`, and `"PATHWAY"`. You can also provide a custom `.csv` path with a `Genes` column containing semicolon-separated gene symbols.
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
86
|
+
- `min_genes_in_module`: minimum number of genes a functional-standard term must contain before dataset-specific filtering.
|
|
87
|
+
- `min_genes_per_module_analysis`: minimum term size for per-module analysis.
|
|
88
88
|
- `output_folder`: folder where plots and exported CSV files are written.
|
|
89
89
|
- `analysis_genes`: `"shared"` uses only genes common to all loaded datasets; `"dataset_specific"` evaluates each dataset using its own available genes.
|
|
90
90
|
- `jaccard`: when `True`, removes terms with identical used-gene sets after filtering.
|
|
91
91
|
- `preprocessing.fill_na`: when `True`, fills missing values with each gene row's mean.
|
|
92
92
|
- `corr_function`: correlation backend. Use `"numpy_without_mask"` for the fastest run when the matrix has no missing values, `"numpy"` for masked NumPy correlation when missing values may be present, `"numba"` for a compiled missing-value-aware implementation, or `"pandas"` for pandas pairwise-complete correlation that most closely matches R-style missing-value handling. In practice, `"numpy_without_mask"` is fastest but does not handle missing values, `"numpy"` and `"numba"` handle missing values faster than pandas, and `"pandas"` is usually slowest.
|
|
93
|
-
- `
|
|
93
|
+
- `per_module.n_jobs`: worker count for per-module analysis.
|
|
94
94
|
- `plotting.save_plot`: when `True`, saves figures to `output_folder`.
|
|
95
95
|
- `plotting.output_type`: figure extension, such as `"png"` or `"pdf"`.
|
|
96
96
|
- `logging.visible_levels`: log levels to print during the run. Available values are `"STARTED"`, `"PROGRESS"`, `"DONE"`, `"INFO"`, `"WARNING"`, and `"ERROR"`. A quiet run can use `["DONE", "WARNING"]`; a more verbose run can use `["STARTED", "PROGRESS", "DONE", "INFO", "WARNING"]`.
|
|
@@ -114,7 +114,7 @@ terms, _ = flex.load_functional_standard()
|
|
|
114
114
|
|
|
115
115
|
- loads the configured functional standard
|
|
116
116
|
- creates an `all_genes` list for each term
|
|
117
|
-
- applies `
|
|
117
|
+
- applies `min_genes_in_module`
|
|
118
118
|
- stores the term table for later analysis
|
|
119
119
|
- returns the loaded term DataFrame and a placeholder second value
|
|
120
120
|
|
|
@@ -124,8 +124,8 @@ terms, _ = flex.load_functional_standard()
|
|
|
124
124
|
for name, dataset in data.items():
|
|
125
125
|
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
126
126
|
flex.pra(name, corr, is_corr=True)
|
|
127
|
-
flex.
|
|
128
|
-
flex.
|
|
127
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
128
|
+
flex.module_contributions(name)
|
|
129
129
|
flex.mpr_prepare(name)
|
|
130
130
|
```
|
|
131
131
|
|
|
@@ -140,13 +140,13 @@ for name, dataset in data.items():
|
|
|
140
140
|
- returns the pairwise PRA table
|
|
141
141
|
- stores PRA results, AUPRC, and corrected AUPRC in the run cache
|
|
142
142
|
|
|
143
|
-
`
|
|
143
|
+
`pra_per_module(name, matrix, is_corr=True)`:
|
|
144
144
|
|
|
145
145
|
- evaluates precision-recall performance for each functional-standard term
|
|
146
146
|
- returns a term-level result table
|
|
147
|
-
- stores per-
|
|
147
|
+
- stores per-module AUPRC values for plotting and export
|
|
148
148
|
|
|
149
|
-
`
|
|
149
|
+
`module_contributions(name)`:
|
|
150
150
|
|
|
151
151
|
- estimates which terms contribute most to true-positive gene pairs
|
|
152
152
|
- returns a contribution table
|
|
@@ -154,20 +154,25 @@ for name, dataset in data.items():
|
|
|
154
154
|
|
|
155
155
|
`mpr_prepare(name)`:
|
|
156
156
|
|
|
157
|
-
- prepares module-
|
|
158
|
-
- stores
|
|
157
|
+
- prepares the unfiltered module-coverage precision-recall data
|
|
158
|
+
- stores one coverage curve and its mPR AUC score
|
|
159
159
|
- must be run before the mPR plotting functions
|
|
160
|
-
- accepts optional
|
|
160
|
+
- accepts optional `tp_th` and `percent_th` coverage thresholds
|
|
161
|
+
|
|
162
|
+
`mpr_filter(name)` and `globalpr_filter(name)` are optional sensitivity
|
|
163
|
+
analyses. They lazily compute the predefined all-complexes,
|
|
164
|
+
without-mtRibo/ETC-I, and without-small-high-AUPRC comparisons. They are not
|
|
165
|
+
run by `mpr_prepare()`.
|
|
161
166
|
|
|
162
167
|
## Plotting and Export
|
|
163
168
|
|
|
164
169
|
```python
|
|
165
170
|
flex.plot_precision_recall_curve()
|
|
166
171
|
flex.plot_auc_scores()
|
|
167
|
-
flex.
|
|
168
|
-
flex.
|
|
169
|
-
flex.
|
|
170
|
-
flex.
|
|
172
|
+
flex.plot_significant_modules()
|
|
173
|
+
flex.plot_per_module_scatter(n_top=10)
|
|
174
|
+
flex.plot_per_module_scatter_by_size(n_top=10)
|
|
175
|
+
flex.plot_module_contributions()
|
|
171
176
|
flex.plot_mpr_summary()
|
|
172
177
|
flex.save_results_to_csv()
|
|
173
178
|
```
|
|
@@ -179,24 +184,25 @@ Global plots:
|
|
|
179
184
|
- `plot_precision_recall_curve(line_width=2.0, hide_minor_ticks=True)` shows precision against the cumulative number of true-positive gene pairs. This is the main global performance curve; higher precision at the same true-positive count means better ranking.
|
|
180
185
|
- `plot_auc_scores()` shows one bar per dataset using the global AUPRC value saved by `pra()`. Higher AUPRC means the ranked gene-pair network recovers functional-standard pairs earlier in the ranking.
|
|
181
186
|
|
|
182
|
-
Per-
|
|
187
|
+
Per-module plots:
|
|
183
188
|
|
|
184
|
-
- `
|
|
185
|
-
- `
|
|
186
|
-
- `
|
|
187
|
-
- `
|
|
189
|
+
- `plot_significant_modules()` counts how many functional-standard terms pass AUPRC thresholds `0.1`, `0.2`, `0.3`, `0.4`, and `0.5`. It returns the threshold-by-dataset count table, which helps compare how many terms are strongly recovered in each dataset.
|
|
190
|
+
- `plot_per_module_scatter(n_top=10, ...)` compares per-module AUPRC values between pairs of datasets. Each point is one functional-standard term. Points near the diagonal perform similarly in both datasets; points far from the diagonal are terms that are stronger in one dataset.
|
|
191
|
+
- `plot_per_module_scatter_by_size(n_labels=10, n_top=10, ...)` plots each term's per-module AUPRC against the number of genes used for that term. It helps distinguish compact high-performing terms from broader modules.
|
|
192
|
+
- `plot_module_contributions(min_pairs=10, min_precision_cutoff=0.5, num_module_to_show=10, ...)` shows which terms contribute most to true-positive gene pairs across precision cutoffs. It requires `module_contributions(name)` first and helps identify which biological terms drive the global precision-recall curve.
|
|
188
193
|
|
|
189
194
|
mPR preparation and plots:
|
|
190
195
|
|
|
191
|
-
- `mpr_prepare(name,
|
|
192
|
-
- `
|
|
193
|
-
- `
|
|
194
|
-
- `
|
|
195
|
-
-
|
|
196
|
+
- `mpr_prepare(name, tp_th=1, percent_th=0.1)` prepares the single unfiltered module-coverage mPR curve for one dataset.
|
|
197
|
+
- `plot_mpr_module_coverage_curve(dataset_names=None, colors=None, linewidth=1.8, show_markers="auto")` compares unfiltered mPR curves across datasets.
|
|
198
|
+
- `plot_mpr_summary(...)` creates the unfiltered module-coverage plot and the dataset-level mPR AUC plot. It does not create a global PR plot.
|
|
199
|
+
- `mpr_filter(name, size_th=30, auprc_th=0.4, ...)` lazily computes the three predefined module-coverage filter variants. `plot_mpr_filter()` plots them and returns the variant AUC table alongside the axes.
|
|
200
|
+
- `globalpr_filter(name, size_th=30, auprc_th=0.4, ...)` lazily computes the matching global PR variants. `plot_globalpr_filter()` plots them.
|
|
201
|
+
- Filter plotting functions never start calculations automatically; run the matching calculation once for every selected dataset first.
|
|
196
202
|
|
|
197
203
|
Export:
|
|
198
204
|
|
|
199
|
-
- `save_results_to_csv()` exports cached tables such as global AUPRC values, per-
|
|
205
|
+
- `save_results_to_csv()` exports cached tables such as global AUPRC values, per-module results, contribution tables, and mPR summaries to `output_folder/csv`.
|
|
200
206
|
- Plot files are saved directly under `output_folder` when `plotting.save_plot` or the function-level `save` argument is enabled.
|
|
201
207
|
|
|
202
208
|
## Temporary Files
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pflex"
|
|
3
|
-
version = "1.
|
|
4
|
-
description = "pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological functional standards. The toolkit computes gene-level and
|
|
3
|
+
version = "1.3"
|
|
4
|
+
description = "pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological functional standards. The toolkit computes gene-level and module-level performance metrics, helping researchers systematically assess the biological relevance and resolution of their CRISPR screening data."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
7
7
|
{ name = "Yasir Demirtas", email = "tyasird@hotmail.com" }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from .logging_config import log
|
|
2
2
|
from .utils import dsave, dload
|
|
3
3
|
from .preprocessing import example_input_path, get_example_data_path, load_datasets, get_common_genes, filter_matrix_by_genes, load_functional_standard, filter_duplicate_terms
|
|
4
|
-
from .analysis import initialize, prepare_terms_for_dataset, pra,
|
|
4
|
+
from .analysis import initialize, prepare_terms_for_dataset, pra, pra_per_module, fast_corr, perform_corr, is_symmetric, binary, has_mirror_of_first_pair, convert_full_to_half_matrix, drop_mirror_pairs, quick_sort, module_contributions, save_results_to_csv, update_matploblib_config, mpr_prepare, mpr_filter, globalpr_filter
|
|
5
5
|
from .plotting import (
|
|
6
|
-
adjust_text_positions, plot_precision_recall_curve, plot_aggregated_pra, plot_iqr_pra, plot_all_runs_pra,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
adjust_text_positions, plot_precision_recall_curve, plot_aggregated_pra, plot_iqr_pra, plot_all_runs_pra, plot_per_module_scatter,
|
|
7
|
+
plot_per_module_scatter_by_size, plot_module_contributions, plot_significant_modules, plot_auc_scores,
|
|
8
|
+
plot_mpr_module_coverage_curve, plot_mpr_module_auc_scores, plot_mpr_summary,
|
|
9
|
+
plot_mpr_filter, plot_globalpr_filter
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
def main():
|
|
@@ -32,13 +32,12 @@ def main():
|
|
|
32
32
|
|
|
33
33
|
__all__ = [ "log", "example_input_path", "get_example_data_path", "fast_corr",
|
|
34
34
|
"initialize", "dsave", "dload", "load_datasets", "get_common_genes",
|
|
35
|
-
"filter_matrix_by_genes", "load_functional_standard", "filter_duplicate_terms", "pra", "
|
|
35
|
+
"filter_matrix_by_genes", "load_functional_standard", "filter_duplicate_terms", "pra", "pra_per_module",
|
|
36
36
|
"prepare_terms_for_dataset",
|
|
37
37
|
"perform_corr", "is_symmetric", "binary", "has_mirror_of_first_pair", "convert_full_to_half_matrix",
|
|
38
|
-
"drop_mirror_pairs", "quick_sort", "
|
|
39
|
-
"plot_aggregated_pra", "plot_iqr_pra", "plot_all_runs_pra", "
|
|
40
|
-
"
|
|
41
|
-
"mpr_prepare", "
|
|
42
|
-
"
|
|
43
|
-
"plot_mpr_complex_coverage_curve", "plot_mpr_summary", "main"
|
|
38
|
+
"drop_mirror_pairs", "quick_sort", "module_contributions", "adjust_text_positions", "plot_precision_recall_curve",
|
|
39
|
+
"plot_aggregated_pra", "plot_iqr_pra", "plot_all_runs_pra", "plot_per_module_scatter", "plot_per_module_scatter_by_size", "plot_module_contributions",
|
|
40
|
+
"plot_significant_modules", "plot_auc_scores", "plot_mpr_module_auc_scores", "save_results_to_csv", "update_matploblib_config",
|
|
41
|
+
"mpr_prepare", "mpr_filter", "globalpr_filter", "plot_mpr_filter", "plot_globalpr_filter",
|
|
42
|
+
"plot_mpr_module_coverage_curve", "plot_mpr_summary", "main"
|
|
44
43
|
]
|