Skip to content

Reject inputs without CLR compositional variation - #1

Open
RonitBStudent wants to merge 1 commit into
pachterlab:mainfrom
RonitBStudent:fix/reject-degenerate-clr-input
Open

Reject inputs without CLR compositional variation#1
RonitBStudent wants to merge 1 commit into
pachterlab:mainfrom
RonitBStudent:fix/reject-degenerate-clr-input

Conversation

@RonitBStudent

Copy link
Copy Markdown

Summary

  • reject inputs with no compositional variation after the CLR transform
  • add a regression test using samples that differ only by total library size
  • run the unit-test suite in the existing verification workflow

Rows with identical feature proportions have no meaningful circular projection after CLR. Previously, floating-point noise could produce arbitrary near-zero coordinates and a misleading finite rho value instead of surfacing that condition.

Validation

  • python3 -m unittest discover -s tests -p 'test_*.py' -v
  • PYTHONPATH=. python3 -m clrcycle tests/data/toy_cycle.csv --output-dir <tmp> --all-features --n-swaps 20

Copilot AI review requested due to automatic review settings August 3, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a guard in fit() to reject inputs whose samples have no meaningful compositional variation after the CLR transform (i.e., samples differ only by total library size), preventing misleading near-zero projections and finite rho values caused by floating-point noise.

Changes:

  • Add a numerical-tolerance check after CLR-centering to detect and reject “no compositional variation” inputs.
  • Add a regression unit test covering scale-only sample matrices.
  • Update the GitHub Actions verification workflow to run the unit test suite.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
clrcycle/__init__.py Adds tolerance-based detection and raises a clear ValueError when CLR-centered variation is effectively zero.
tests/test_clrcycle.py Adds a regression test ensuring scale-only samples are rejected.
.github/workflows/verify.yml Runs unittest discovery as part of CI verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants