pflex 1.0__tar.gz → 1.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.0 → pflex-1.2}/.gitignore +19 -6
- pflex-1.2/PKG-INFO +239 -0
- pflex-1.2/README.md +208 -0
- pflex-1.2/docs/getting-started.md +70 -0
- pflex-1.2/docs/index.md +11 -0
- pflex-1.2/docs/installation.md +31 -0
- pflex-1.2/docs/user-guide.md +204 -0
- pflex-1.2/mkdocs.yml +28 -0
- {pflex-1.0 → pflex-1.2}/pyproject.toml +97 -77
- pflex-1.2/src/pflex/__init__.py +44 -0
- {pflex-1.0 → pflex-1.2}/src/pflex/analysis.py +154 -143
- pflex-1.2/src/pflex/data/example_input/skin_cell_lines_corum_genes.parquet +0 -0
- pflex-1.2/src/pflex/data/example_input/soft_tissue_cell_lines_corum_genes.parquet +0 -0
- pflex-1.2/src/pflex/examples/basic_usage.py +79 -0
- {pflex-1.0 → pflex-1.2}/src/pflex/plotting.py +156 -154
- {pflex-1.0 → pflex-1.2}/src/pflex/preprocessing.py +38 -31
- {pflex-1.0 → pflex-1.2}/uv.lock +1960 -2009
- pflex-1.0/PKG-INFO +0 -167
- pflex-1.0/README.md +0 -135
- pflex-1.0/src/pflex/__init__.py +0 -44
- pflex-1.0/src/pflex/data/dataset/liver_cell_lines_500_genes.csv +0 -501
- pflex-1.0/src/pflex/data/dataset/melanoma_cell_lines_500_genes.csv +0 -501
- pflex-1.0/src/pflex/data/dataset/neuroblastoma_cell_lines_500_genes.csv +0 -501
- pflex-1.0/src/pflex/examples/basic_usage.py +0 -95
- pflex-1.0/src/pflex/old_functions.py +0 -422
- {pflex-1.0 → pflex-1.2}/.python-version +0 -0
- {pflex-1.0 → pflex-1.2}/LICENSE +0 -0
- {pflex-1.0 → pflex-1.2}/src/pflex/data/__init__.py +0 -0
- {pflex-1.0/src/pflex/data/dataset → pflex-1.2/src/pflex/data/example_input}/__init__.py +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/CORUM.parquet +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/GOBP.parquet +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/PATHWAY.parquet +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/__init__.py +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/corum.csv +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/gobp.csv +0 -0
- {pflex-1.0/src/pflex/data/gold_standard → pflex-1.2/src/pflex/data/functional_standard}/pathway.csv +0 -0
- {pflex-1.0 → pflex-1.2}/src/pflex/logging_config.py +0 -0
- {pflex-1.0 → pflex-1.2}/src/pflex/utils.py +0 -0
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
# Python-generated files
|
|
2
2
|
__pycache__/
|
|
3
3
|
*.py[oc]
|
|
4
|
+
.tmp/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.ruff_cache/
|
|
7
|
+
.mypy_cache/
|
|
8
|
+
.ipynb_checkpoints/
|
|
4
9
|
build/
|
|
5
10
|
dist/
|
|
11
|
+
site/
|
|
6
12
|
wheels/
|
|
7
13
|
*.egg-info
|
|
14
|
+
tmp/
|
|
15
|
+
temp/
|
|
8
16
|
|
|
9
17
|
|
|
10
18
|
bfg-*.jar
|
|
11
19
|
|
|
12
20
|
# Virtual environments
|
|
13
21
|
.venv
|
|
22
|
+
.env
|
|
23
|
+
.env.*
|
|
14
24
|
**/result.pkl
|
|
15
|
-
examples/output/
|
|
16
|
-
|
|
17
|
-
src/pflex/output/
|
|
18
|
-
src/pflex/
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
examples/output/
|
|
26
|
+
output_test/
|
|
27
|
+
src/pflex/examples/output/
|
|
28
|
+
src/pflex/examples/output_test/
|
|
29
|
+
src/pflex/examples/.tmp/
|
|
30
|
+
src/pflex/output/
|
|
31
|
+
src/pflex/input/
|
|
32
|
+
.aider*
|
|
33
|
+
.vscode
|
pflex-1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pflex
|
|
3
|
+
Version: 1.2
|
|
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
|
+
Author-email: Yasir Demirtas <tyasird@hotmail.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: adjusttext
|
|
14
|
+
Requires-Dist: art
|
|
15
|
+
Requires-Dist: bitarray
|
|
16
|
+
Requires-Dist: emoji
|
|
17
|
+
Requires-Dist: importlib-resources
|
|
18
|
+
Requires-Dist: ipython
|
|
19
|
+
Requires-Dist: joblib
|
|
20
|
+
Requires-Dist: loguru
|
|
21
|
+
Requires-Dist: matplotlib
|
|
22
|
+
Requires-Dist: numba
|
|
23
|
+
Requires-Dist: numpy
|
|
24
|
+
Requires-Dist: pandas
|
|
25
|
+
Requires-Dist: pyarrow
|
|
26
|
+
Requires-Dist: python-slugify
|
|
27
|
+
Requires-Dist: scikit-learn
|
|
28
|
+
Requires-Dist: scipy
|
|
29
|
+
Requires-Dist: tqdm
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# pFLEX
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+

