pythonflex 0.2__tar.gz → 0.2.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.
Files changed (25) hide show
  1. {pythonflex-0.2 → pythonflex-0.2.2}/.gitignore +1 -0
  2. {pythonflex-0.2 → pythonflex-0.2.2}/PKG-INFO +1 -1
  3. {pythonflex-0.2 → pythonflex-0.2.2}/pyproject.toml +1 -1
  4. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/utils.py +35 -11
  5. pythonflex-0.2/.vscode/settings.json +0 -5
  6. {pythonflex-0.2 → pythonflex-0.2.2}/.python-version +0 -0
  7. {pythonflex-0.2 → pythonflex-0.2.2}/README.md +0 -0
  8. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/__init__.py +0 -0
  9. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/analysis.py +0 -0
  10. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/dataset/liver_cell_lines_500_genes.csv +0 -0
  11. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/dataset/melanoma_cell_lines_500_genes.csv +0 -0
  12. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/dataset/neuroblastoma_cell_lines_500_genes.csv +0 -0
  13. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/CORUM.parquet +0 -0
  14. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/GOBP.parquet +0 -0
  15. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/PATHWAY.parquet +0 -0
  16. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/corum.csv +0 -0
  17. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/gobp.csv +0 -0
  18. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/data/gold_standard/pathway.csv +0 -0
  19. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/examples/basic_usage.py +0 -0
  20. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/examples/dataset_filtering.py +0 -0
  21. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/examples/test.py +0 -0
  22. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/logging_config.py +0 -0
  23. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/plotting.py +0 -0
  24. {pythonflex-0.2 → pythonflex-0.2.2}/src/pythonflex/preprocessing.py +0 -0
  25. {pythonflex-0.2 → pythonflex-0.2.2}/uv.lock +0 -0
@@ -15,3 +15,4 @@ bfg-*.jar
15
15
  examples/output/
16
16
  src/benchmarkcr/examples/output/
17
17
  .aider*
18
+ .vscode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonflex
3
- Version: 0.2
3
+ Version: 0.2.2
4
4
  Summary: pythonFLEX 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
5
  Author-email: Yasir Demirtaş <tyasird@hotmail.com>
6
6
  Requires-Python: >=3.9
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pythonflex"
3
- version = "0.2"
3
+ version = "0.2.2"
4
4
  description = "pythonFLEX 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
5
  readme = "README.md"
6
6
  authors = [
@@ -5,9 +5,23 @@ import joblib
5
5
  import numpy as np
6
6
  import pandas as pd
7
7
 
8
- # Constants
8
+ # Constants - ADD .parquet to valid extensions
9
9
  TMP_ROOT = ".tmp"
10
- VALID_EXTS = {".feather", ".npy", ".pkl"}
10
+ VALID_EXTS = {".feather", ".parquet", ".npy", ".pkl"}
11
+
12
+ # Minimal fix - just patch the problematic save
13
+ original_to_feather = pd.DataFrame.to_feather
14
+ def safe_to_feather(self, path, **kwargs):
15
+ try:
16
+ return original_to_feather(self, path, **kwargs)
17
+ except ValueError as e:
18
+ if "feather does not support serializing" in str(e):
19
+ # FIXED: Better path handling
20
+ parquet_path = os.path.splitext(path)[0] + '.parquet'
21
+ self.to_parquet(parquet_path, **kwargs)
22
+ else:
23
+ raise
24
+ pd.DataFrame.to_feather = safe_to_feather
11
25
 
12
26
  # Helper to sanitize names (make filesystem-safe)
13
27
  def _sanitize(name):
@@ -54,7 +68,7 @@ def dsave(data, category, name=None, path=None): # 'path' ignored for compatibi
54
68
  save_func(tmp_path)
55
69
  os.replace(tmp_path, target) # Atomic move
56
70
 
57
- # Load function
71
+ # Load function - FIXED: Added parquet support
58
72
  def dload(category, name=None, path=None): # 'path' ignored for compatibility
59
73
  dir_path = os.path.join(TMP_ROOT, _sanitize(category))
60
74
 
@@ -72,6 +86,8 @@ def dload(category, name=None, path=None): # 'path' ignored for compatibility
72
86
  try:
73
87
  if filename.endswith(".feather"):
74
88
  out[k] = pd.read_feather(full_path)
89
+ elif filename.endswith(".parquet"): # ADDED
90
+ out[k] = pd.read_parquet(full_path)
75
91
  elif filename.endswith(".npy"):
76
92
  out[k] = np.load(full_path, mmap_mode="r") # MMap for perf
77
93
  elif filename.endswith(".pkl"):
@@ -81,20 +97,28 @@ def dload(category, name=None, path=None): # 'path' ignored for compatibility
81
97
  os.remove(full_path) # Delete corrupted file
82
98
  return out
83
99
 
84
- # Load specific name (try extensions in order)
85
- for ext in VALID_EXTS:
100
+ # Load specific name (try extensions in order - PREFER PARQUET over FEATHER)
101
+ # Check parquet first since it's more reliable for complex data
102
+ preferred_order = [".parquet", ".feather", ".npy", ".pkl"]
103
+
104
+ for ext in preferred_order:
105
+ if ext not in VALID_EXTS:
106
+ continue
86
107
  target = _safe_path(category, name, ext)
87
108
  if os.path.exists(target):
88
109
  try:
89
110
  if ext == ".feather":
90
111
  return pd.read_feather(target)
112
+ elif ext == ".parquet":
113
+ return pd.read_parquet(target)
91
114
  elif ext == ".npy":
92
115
  return np.load(target, mmap_mode="r") # MMap for perf
93
116
  elif ext == ".pkl":
94
117
  return joblib.load(target, mmap_mode="r") # MMap for perf
95
- except (EOFError, ValueError, OSError):
96
- print(f"Warning: '{target}' is corrupted. Deleting and returning {{}}...")
97
- os.remove(target)
98
- return {}
99
- return {}
100
-
118
+ except (EOFError, ValueError, OSError) as e:
119
+ print(f"Warning: '{target}' is corrupted ({e}). Trying next format...")
120
+ os.remove(target) # Delete corrupted file
121
+ continue # Try next format instead of returning {}
122
+
123
+ print(f"Warning: No valid file found for {category}/{name}")
124
+ return {}
@@ -1,5 +0,0 @@
1
- {
2
- "python-envs.defaultEnvManager": "ms-python.python:conda",
3
- "python-envs.defaultPackageManager": "ms-python.python:conda",
4
- "python-envs.pythonProjects": []
5
- }
File without changes
File without changes
File without changes