pflex 1.0__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/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+
10
+ bfg-*.jar
11
+
12
+ # Virtual environments
13
+ .venv
14
+ **/result.pkl
15
+ examples/output/
16
+ src/pflex/examples/output/
17
+ src/pflex/output/
18
+ src/pflex/input/
19
+ .aider*
20
+ .vscode
@@ -0,0 +1 @@
1
+ 3.12
pflex-1.0/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026, Yasir Demirtas, Maximilian Billmann
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pflex-1.0/PKG-INFO ADDED
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: pflex
3
+ Version: 1.0
4
+ Summary: pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological gold standards. The toolkit computes gene-level and complex-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.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Requires-Python: >=3.9
14
+ Requires-Dist: adjusttext
15
+ Requires-Dist: art
16
+ Requires-Dist: bitarray
17
+ Requires-Dist: emoji
18
+ Requires-Dist: importlib-resources
19
+ Requires-Dist: ipython
20
+ Requires-Dist: joblib
21
+ Requires-Dist: loguru
22
+ Requires-Dist: matplotlib
23
+ Requires-Dist: numba
24
+ Requires-Dist: numpy
25
+ Requires-Dist: pandas
26
+ Requires-Dist: pyarrow
27
+ Requires-Dist: python-slugify
28
+ Requires-Dist: scikit-learn
29
+ Requires-Dist: scipy
30
+ Requires-Dist: tqdm
31
+ Description-Content-Type: text/markdown
32
+
33
+ # pflex
34
+
35
+ ![PyPI](https://img.shields.io/badge/pypi-v1.0-orange)
36
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
37
+ ![License](https://img.shields.io/badge/license-MIT-green)
38
+ ![Build](https://img.shields.io/badge/build-passing-brightgreen)
39
+ ![Build system](https://img.shields.io/badge/build-hatchling-blue)
40
+ ![Lint](https://img.shields.io/badge/lint-ruff-46a2f1)
41
+ ![CLI](https://img.shields.io/badge/CLI-pflex-brightgreen)
42
+
43
+ **pflex** is a benchmarking toolkit for evaluating CRISPR screen results against biological gold standards. It provides precision-recall analysis using reference gene sets from CORUM protein complexes, Gene Ontology Biological Processes (GO-BP), KEGG pathways, and other curated resources. The toolkit computes gene-level and complex-level performance metrics, helping researchers systematically assess the biological relevance and resolution of their CRISPR screening data.
44
+
45
+ ---
46
+
47
+ ## Features
48
+
49
+ - Precision-recall curve generation for ranked gene lists
50
+ - Evaluation using CORUM complexes, GO terms, pathways
51
+ - Complex-level resolution analysis and visualization
52
+ - Easy integration into CRISPR screen workflows
53
+
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ Suggested to use Python version `3.10` with `virtual env`.
59
+
60
+ Create `venv`:
61
+
62
+ ```bash
63
+ conda create -n p310 python=3.10
64
+ conda activate p310
65
+ pip install uv
66
+ ```
67
+
68
+ Install pflex via pip:
69
+
70
+ ```bash
71
+ uv pip install pflex
72
+ ```
73
+
74
+ or:
75
+
76
+ ```bash
77
+ pip install pflex
78
+ ```
79
+
80
+ or install pflex via git to develop the package locally:
81
+
82
+ ```bash
83
+ git clone https://github.com/tyasird/pflex.git
84
+ cd pflex
85
+ uv pip install -e .
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Quickstart
91
+
92
+ ```python
93
+ import pflex as flex
94
+
95
+ inputs = {
96
+ "Melanoma (63 Screens)": {
97
+ "path": flex.get_example_data_path("melanoma_cell_lines_500_genes.csv"),
98
+ "sort": "high",
99
+ "color": "#FF0000",
100
+ },
101
+ "Liver (24 Screens)": {
102
+ "path": flex.get_example_data_path("liver_cell_lines_500_genes.csv"),
103
+ "sort": "high",
104
+ "color": "#FFDD00",
105
+ },
106
+ "Neuroblastoma (37 Screens)": {
107
+ "path": flex.get_example_data_path("neuroblastoma_cell_lines_500_genes.csv"),
108
+ "sort": "high",
109
+ "color": "#FFDDDD",
110
+ },
111
+ }
112
+
113
+ default_config = {
114
+ "min_genes_in_complex": 0,
115
+ "min_genes_per_complex_analysis": 3,
116
+ "output_folder": "CORUM",
117
+ "gold_standard": "CORUM",
118
+ "color_map": "BuGn",
119
+ "jaccard": False,
120
+ "use_common_genes": False,
121
+ "plotting": {
122
+ "save_plot": True,
123
+ "output_type": "png",
124
+ },
125
+ "preprocessing": {
126
+ "fill_na": True,
127
+ "normalize": False,
128
+ },
129
+ "corr_function": "numpy",
130
+ "logging": {
131
+ "visible_levels": ["DONE"],
132
+ },
133
+ }
134
+
135
+ flex.initialize(default_config)
136
+
137
+ data, _ = flex.load_datasets(inputs)
138
+ terms, genes_in_terms = flex.load_gold_standard()
139
+
140
+ for name, dataset in data.items():
141
+ pra = flex.pra(name, dataset, is_corr=False)
142
+ fpc = flex.pra_percomplex(name, dataset, is_corr=False)
143
+ cc = flex.complex_contributions(name)
144
+ flex.mpr_prepare(name)
145
+
146
+ flex.plot_precision_recall_curve()
147
+ flex.plot_auc_scores()
148
+ flex.plot_significant_complexes()
149
+ flex.plot_percomplex_scatter(n_top=20)
150
+ flex.plot_percomplex_scatter_bysize()
151
+ flex.plot_complex_contributions()
152
+ flex.plot_mpr_tp_multi()
153
+ flex.plot_mpr_complexes_multi()
154
+ flex.save_results_to_csv()
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Examples
160
+
161
+ - [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py)
162
+
163
+ ---
164
+
165
+ ## License
166
+
167
+ MIT
pflex-1.0/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # pflex
2
+
3
+ ![PyPI](https://img.shields.io/badge/pypi-v1.0-orange)
4
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
5
+ ![License](https://img.shields.io/badge/license-MIT-green)
6
+ ![Build](https://img.shields.io/badge/build-passing-brightgreen)
7
+ ![Build system](https://img.shields.io/badge/build-hatchling-blue)
8
+ ![Lint](https://img.shields.io/badge/lint-ruff-46a2f1)
9
+ ![CLI](https://img.shields.io/badge/CLI-pflex-brightgreen)
10
+
11
+ **pflex** is a benchmarking toolkit for evaluating CRISPR screen results against biological gold standards. It provides precision-recall analysis using reference gene sets from CORUM protein complexes, Gene Ontology Biological Processes (GO-BP), KEGG pathways, and other curated resources. The toolkit computes gene-level and complex-level performance metrics, helping researchers systematically assess the biological relevance and resolution of their CRISPR screening data.
12
+
13
+ ---
14
+
15
+ ## Features
16
+
17
+ - Precision-recall curve generation for ranked gene lists
18
+ - Evaluation using CORUM complexes, GO terms, pathways
19
+ - Complex-level resolution analysis and visualization
20
+ - Easy integration into CRISPR screen workflows
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ Suggested to use Python version `3.10` with `virtual env`.
27
+
28
+ Create `venv`:
29
+
30
+ ```bash
31
+ conda create -n p310 python=3.10
32
+ conda activate p310
33
+ pip install uv
34
+ ```
35
+
36
+ Install pflex via pip:
37
+
38
+ ```bash
39
+ uv pip install pflex
40
+ ```
41
+
42
+ or:
43
+
44
+ ```bash
45
+ pip install pflex
46
+ ```
47
+
48
+ or install pflex via git to develop the package locally:
49
+
50
+ ```bash
51
+ git clone https://github.com/tyasird/pflex.git
52
+ cd pflex
53
+ uv pip install -e .
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Quickstart
59
+
60
+ ```python
61
+ import pflex as flex
62
+
63
+ inputs = {
64
+ "Melanoma (63 Screens)": {
65
+ "path": flex.get_example_data_path("melanoma_cell_lines_500_genes.csv"),
66
+ "sort": "high",
67
+ "color": "#FF0000",
68
+ },
69
+ "Liver (24 Screens)": {
70
+ "path": flex.get_example_data_path("liver_cell_lines_500_genes.csv"),
71
+ "sort": "high",
72
+ "color": "#FFDD00",
73
+ },
74
+ "Neuroblastoma (37 Screens)": {
75
+ "path": flex.get_example_data_path("neuroblastoma_cell_lines_500_genes.csv"),
76
+ "sort": "high",
77
+ "color": "#FFDDDD",
78
+ },
79
+ }
80
+
81
+ default_config = {
82
+ "min_genes_in_complex": 0,
83
+ "min_genes_per_complex_analysis": 3,
84
+ "output_folder": "CORUM",
85
+ "gold_standard": "CORUM",
86
+ "color_map": "BuGn",
87
+ "jaccard": False,
88
+ "use_common_genes": False,
89
+ "plotting": {
90
+ "save_plot": True,
91
+ "output_type": "png",
92
+ },
93
+ "preprocessing": {
94
+ "fill_na": True,
95
+ "normalize": False,
96
+ },
97
+ "corr_function": "numpy",
98
+ "logging": {
99
+ "visible_levels": ["DONE"],
100
+ },
101
+ }
102
+
103
+ flex.initialize(default_config)
104
+
105
+ data, _ = flex.load_datasets(inputs)
106
+ terms, genes_in_terms = flex.load_gold_standard()
107
+
108
+ for name, dataset in data.items():
109
+ pra = flex.pra(name, dataset, is_corr=False)
110
+ fpc = flex.pra_percomplex(name, dataset, is_corr=False)
111
+ cc = flex.complex_contributions(name)
112
+ flex.mpr_prepare(name)
113
+
114
+ flex.plot_precision_recall_curve()
115
+ flex.plot_auc_scores()
116
+ flex.plot_significant_complexes()
117
+ flex.plot_percomplex_scatter(n_top=20)
118
+ flex.plot_percomplex_scatter_bysize()
119
+ flex.plot_complex_contributions()
120
+ flex.plot_mpr_tp_multi()
121
+ flex.plot_mpr_complexes_multi()
122
+ flex.save_results_to_csv()
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Examples
128
+
129
+ - [src/pflex/examples/basic_usage.py](src/pflex/examples/basic_usage.py)
130
+
131
+ ---
132
+
133
+ ## License
134
+
135
+ MIT
@@ -0,0 +1,77 @@
1
+ [project]
2
+ name = "pflex"
3
+ version = "1.0"
4
+ description = "pflex is a benchmarking toolkit for evaluating CRISPR screen results against biological gold standards. The toolkit computes gene-level and complex-level performance metrics, helping researchers systematically assess the biological relevance and resolution of their CRISPR screening data."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Yasir Demirtas", email = "tyasird@hotmail.com" }
8
+ ]
9
+ requires-python = ">=3.9"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.9",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ dependencies = [
20
+ "adjustText",
21
+ "art",
22
+ "bitarray",
23
+ "emoji",
24
+ "ipython",
25
+ "joblib",
26
+ "loguru",
27
+ "matplotlib",
28
+ "numba",
29
+ "numpy",
30
+ "pandas",
31
+ "pyarrow",
32
+ "python-slugify",
33
+ "scikit-learn",
34
+ "scipy",
35
+ "tqdm",
36
+ "importlib-resources",
37
+ ]
38
+
39
+ [project.scripts]
40
+ pflex = "pflex:main"
41
+
42
+ [build-system]
43
+ requires = ["hatchling"]
44
+ build-backend = "hatchling.build"
45
+
46
+ [tool.ruff]
47
+ ignore = ["F541"]
48
+
49
+ [tool.setuptools]
50
+ include-package-data = true
51
+
52
+ [tool.setuptools.packages.find]
53
+ include = ["pflex*"]
54
+
55
+ [tool.setuptools.package-data]
56
+ pflex = ["data/**/*.parquet", "data/**/*.csv", "data/**/*.tsv", "data/**/*.json", "data/**/*.txt", "data/**/*.xlsx", "data/**/*.xls", "data/**/*.h5", "data/**/*.hdf5"]
57
+
58
+ [tool.hatch.build]
59
+ exclude = [
60
+ "**/result.pkl",
61
+ "examples/output",
62
+ "src/pflex/input/*",
63
+ "src/pflex/output/*",
64
+ "src/pflex/examples/output/*",
65
+ "src/pflex/examples/.tmp/*",
66
+ ]
67
+
68
+ [tool.hatch.build.targets.wheel]
69
+ packages = ["src/pflex"]
70
+
71
+ [tool.uv.sources]
72
+ pflex = { workspace = true }
73
+
74
+ [dependency-groups]
75
+ dev = [
76
+ "pflex",
77
+ ]
@@ -0,0 +1,44 @@
1
+ from .logging_config import log
2
+ from .utils import dsave, dload
3
+ from .preprocessing import get_example_data_path, load_datasets, get_common_genes, filter_matrix_by_genes, load_gold_standard, filter_duplicate_terms
4
+ from .analysis import initialize, prepare_terms_for_dataset, pra, pra_percomplex, fast_corr, perform_corr, is_symmetric, binary, has_mirror_of_first_pair, convert_full_to_half_matrix, drop_mirror_pairs, quick_sort, complex_contributions, save_results_to_csv, update_matploblib_config, mpr_prepare
5
+ from .plotting import (
6
+ adjust_text_positions, plot_precision_recall_curve, plot_aggregated_pra, plot_iqr_pra, plot_all_runs_pra, plot_percomplex_scatter,
7
+ plot_percomplex_scatter_bysize, plot_complex_contributions, plot_significant_complexes, plot_auc_scores,
8
+ plot_mpr_tp, plot_mpr_complexes, plot_mpr_tp_multi, plot_mpr_complexes_multi, plot_mpr_complexes_auc_scores,
9
+ plot_mpr_true_positive_curve, plot_mpr_complex_coverage_curve, plot_mpr_complex_auc_scores, plot_mpr_summary
10
+ )
11
+
12
+ def main():
13
+ import argparse
14
+ from importlib.metadata import PackageNotFoundError, version
15
+
16
+ try:
17
+ package_version = version("pflex")
18
+ except PackageNotFoundError:
19
+ package_version = "unknown"
20
+
21
+ parser = argparse.ArgumentParser(
22
+ prog="pflex",
23
+ description="pflex benchmarking toolkit. Use the Python API to run analyses.",
24
+ )
25
+ parser.add_argument(
26
+ "--version",
27
+ action="version",
28
+ version=f"pflex {package_version}",
29
+ )
30
+ parser.parse_args()
31
+ parser.print_help()
32
+
33
+ __all__ = [ "log", "get_example_data_path", "fast_corr",
34
+ "initialize", "dsave", "dload", "load_datasets", "get_common_genes",
35
+ "filter_matrix_by_genes", "load_gold_standard", "filter_duplicate_terms", "pra", "pra_percomplex",
36
+ "prepare_terms_for_dataset",
37
+ "perform_corr", "is_symmetric", "binary", "has_mirror_of_first_pair", "convert_full_to_half_matrix",
38
+ "drop_mirror_pairs", "quick_sort", "complex_contributions", "adjust_text_positions", "plot_precision_recall_curve",
39
+ "plot_aggregated_pra", "plot_iqr_pra", "plot_all_runs_pra", "plot_percomplex_scatter", "plot_percomplex_scatter_bysize", "plot_complex_contributions",
40
+ "plot_significant_complexes", "plot_auc_scores", "plot_mpr_complexes_auc_scores", "plot_mpr_complex_auc_scores", "save_results_to_csv", "update_matploblib_config",
41
+ "mpr_prepare", "plot_mpr_tp", "plot_mpr_complexes",
42
+ "plot_mpr_tp_multi", "plot_mpr_complexes_multi", "plot_mpr_true_positive_curve",
43
+ "plot_mpr_complex_coverage_curve", "plot_mpr_summary", "main"
44
+ ]