pflex 1.4.2__tar.gz → 1.5.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.
Files changed (31) hide show
  1. {pflex-1.4.2 → pflex-1.5.0}/.python-version +1 -1
  2. {pflex-1.4.2 → pflex-1.5.0}/PKG-INFO +19 -1
  3. {pflex-1.4.2 → pflex-1.5.0}/README.md +18 -0
  4. {pflex-1.4.2 → pflex-1.5.0}/docs/getting-started.md +3 -0
  5. {pflex-1.4.2 → pflex-1.5.0}/docs/user-guide.md +10 -7
  6. {pflex-1.4.2 → pflex-1.5.0}/pyproject.toml +1 -1
  7. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/analysis.py +1818 -1811
  8. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/examples/basic_usage.py +13 -0
  9. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/logging_config.py +2 -2
  10. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/plotting.py +1942 -1739
  11. {pflex-1.4.2 → pflex-1.5.0}/uv.lock +1 -1
  12. {pflex-1.4.2 → pflex-1.5.0}/.gitignore +0 -0
  13. {pflex-1.4.2 → pflex-1.5.0}/LICENSE +0 -0
  14. {pflex-1.4.2 → pflex-1.5.0}/docs/index.md +0 -0
  15. {pflex-1.4.2 → pflex-1.5.0}/docs/installation.md +0 -0
  16. {pflex-1.4.2 → pflex-1.5.0}/mkdocs.yml +0 -0
  17. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/__init__.py +0 -0
  18. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/__init__.py +0 -0
  19. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/example_input/__init__.py +0 -0
  20. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/example_input/skin_cell_lines_corum_genes.parquet +0 -0
  21. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/example_input/soft_tissue_cell_lines_corum_genes.parquet +0 -0
  22. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/CORUM.parquet +0 -0
  23. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/GOBP.parquet +0 -0
  24. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/PATHWAY.parquet +0 -0
  25. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/__init__.py +0 -0
  26. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/corum.csv +0 -0
  27. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/gobp.csv +0 -0
  28. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/data/functional_standard/pathway.csv +0 -0
  29. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/preprocessing.py +0 -0
  30. {pflex-1.4.2 → pflex-1.5.0}/src/pflex/style.py +0 -0
  31. {pflex-1.4.2 → pflex-1.5.0}/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.2
3
+ Version: 1.5.0
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
@@ -148,6 +148,9 @@ config = {
148
148
  "plotting": {
149
149
  "save_plot": True,
150
150
  "output_type": "pdf",
151
+ "figure_scale": 0.75, # plot-area size; 0.75 = three panels across A4, 0.55 = four
152
+ "titles": False, # default plot titles
153
+ "captions": False, # small grey description under each plot
151
154
  },
152
155
  }
153
156
  ```
@@ -189,6 +192,21 @@ flex.save_results_to_csv()
189
192
  curve. `plot_mpr_summary()` plots that curve and the corresponding dataset-level
190
193
  mPR AUC values; it does not produce a duplicate global precision-recall plot.
191
194
 
195
+ Figures are made at their final print size: 8 pt Arial text, thin lines and
196
+ editable text in PDF/SVG. `plotting.figure_scale` sets the plot-area size
197
+ (default `0.75`, three panels across A4; `0.55` fits four), and
198
+ `plotting.titles` / `plotting.captions` switch the default titles and short grey
199
+ descriptions on. Plots can be combined into one lettered multi-panel figure:
200
+
201
+ ```python
202
+ flex.plot_panels([
203
+ flex.plot_precision_recall_curve,
204
+ (flex.plot_per_module_scatter, {"pair": ("Skin", "Soft Tissue")}),
205
+ flex.plot_auc_scores,
206
+ flex.plot_mpr_module_coverage_curve,
207
+ ], ncols=2)
208
+ ```
209
+
192
210
  The predefined complex-filter comparisons are optional and computed lazily:
193
211
 
194
212
  ```python
@@ -118,6 +118,9 @@ config = {
118
118
  "plotting": {
119
119
  "save_plot": True,
120
120
  "output_type": "pdf",
121
+ "figure_scale": 0.75, # plot-area size; 0.75 = three panels across A4, 0.55 = four
122
+ "titles": False, # default plot titles
123
+ "captions": False, # small grey description under each plot
121
124
  },
122
125
  }
123
126
  ```
@@ -159,6 +162,21 @@ flex.save_results_to_csv()
159
162
  curve. `plot_mpr_summary()` plots that curve and the corresponding dataset-level
160
163
  mPR AUC values; it does not produce a duplicate global precision-recall plot.
161
164
 
165
+ Figures are made at their final print size: 8 pt Arial text, thin lines and
166
+ editable text in PDF/SVG. `plotting.figure_scale` sets the plot-area size
167
+ (default `0.75`, three panels across A4; `0.55` fits four), and
168
+ `plotting.titles` / `plotting.captions` switch the default titles and short grey
169
+ descriptions on. Plots can be combined into one lettered multi-panel figure:
170
+
171
+ ```python
172
+ flex.plot_panels([
173
+ flex.plot_precision_recall_curve,
174
+ (flex.plot_per_module_scatter, {"pair": ("Skin", "Soft Tissue")}),
175
+ flex.plot_auc_scores,
176
+ flex.plot_mpr_module_coverage_curve,
177
+ ], ncols=2)
178
+ ```
179
+
162
180
  The predefined complex-filter comparisons are optional and computed lazily:
163
181
 
164
182
  ```python
@@ -43,6 +43,9 @@ config = {
43
43
  "plotting": {
44
44
  "save_plot": True,
45
45
  "output_type": "pdf",
46
+ "figure_scale": 0.75, # plot-area size; 0.75 = three panels across A4, 0.55 = four
47
+ "titles": False, # default plot titles
48
+ "captions": False, # small grey description under each plot
46
49
  },
47
50
  }
48
51
 
@@ -94,6 +94,8 @@ Configuration keys:
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
  - `plotting.dpi`: resolution of raster output such as PNG (default `300`). Vector formats (`"pdf"`, `"svg"`) keep text editable.
97
+ - `plotting.figure_scale`: size of the plot area relative to the design size (a 2-inch square for curves and scatter plots). Default `0.75` gives about a 38 mm plot area, three panels across an A4 page; `0.55` fits four. Text always stays 8 pt; only the plot area changes.
98
+ - `plotting.titles` / `plotting.captions`: draw each plot's default title / small grey caption (default `False`, as the figure legend usually carries that text). Passing `title=` or `caption=` to a plot function shows it regardless.
97
99
  - `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"]`.
98
100
 
99
101
  ## Loading
@@ -180,25 +182,26 @@ flex.save_results_to_csv()
180
182
 
181
183
  Plotting functions read cached analysis results from the current run. If `plotting.save_plot` is `True`, figures are written to `output_folder`.
182
184
 
183
- All figures are produced at their final print size (about 3 inches wide, a single journal column) with 8 pt Arial text and thin lines, so they can go into a manuscript without rescaling.
184
- Each plot has a descriptive default title and a small grey caption under it (`title=` / `caption=` to change them, `""` to remove). Precision-recall, mPR and scatter plots use a square plot area whatever the axis range. Dataset legends go into an empty corner of the plot when one exists, otherwise outside on the right. The complex-filter comparisons (`plot_globalpr_filter`, `plot_mpr_filter`) show one small panel per filter, with datasets in their usual colours and solid lines; in `plot_panels` give them two columns: `(flex.plot_globalpr_filter, {}, 2)`.
185
+ All figures are produced at their final print size (`plotting.figure_scale`) with 8 pt Arial text and thin lines, so they can go into a manuscript without rescaling. Long axis labels are split onto two lines.
186
+ Default titles and grey captions are off; switch them on with `plotting.titles` / `plotting.captions` or pass `title=` / `caption=`. Precision-recall, mPR, scatter and threshold-bar plots use a square plot area whatever the axis range. Dataset legends go into an empty corner of the plot when one exists, otherwise above it.
187
+ Axes follow one standard: precision (0-1) axes have a tick every 0.1 and are labelled at the finest step that fits (0.2 at the default scale); log true-positive axes have a tick at every decade, labelled consistently across panels; module-count axes always run from 1 to 200 and are labelled 2, 20 and 200 (curves continuing past 200 are cut at the edge). The complex-filter comparisons (`plot_globalpr_filter`, `plot_mpr_filter`) show one small panel per filter, with datasets in their usual colours and solid lines; in `plot_panels` give them two columns: `(flex.plot_globalpr_filter, {}, 2)`.
185
188
 
186
189
  Global plots:
187
190
 
188
- - `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.
191
+ - `plot_precision_recall_curve(line_width=1.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.
189
192
  - `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.
190
193
 
191
194
  Per-module plots:
192
195
 
193
196
  - `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.
194
- - `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. The figure is publication-ready at its final size (3 × 3 in, 8 pt Arial, 0.25 pt borders, editable text in PDF/SVG). Every highlighted term (top `n_top` in either dataset, including terms top in both) is always labelled; `n_labels` is deprecated and ignored. Reference circle sizes (5, 10, 50 genes) are shown under the plot (`size_legend=False` to hide), using their first word (`short_labels=True`); nearby terms with the same short name share one label, and `label_map={"Full name": "Label"}` overrides individual labels. Labels that cannot be placed without overlap are left out with a warning.
195
- - `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.
197
+ - `plot_per_module_scatter(n_top=10, labels_per_dataset=4, labels_in_both=2, ...)` compares per-module AUPRC values between pairs of datasets. Each point is one functional-standard term; circle area grows with the number of genes. Points near the diagonal perform similarly in both datasets; points far from the diagonal are terms that are stronger in one dataset. Among the top `n_top` terms of each dataset, the best `labels_per_dataset` terms specific to that dataset are coloured and labelled, and the best `labels_in_both` terms top in both are labelled in grey; every other term is a white circle with a thin black border. Labels use the term's first word (`short_labels=True`); nearby terms with the same short name share one label, and `label_map={"Full name": "Label"}` overrides individual labels. Labels for terms stronger in the y dataset look upwards first, those stronger in the x dataset look right first. Reference circle sizes (`size_legend_genes=(5, 20, 100)`) are shown under the plot (`size_legend=False` to hide). `n_labels` is deprecated and ignored.
198
+ - `plot_per_module_scatter_by_size(n_labels=5, 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.
196
199
  - `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.
197
200
 
198
201
  Multi-panel figures:
199
202
 
200
203
  - Every plot function accepts `ax=` and then draws into that axes instead of a new figure (nothing is saved). Functions that make one figure per dataset or pair take `dataset=` / `pair=` to choose which one.
201
- - `plot_panels(panels, ncols=2, panel_size=(3.4, 3.6))` builds a figure labelled a, b, c, ... from those functions. Each entry is a function or a `(function, kwargs)` tuple; ticks, labels and legends are fitted inside each panel's cell, and the result is saved as `figure_panels.<output_type>` (`outname=` to change).
204
+ - `plot_panels(panels, ncols=2, panel_size=(3.4, 3.6))` (cell size scaled by `figure_scale`) builds a figure labelled a, b, c, ... from those functions. Each entry is a function or a `(function, kwargs)` tuple; ticks, labels and legends are fitted inside each panel's cell, and the result is saved as `figure_panels.<output_type>` (`outname=` to change).
202
205
 
203
206
  ```python
204
207
  flex.plot_panels([
@@ -212,7 +215,7 @@ flex.plot_panels([
212
215
  mPR preparation and plots:
213
216
 
214
217
  - `mpr_prepare(name, tp_th=1, percent_th=0.1)` prepares the single unfiltered module-coverage mPR curve for one dataset.
215
- - `plot_mpr_module_coverage_curve(dataset_names=None, colors=None, linewidth=1.0, show_markers="auto")` compares unfiltered mPR curves across datasets.
218
+ - `plot_mpr_module_coverage_curve(dataset_names=None, colors=None, linewidth=1.0, show_markers=False)` compares unfiltered mPR curves across datasets (`show_markers=True` marks the measured points).
216
219
  - `plot_mpr_summary(...)` creates the unfiltered module-coverage plot and the dataset-level mPR AUC plot. It does not create a global PR plot.
217
220
  - `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.
218
221
  - `globalpr_filter(name, size_th=30, auprc_th=0.4, ...)` lazily computes the matching global PR variants. `plot_globalpr_filter()` plots them.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pflex"
3
- version = "1.4.2"
3
+ version = "1.5.0"
4
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 = [