pflex 1.4__tar.gz → 1.4.2__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.4 → pflex-1.4.2}/.python-version +1 -1
- {pflex-1.4 → pflex-1.4.2}/PKG-INFO +1 -1
- {pflex-1.4 → pflex-1.4.2}/README.md +229 -229
- {pflex-1.4 → pflex-1.4.2}/docs/getting-started.md +70 -70
- {pflex-1.4 → pflex-1.4.2}/docs/user-guide.md +228 -228
- {pflex-1.4 → pflex-1.4.2}/pyproject.toml +1 -1
- {pflex-1.4 → pflex-1.4.2}/src/pflex/__init__.py +43 -43
- {pflex-1.4 → pflex-1.4.2}/src/pflex/analysis.py +3 -1
- {pflex-1.4 → pflex-1.4.2}/src/pflex/examples/basic_usage.py +89 -89
- {pflex-1.4 → pflex-1.4.2}/src/pflex/logging_config.py +2 -2
- {pflex-1.4 → pflex-1.4.2}/src/pflex/plotting.py +1739 -1718
- {pflex-1.4 → pflex-1.4.2}/src/pflex/style.py +37 -37
- {pflex-1.4 → pflex-1.4.2}/uv.lock +1 -1
- {pflex-1.4 → pflex-1.4.2}/.gitignore +0 -0
- {pflex-1.4 → pflex-1.4.2}/LICENSE +0 -0
- {pflex-1.4 → pflex-1.4.2}/docs/index.md +0 -0
- {pflex-1.4 → pflex-1.4.2}/docs/installation.md +0 -0
- {pflex-1.4 → pflex-1.4.2}/mkdocs.yml +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/__init__.py +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/example_input/__init__.py +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/example_input/skin_cell_lines_corum_genes.parquet +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/example_input/soft_tissue_cell_lines_corum_genes.parquet +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/CORUM.parquet +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/GOBP.parquet +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/PATHWAY.parquet +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/__init__.py +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/corum.csv +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/gobp.csv +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/data/functional_standard/pathway.csv +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/preprocessing.py +0 -0
- {pflex-1.4 → pflex-1.4.2}/src/pflex/utils.py +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
3.12
|
|
1
|
+
3.12
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pflex
|
|
3
|
-
Version: 1.4
|
|
3
|
+
Version: 1.4.2
|
|
4
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
|
|
@@ -1,229 +1,229 @@
|
|
|
1
|
-
# pFLEX
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-

