cc-mapping 0.2.0__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 (23) hide show
  1. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/PKG-INFO +1 -1
  2. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/pyproject.toml +1 -1
  3. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/thresholding/sequential.py +21 -12
  4. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/LICENSE +0 -0
  5. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/README.md +0 -0
  6. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/__init__.py +0 -0
  7. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/core.py +0 -0
  8. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/__init__.py +0 -0
  9. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_base.py +0 -0
  10. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_persistence.py +0 -0
  11. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_plotting.py +0 -0
  12. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_preprocessing.py +0 -0
  13. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_random_forest.py +0 -0
  14. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/feature_selection/_training.py +0 -0
  15. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/manifold.py +0 -0
  16. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/plot.py +0 -0
  17. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/preprocess.py +0 -0
  18. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/pseudotime.py +0 -0
  19. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/thresholding/__init__.py +0 -0
  20. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/thresholding/base.py +0 -0
  21. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/thresholding/single.py +0 -0
  22. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/utils.py +0 -0
  23. {cc_mapping-0.2.0 → cc_mapping-0.2.2}/src/cc_mapping/utils_v0.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cc-mapping
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Gaussian Mixture Model-based thresholding for single-cell gene expression analysis
5
5
  Home-page: https://github.com/StallaertLab/cc_mapping
6
6
  License: BSD-3-Clause
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cc-mapping"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "Gaussian Mixture Model-based thresholding for single-cell gene expression analysis"
5
5
  authors = ["ddpoe <dap182@pitt.edu>"]
6
6
  readme = "README.md"
@@ -429,10 +429,14 @@ class SequentialGMM(GaussianMixtureModelBase):
429
429
  data_probs=gmm.predict_proba(subset_data.reshape(-1, 1)),
430
430
  )
431
431
 
432
- # Handle duplicate labels if needed
433
- if duplicate_labels:
434
- ordered_labels_processed, condensed_data_probs = self._handle_duplicate_labels(
435
- ordered_labels, gmm_info.data_probs
432
+ # Handle duplicate labels if needed.
433
+ # Match single.py:643 arg order: (data_probs, ordered_labels) — and only
434
+ # collapse when labels actually contain duplicates, since the underlying
435
+ # _handle_duplicate_labels can mis-shape the output for no-op collapses.
436
+ has_duplicates = len(set(ordered_labels)) < len(ordered_labels)
437
+ if duplicate_labels and has_duplicates:
438
+ condensed_data_probs, ordered_labels_processed = self._handle_duplicate_labels(
439
+ gmm_info.data_probs, ordered_labels
436
440
  )
437
441
  gmm_info.condensed_data_probs = condensed_data_probs
438
442
  else:
@@ -440,19 +444,24 @@ class SequentialGMM(GaussianMixtureModelBase):
440
444
 
441
445
  # Calculate decision boundaries from probabilities
442
446
  # Convert data_probs back to numpy array (Pydantic stores as list)
443
- probs_array = np.array(gmm_info.condensed_data_probs if duplicate_labels else gmm_info.data_probs)
447
+ probs_array = np.array(gmm_info.condensed_data_probs if (duplicate_labels and has_duplicates) else gmm_info.data_probs)
444
448
  decision_boundaries = self._calculate_decision_boundaries_from_probs(
445
449
  feature_values=subset_data,
446
450
  data_probs=probs_array,
447
451
  ordered_labels=ordered_labels_processed,
448
452
  )
449
453
 
450
- # Assign new labels to subset cells
451
- new_labels = self._assign_labels_from_thresholds(
452
- data=subset_data,
453
- thresholds=decision_boundaries.thresholds,
454
- ordered_labels=ordered_labels_processed,
455
- )
454
+ # Assign new labels via per-cell argmax of the (possibly condensed)
455
+ # probability matrix. This is robust to overlapping components: when
456
+ # the threshold-derivation walk produces fewer than N-1 forward
457
+ # transitions (because backward transitions in the sorted-cell
458
+ # sequence get filtered), label assignment used to error out with
459
+ # "labels must equal thresholds + 1". decision_boundaries are still
460
+ # computed above and stored in internal_data for plotting / .uns
461
+ # introspection; only the cell-label assignment switches to argmax.
462
+ class_idx = np.argmax(probs_array, axis=1)
463
+ labels_arr = np.asarray(ordered_labels_processed)
464
+ new_labels = labels_arr[class_idx]
456
465
 
457
466
  # Update labels in-place
458
467
  self._update_labels_in_place(
@@ -469,7 +478,7 @@ class SequentialGMM(GaussianMixtureModelBase):
469
478
  gmm_info=gmm_info,
470
479
  ordered_gmm_labels=ordered_labels,
471
480
  decision_boundaries=decision_boundaries,
472
- condensed_labels=ordered_labels_processed if duplicate_labels else None,
481
+ condensed_labels=ordered_labels_processed if (duplicate_labels and has_duplicates) else None,
473
482
  feature_name=feature,
474
483
  gmm_obs_label=obs_label,
475
484
  )
File without changes
File without changes