|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
**Abstract**
|
|
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 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
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Precision-recall curve generation for ranked gene lists
|
|
51
|
+
- Evaluation using CORUM-derived modules, GO terms, and pathways
|
|
52
|
+
- Module-level resolution analysis and visualization
|
|
53
|
+
- Easy integration into CRISPR screen workflows
|
|
54
|
+
- Packaged DepMap example inputs filtered to CORUM genes
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
Create `venv`:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
conda create -n p310 python=3.10
|
|
66
|
+
conda activate p310
|
|
67
|
+
pip install uv
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Install pFLEX via pip:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uv pip install pflex
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
or:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install pflex
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
or install pFLEX via git to develop the package locally:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/tyasird/pFLEX.git
|
|
86
|
+
cd pFLEX
|
|
87
|
+
uv pip install -e .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
Full documentation is available at [https://tyasird.github.io/pFLEX/](https://tyasird.github.io/pFLEX/).
|
|
95
|
+
|
|
96
|
+
### Input Data
|
|
97
|
+
|
|
98
|
+
pFLEX expects each input dataset as a matrix with genes in rows and screens, samples, or cell lines in columns.
|
|
99
|
+
|
|
100
|
+
| Gene | ACH-000014 | ACH-000219 | ACH-000274 |
|
|
101
|
+
| --- | ---: | ---: | ---: |
|
|
102
|
+
| A2M | -0.125 | -0.215 | 0.065 |
|
|
103
|
+
| AATF | 0.042 | -0.088 | -0.016 |
|
|
104
|
+
| BCL6 | -0.019 | 0.112 | -0.074 |
|
|
105
|
+
|
|
106
|
+
CSV, Excel, and Parquet files are supported. Parquet is recommended for larger matrices.
|
|
107
|
+
|
|
108
|
+
The packaged example inputs are real DepMap 25Q2 tissue subsets filtered to genes present in CORUM:
|
|
109
|
+
|
|
110
|
+
- `skin_cell_lines_corum_genes.parquet`: 3,465 genes x 75 cell lines
|
|
111
|
+
- `soft_tissue_cell_lines_corum_genes.parquet`: 3,465 genes x 46 cell lines
|
|
112
|
+
|
|
113
|
+
Use `flex.example_input_path()` to resolve packaged example inputs:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import pflex as flex
|
|
117
|
+
|
|
118
|
+
inputs = {
|
|
119
|
+
"Skin": {
|
|
120
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
121
|
+
"sort": "high",
|
|
122
|
+
"color": "#4E79A7",
|
|
123
|
+
},
|
|
124
|
+
"Soft Tissue": {
|
|
125
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
126
|
+
"sort": "high",
|
|
127
|
+
"color": "#F28E2B",
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Configuration
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
config = {
|
|
136
|
+
"functional_standard": "CORUM",
|
|
137
|
+
"min_genes_in_module": 2,
|
|
138
|
+
"min_genes_per_module_analysis": 2,
|
|
139
|
+
"output_folder": "output",
|
|
140
|
+
"analysis_genes": "shared",
|
|
141
|
+
"jaccard": True,
|
|
142
|
+
"preprocessing": {
|
|
143
|
+
"fill_na": True,
|
|
144
|
+
},
|
|
145
|
+
"corr_function": "numpy_without_mask",
|
|
146
|
+
"per_module": {
|
|
147
|
+
"n_jobs": 8,
|
|
148
|
+
},
|
|
149
|
+
"plotting": {
|
|
150
|
+
"save_plot": True,
|
|
151
|
+
"output_type": "png",
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Common choices:
|
|
157
|
+
|
|
158
|
+
- `functional_standard`: `"CORUM"`, `"GOBP"`, `"PATHWAY"`, or a custom `.csv` path
|
|
159
|
+
- `analysis_genes`: `"shared"` or `"dataset_specific"`
|
|
160
|
+
- `sort`: `"high"` or `"low"` per input dataset
|
|
161
|
+
- `preprocessing.fill_na`: fill missing values with gene means
|
|
162
|
+
- `corr_function`: `"numpy"`, `"numpy_without_mask"`, `"numba"`, or `"pandas"`
|
|
163
|
+
- `per_module.n_jobs`: worker count for per-module analysis
|
|
164
|
+
|
|
165
|
+
### Analysis Flow
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
flex.initialize(config)
|
|
169
|
+
data, common_genes = flex.load_datasets(inputs)
|
|
170
|
+
terms, _ = flex.load_functional_standard()
|
|
171
|
+
|
|
172
|
+
for name, dataset in data.items():
|
|
173
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
174
|
+
flex.pra(name, corr, is_corr=True)
|
|
175
|
+
flex.pra_per_module(name, corr, is_corr=True)
|
|
176
|
+
flex.module_contributions(name)
|
|
177
|
+
flex.mpr_prepare(name)
|
|
178
|
+
|
|
179
|
+
flex.plot_precision_recall_curve()
|
|
180
|
+
flex.plot_auc_scores()
|
|
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
|
+
flex.plot_mpr_summary()
|
|
186
|
+
flex.save_results_to_csv()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
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
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Quickstart
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
import pflex as flex
|
|
197
|
+
|
|
198
|
+
inputs = {
|
|
199
|
+
"Skin": {
|
|
200
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
201
|
+
"sort": "high",
|
|
202
|
+
"color": "#4E79A7",
|
|
203
|
+
},
|
|
204
|
+
"Soft Tissue": {
|
|
205
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
206
|
+
"sort": "high",
|
|
207
|
+
"color": "#F28E2B",
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
config = {
|
|
212
|
+
"functional_standard": "CORUM",
|
|
213
|
+
"output_folder": "output",
|
|
214
|
+
"analysis_genes": "shared",
|
|
215
|
+
"jaccard": True,
|
|
216
|
+
"preprocessing": {
|
|
217
|
+
"fill_na": True,
|
|
218
|
+
},
|
|
219
|
+
"corr_function": "numpy_without_mask",
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
flex.initialize(config)
|
|
223
|
+
data, _ = flex.load_datasets(inputs)
|
|
224
|
+
|
|
225
|
+
for name, dataset in data.items():
|
|
226
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
227
|
+
flex.pra(name, corr, is_corr=True)
|
|
228
|
+
|
|
229
|
+
flex.plot_precision_recall_curve()
|
|
230
|
+
flex.plot_auc_scores()
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
For a runnable full workflow, see [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py).
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT
|
pflex-1.2/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
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": "png",
|
|
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
|
+
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
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Quickstart
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
import pflex as flex
|
|
166
|
+
|
|
167
|
+
inputs = {
|
|
168
|
+
"Skin": {
|
|
169
|
+
"path": flex.example_input_path("skin_cell_lines_corum_genes.parquet"),
|
|
170
|
+
"sort": "high",
|
|
171
|
+
"color": "#4E79A7",
|
|
172
|
+
},
|
|
173
|
+
"Soft Tissue": {
|
|
174
|
+
"path": flex.example_input_path("soft_tissue_cell_lines_corum_genes.parquet"),
|
|
175
|
+
"sort": "high",
|
|
176
|
+
"color": "#F28E2B",
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
config = {
|
|
181
|
+
"functional_standard": "CORUM",
|
|
182
|
+
"output_folder": "output",
|
|
183
|
+
"analysis_genes": "shared",
|
|
184
|
+
"jaccard": True,
|
|
185
|
+
"preprocessing": {
|
|
186
|
+
"fill_na": True,
|
|
187
|
+
},
|
|
188
|
+
"corr_function": "numpy_without_mask",
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
flex.initialize(config)
|
|
192
|
+
data, _ = flex.load_datasets(inputs)
|
|
193
|
+
|
|
194
|
+
for name, dataset in data.items():
|
|
195
|
+
corr = flex.perform_corr(dataset, config["corr_function"])
|
|
196
|
+
flex.pra(name, corr, is_corr=True)
|
|
197
|
+
|
|
198
|
+
flex.plot_precision_recall_curve()
|
|
199
|
+
flex.plot_auc_scores()
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
For a runnable full workflow, see [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py).
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
|
@@ -0,0 +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": "png",
|
|
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`.
|
pflex-1.2/docs/index.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# pFLEX
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
Use pFLEX to:
|
|
6
|
+
|
|
7
|
+
- load one or more gene-by-sample matrices
|
|
8
|
+
- rank gene pairs by correlation or a precomputed score
|
|
9
|
+
- evaluate global precision-recall performance
|
|
10
|
+
- evaluate performance at the functional-standard term level
|
|
11
|
+
- plot benchmark summaries and export result tables
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Create an Environment
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
conda create -n p310 python=3.10
|
|
9
|
+
conda activate p310
|
|
10
|
+
pip install uv
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Install from PyPI
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv pip install pflex
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install pflex
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Install for Local Development
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/tyasird/pFLEX.git
|
|
29
|
+
cd pFLEX
|
|
30
|
+
uv pip install -e .
|
|
31
|
+
```
|