|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
**Abstract**
|
|
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 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
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Features
|
|
18
|
-
|
|
19
|
-
- Precision-recall curve generation for ranked gene lists
|
|
20
|
-
- Evaluation using CORUM-derived modules, GO terms, and pathways
|
|
21
|
-
- Module-level resolution analysis and visualization
|
|
22
|
-
- Easy integration into CRISPR screen workflows
|
|
23
|
-
- Packaged DepMap example inputs filtered to CORUM genes
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
pFLEX is developed and tested with Python 3.10. We recommend installing it in a dedicated Python 3.10 environment to keep the package and its scientific Python dependencies separate from other projects.
|
|
30
|
-
|
|
31
|
-
Create `venv`:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
conda create -n p310 python=3.10
|
|
35
|
-
conda activate p310
|
|
36
|
-
pip install uv
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Install pFLEX via pip:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
uv pip install pflex
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
or:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pip install pflex
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
or install pFLEX via git to develop the package locally:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
git clone https://github.com/tyasird/pFLEX.git
|
|
55
|
-
cd pFLEX
|
|
56
|
-
uv pip install -e .
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Usage
|
|
62
|
-
|
|
63
|
-
Full documentation is available at [https://tyasird.github.io/pFLEX/](https://tyasird.github.io/pFLEX/).
|
|
64
|
-
|
|
65
|
-
### Input Data
|
|
66
|
-
|
|
67
|
-
pFLEX expects each input dataset as a matrix with genes in rows and screens, samples, or cell lines in columns.
|
|
68
|
-
|
|
69
|
-
| Gene | ACH-000014 | ACH-000219 | ACH-000274 |
|
|
70
|
-
| --- | ---: | ---: | ---: |
|
|
71
|
-
| A2M | -0.125 | -0.215 | 0.065 |
|
|
72
|
-
| AATF | 0.042 | -0.088 | -0.016 |
|
|
73
|
-
| BCL6 | -0.019 | 0.112 | -0.074 |
|
|
74
|
-
|
|
75
|
-
CSV, Excel, and Parquet files are supported. Parquet is recommended for larger matrices.
|
|
76
|
-
|
|
77
|
-
The packaged example inputs are real DepMap 25Q2 tissue subsets filtered to genes present in CORUM:
|
|
78
|
-
|
|
79
|
-
- `skin_cell_lines_corum_genes.parquet`: 3,465 genes x 75 cell lines
|
|
80
|
-
- `soft_tissue_cell_lines_corum_genes.parquet`: 3,465 genes x 46 cell lines
|
|
81
|
-
|
|
82
|
-
Use `flex.example_input_path()` to resolve packaged example inputs:
|
|
83
|
-
|
|
84
|
-
```python
|
|
85
|
-
import pflex as flex
|
|
86
|
-
|
|
87
|
-
inputs = {
|
|
88
|
-
"Skin": {
|
|
89
|
-
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
90
|
-
"sort": "high",
|
|
91
|
-
"color": "#4E79A7",
|
|
92
|
-
},
|
|
93
|
-
"Soft Tissue": {
|
|
94
|
-
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
95
|
-
"sort": "high",
|
|
96
|
-
"color": "#F28E2B",
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Configuration
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
config = {
|
|
105
|
-
"functional_standard": "CORUM",
|
|
106
|
-
"min_genes_in_module": 2,
|
|
107
|
-
"min_genes_per_module_analysis": 2,
|
|
108
|
-
"output_folder": "output",
|
|
109
|
-
"analysis_genes": "shared",
|
|
110
|
-
"jaccard": True,
|
|
111
|
-
"preprocessing": {
|
|
112
|
-
"fill_na": True,
|
|
113
|
-
},
|
|
114
|
-
"corr_function": "numpy_without_mask",
|
|
115
|
-
"per_module": {
|
|
116
|
-
"n_jobs": 8,
|
|
117
|
-
},
|
|
118
|
-
"plotting": {
|
|
119
|
-
"save_plot": True,
|
|
120
|
-
"output_type": "pdf",
|
|
121
|
-
},
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Common choices:
|
|
126
|
-
|
|
127
|
-
- `functional_standard`: `"CORUM"`, `"GOBP"`, `"PATHWAY"`, or a custom `.csv` path
|
|
128
|
-
- `analysis_genes`: `"shared"` or `"dataset_specific"`
|
|
129
|
-
- `sort`: `"high"` or `"low"` per input dataset
|
|
130
|
-
- `preprocessing.fill_na`: fill missing values with gene means
|
|
131
|
-
- `corr_function`: `"numpy"`, `"numpy_without_mask"`, `"numba"`, or `"pandas"`
|
|
132
|
-
- `per_module.n_jobs`: worker count for per-module analysis
|
|
133
|
-
|
|
134
|
-
### Analysis Flow
|
|
135
|
-
|
|
136
|
-
```python
|
|
137
|
-
flex.initialize(config)
|
|
138
|
-
data, common_genes = flex.load_datasets(inputs)
|
|
139
|
-
terms, _ = flex.load_functional_standard()
|
|
140
|
-
|
|
141
|
-
for name, dataset in data.items():
|
|
142
|
-
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
143
|
-
flex.pra(name, corr, is_corr=True)
|
|
144
|
-
flex.pra_per_module(name, corr, is_corr=True)
|
|
145
|
-
flex.module_contributions(name)
|
|
146
|
-
flex.mpr_prepare(name)
|
|
147
|
-
|
|
148
|
-
flex.plot_precision_recall_curve()
|
|
149
|
-
flex.plot_auc_scores()
|
|
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
|
-
flex.plot_mpr_summary()
|
|
155
|
-
flex.save_results_to_csv()
|
|
156
|
-
```
|
|
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
|
-
|
|
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.
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Quickstart
|
|
184
|
-
|
|
185
|
-
```python
|
|
186
|
-
import pflex as flex
|
|
187
|
-
|
|
188
|
-
inputs = {
|
|
189
|
-
"Skin": {
|
|
190
|
-
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
191
|
-
"sort": "high",
|
|
192
|
-
"color": "#4E79A7",
|
|
193
|
-
},
|
|
194
|
-
"Soft Tissue": {
|
|
195
|
-
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
196
|
-
"sort": "high",
|
|
197
|
-
"color": "#F28E2B",
|
|
198
|
-
},
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
config = {
|
|
202
|
-
"functional_standard": "CORUM",
|
|
203
|
-
"output_folder": "output",
|
|
204
|
-
"analysis_genes": "shared",
|
|
205
|
-
"jaccard": True,
|
|
206
|
-
"preprocessing": {
|
|
207
|
-
"fill_na": True,
|
|
208
|
-
},
|
|
209
|
-
"corr_function": "numpy_without_mask",
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
flex.initialize(config)
|
|
213
|
-
data, _ = flex.load_datasets(inputs)
|
|
214
|
-
|
|
215
|
-
for name, dataset in data.items():
|
|
216
|
-
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
217
|
-
flex.pra(name, corr, is_corr=True)
|
|
218
|
-
|
|
219
|
-
flex.plot_precision_recall_curve()
|
|
220
|
-
flex.plot_auc_scores()
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
For a runnable full workflow, see [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py).
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
## License
|
|
228
|
-
|
|
229
|
-
MIT
|
|
1
|
+
# pFLEX
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
**Abstract**
|
|
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 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
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Precision-recall curve generation for ranked gene lists
|
|
20
|
+
- Evaluation using CORUM-derived modules, GO terms, and pathways
|
|
21
|
+
- Module-level resolution analysis and visualization
|
|
22
|
+
- Easy integration into CRISPR screen workflows
|
|
23
|
+
- Packaged DepMap example inputs filtered to CORUM genes
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
pFLEX is developed and tested with Python 3.10. We recommend installing it in a dedicated Python 3.10 environment to keep the package and its scientific Python dependencies separate from other projects.
|
|
30
|
+
|
|
31
|
+
Create `venv`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
conda create -n p310 python=3.10
|
|
35
|
+
conda activate p310
|
|
36
|
+
pip install uv
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Install pFLEX via pip:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv pip install pflex
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
or:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install pflex
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
or install pFLEX via git to develop the package locally:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/tyasird/pFLEX.git
|
|
55
|
+
cd pFLEX
|
|
56
|
+
uv pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
Full documentation is available at [https://tyasird.github.io/pFLEX/](https://tyasird.github.io/pFLEX/).
|
|
64
|
+
|
|
65
|
+
### Input Data
|
|
66
|
+
|
|
67
|
+
pFLEX expects each input dataset as a matrix with genes in rows and screens, samples, or cell lines in columns.
|
|
68
|
+
|
|
69
|
+
| Gene | ACH-000014 | ACH-000219 | ACH-000274 |
|
|
70
|
+
| --- | ---: | ---: | ---: |
|
|
71
|
+
| A2M | -0.125 | -0.215 | 0.065 |
|
|
72
|
+
| AATF | 0.042 | -0.088 | -0.016 |
|
|
73
|
+
| BCL6 | -0.019 | 0.112 | -0.074 |
|
|
74
|
+
|
|
75
|
+
CSV, Excel, and Parquet files are supported. Parquet is recommended for larger matrices.
|
|
76
|
+
|
|
77
|
+
The packaged example inputs are real DepMap 25Q2 tissue subsets filtered to genes present in CORUM:
|
|
78
|
+
|
|
79
|
+
- `skin_cell_lines_corum_genes.parquet`: 3,465 genes x 75 cell lines
|
|
80
|
+
- `soft_tissue_cell_lines_corum_genes.parquet`: 3,465 genes x 46 cell lines
|
|
81
|
+
|
|
82
|
+
Use `flex.example_input_path()` to resolve packaged example inputs:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import pflex as flex
|
|
86
|
+
|
|
87
|
+
inputs = {
|
|
88
|
+
"Skin": {
|
|
89
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
90
|
+
"sort": "high",
|
|
91
|
+
"color": "#4E79A7",
|
|
92
|
+
},
|
|
93
|
+
"Soft Tissue": {
|
|
94
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
95
|
+
"sort": "high",
|
|
96
|
+
"color": "#F28E2B",
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Configuration
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
config = {
|
|
105
|
+
"functional_standard": "CORUM",
|
|
106
|
+
"min_genes_in_module": 2,
|
|
107
|
+
"min_genes_per_module_analysis": 2,
|
|
108
|
+
"output_folder": "output",
|
|
109
|
+
"analysis_genes": "shared",
|
|
110
|
+
"jaccard": True,
|
|
111
|
+
"preprocessing": {
|
|
112
|
+
"fill_na": True,
|
|
113
|
+
},
|
|
114
|
+
"corr_function": "numpy_without_mask",
|
|
115
|
+
"per_module": {
|
|
116
|
+
"n_jobs": 8,
|
|
117
|
+
},
|
|
118
|
+
"plotting": {
|
|
119
|
+
"save_plot": True,
|
|
120
|
+
"output_type": "pdf",
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Common choices:
|
|
126
|
+
|
|
127
|
+
- `functional_standard`: `"CORUM"`, `"GOBP"`, `"PATHWAY"`, or a custom `.csv` path
|
|
128
|
+
- `analysis_genes`: `"shared"` or `"dataset_specific"`
|
|
129
|
+
- `sort`: `"high"` or `"low"` per input dataset
|
|
130
|
+
- `preprocessing.fill_na`: fill missing values with gene means
|
|
131
|
+
- `corr_function`: `"numpy"`, `"numpy_without_mask"`, `"numba"`, or `"pandas"`
|
|
132
|
+
- `per_module.n_jobs`: worker count for per-module analysis
|
|
133
|
+
|
|
134
|
+
### Analysis Flow
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
flex.initialize(config)
|
|
138
|
+
data, common_genes = flex.load_datasets(inputs)
|
|
139
|
+
terms, _ = flex.load_functional_standard()
|
|
140
|
+
|
|
141
|
+
for name, dataset in data.items():
|
|
142
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
143
|
+
flex.pra(name, corr, is_corr=True)
|
|
144
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
145
|
+
flex.module_contributions(name)
|
|
146
|
+
flex.mpr_prepare(name)
|
|
147
|
+
|
|
148
|
+
flex.plot_precision_recall_curve()
|
|
149
|
+
flex.plot_auc_scores()
|
|
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
|
+
flex.plot_mpr_summary()
|
|
155
|
+
flex.save_results_to_csv()
|
|
156
|
+
```
|
|
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
|
+
|
|
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.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Quickstart
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
import pflex as flex
|
|
187
|
+
|
|
188
|
+
inputs = {
|
|
189
|
+
"Skin": {
|
|
190
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
191
|
+
"sort": "high",
|
|
192
|
+
"color": "#4E79A7",
|
|
193
|
+
},
|
|
194
|
+
"Soft Tissue": {
|
|
195
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
196
|
+
"sort": "high",
|
|
197
|
+
"color": "#F28E2B",
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
config = {
|
|
202
|
+
"functional_standard": "CORUM",
|
|
203
|
+
"output_folder": "output",
|
|
204
|
+
"analysis_genes": "shared",
|
|
205
|
+
"jaccard": True,
|
|
206
|
+
"preprocessing": {
|
|
207
|
+
"fill_na": True,
|
|
208
|
+
},
|
|
209
|
+
"corr_function": "numpy_without_mask",
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
flex.initialize(config)
|
|
213
|
+
data, _ = flex.load_datasets(inputs)
|
|
214
|
+
|
|
215
|
+
for name, dataset in data.items():
|
|
216
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
217
|
+
flex.pra(name, corr, is_corr=True)
|
|
218
|
+
|
|
219
|
+
flex.plot_precision_recall_curve()
|
|
220
|
+
flex.plot_auc_scores()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
For a runnable full workflow, see [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py).
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
MIT
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# Getting Started
|
|
2
|
-
|
|
3
|
-
## Run an Example
|
|
4
|
-
|
|
5
|
-
!!! info "Example data"
|
|
6
|
-
These files are included only to demonstrate how the script and pFLEX functions work. They are not required dependencies for using the package with your own data. Instead of shipping artificial dummy matrices, pFLEX provides small real DepMap 25Q2 tissue subsets. The matrices are filtered to CORUM genes so the examples stay biologically meaningful while keeping the package size reasonable.
|
|
7
|
-
|
|
8
|
-
pFLEX includes two real DepMap 25Q2 example inputs filtered to genes present in CORUM:
|
|
9
|
-
|
|
10
|
-
- `skin_cell_lines_corum_genes.parquet`: 3,465 genes x 75 cell lines
|
|
11
|
-
- `soft_tissue_cell_lines_corum_genes.parquet`: 3,465 genes x 46 cell lines
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
import pflex as flex
|
|
15
|
-
|
|
16
|
-
inputs = {
|
|
17
|
-
"Skin": {
|
|
18
|
-
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
19
|
-
"sort": "high",
|
|
20
|
-
"color": "#4E79A7",
|
|
21
|
-
},
|
|
22
|
-
"Soft Tissue": {
|
|
23
|
-
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
24
|
-
"sort": "high",
|
|
25
|
-
"color": "#F28E2B",
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
config = {
|
|
30
|
-
"functional_standard": "CORUM",
|
|
31
|
-
"min_genes_in_module": 2,
|
|
32
|
-
"min_genes_per_module_analysis": 2,
|
|
33
|
-
"output_folder": "output",
|
|
34
|
-
"analysis_genes": "shared",
|
|
35
|
-
"jaccard": True,
|
|
36
|
-
"preprocessing": {
|
|
37
|
-
"fill_na": True,
|
|
38
|
-
},
|
|
39
|
-
"corr_function": "numpy_without_mask",
|
|
40
|
-
"per_module": {
|
|
41
|
-
"n_jobs": 8,
|
|
42
|
-
},
|
|
43
|
-
"plotting": {
|
|
44
|
-
"save_plot": True,
|
|
45
|
-
"output_type": "pdf",
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
flex.initialize(config)
|
|
50
|
-
data, common_genes = flex.load_datasets(inputs)
|
|
51
|
-
terms, _ = flex.load_functional_standard()
|
|
52
|
-
|
|
53
|
-
for name, dataset in data.items():
|
|
54
|
-
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
55
|
-
flex.pra(name, corr, is_corr=True)
|
|
56
|
-
flex.pra_per_module(name, corr, is_corr=True)
|
|
57
|
-
flex.module_contributions(name)
|
|
58
|
-
flex.mpr_prepare(name)
|
|
59
|
-
|
|
60
|
-
flex.plot_precision_recall_curve()
|
|
61
|
-
flex.plot_auc_scores()
|
|
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
|
-
flex.plot_mpr_summary()
|
|
67
|
-
flex.save_results_to_csv()
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The same workflow is available in `src/pflex/examples/basic_usage.py`.
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
## Run an Example
|
|
4
|
+
|
|
5
|
+
!!! info "Example data"
|
|
6
|
+
These files are included only to demonstrate how the script and pFLEX functions work. They are not required dependencies for using the package with your own data. Instead of shipping artificial dummy matrices, pFLEX provides small real DepMap 25Q2 tissue subsets. The matrices are filtered to CORUM genes so the examples stay biologically meaningful while keeping the package size reasonable.
|
|
7
|
+
|
|
8
|
+
pFLEX includes two real DepMap 25Q2 example inputs filtered to genes present in CORUM:
|
|
9
|
+
|
|
10
|
+
- `skin_cell_lines_corum_genes.parquet`: 3,465 genes x 75 cell lines
|
|
11
|
+
- `soft_tissue_cell_lines_corum_genes.parquet`: 3,465 genes x 46 cell lines
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import pflex as flex
|
|
15
|
+
|
|
16
|
+
inputs = {
|
|
17
|
+
"Skin": {
|
|
18
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
19
|
+
"sort": "high",
|
|
20
|
+
"color": "#4E79A7",
|
|
21
|
+
},
|
|
22
|
+
"Soft Tissue": {
|
|
23
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
24
|
+
"sort": "high",
|
|
25
|
+
"color": "#F28E2B",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
config = {
|
|
30
|
+
"functional_standard": "CORUM",
|
|
31
|
+
"min_genes_in_module": 2,
|
|
32
|
+
"min_genes_per_module_analysis": 2,
|
|
33
|
+
"output_folder": "output",
|
|
34
|
+
"analysis_genes": "shared",
|
|
35
|
+
"jaccard": True,
|
|
36
|
+
"preprocessing": {
|
|
37
|
+
"fill_na": True,
|
|
38
|
+
},
|
|
39
|
+
"corr_function": "numpy_without_mask",
|
|
40
|
+
"per_module": {
|
|
41
|
+
"n_jobs": 8,
|
|
42
|
+
},
|
|
43
|
+
"plotting": {
|
|
44
|
+
"save_plot": True,
|
|
45
|
+
"output_type": "pdf",
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
flex.initialize(config)
|
|
50
|
+
data, common_genes = flex.load_datasets(inputs)
|
|
51
|
+
terms, _ = flex.load_functional_standard()
|
|
52
|
+
|
|
53
|
+
for name, dataset in data.items():
|
|
54
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
55
|
+
flex.pra(name, corr, is_corr=True)
|
|
56
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
57
|
+
flex.module_contributions(name)
|
|
58
|
+
flex.mpr_prepare(name)
|
|
59
|
+
|
|
60
|
+
flex.plot_precision_recall_curve()
|
|
61
|
+
flex.plot_auc_scores()
|
|
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
|
+
flex.plot_mpr_summary()
|
|
67
|
+
flex.save_results_to_csv()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The same workflow is available in `src/pflex/examples/basic_usage.py`.
|