Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor eigdecomp phasing and sorting #397

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nvictus
Copy link
Member

@nvictus nvictus commented Oct 17, 2022

Some work to modularize various sub-operations in eigdecomp.

  • Decouple target matrix preparation from decomposition. Might make it easier to provide different target matrix options (e.g. balanced vs unbalanced O/E, mean-centered vs 1-centered, fake-cis vs other approach).

  • Decouple deterministic sign flipping (providing phasing_track) and reordering/sorting (reorder=True). Both options will make use of corr_metric if activated, which defaults to pearsonr.

@nvictus nvictus requested review from golobor and gfudenberg October 17, 2022 17:39
@@ -171,7 +171,6 @@ def eigs_cis(
clr_weight_name=clr_weight_name,
ignore_diags=ignore_diags,
clip_percentile=99.9,
sort_metric=None,
)
Copy link
Member

Choose a reason for hiding this comment

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

is this desired? this issue suggests to expose sort_metric #311

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed it to be replaced with corr_metric (used for both flipping and reordering) and reorder instead.

Copy link
Member

Choose a reason for hiding this comment

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

aha, gotcha-- thoughts on phasing_metric or phasing_corr_metric to help remind the user what this is for?


# Go through eigendecomposition results and fill in output tables.
for _region, _eigvals, _eigvecs in results:
idx = bioframe.select(eigvec_table, _region).index
Copy link
Member

Choose a reason for hiding this comment

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

isn't there a duplication?

This comment was marked as resolved.

Copy link
Member

@sergpolly sergpolly left a comment

Choose a reason for hiding this comment

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

  • imho it'd be nice to align cis and trans function a bit - to minimize confusion
  • cli argument regarding sorting/phasing needs to be sorted out

other than that seems to be a useful refactoring !

cooltools/api/eigdecomp.py Show resolved Hide resolved

# Go through eigendecomposition results and fill in output tables.
for _region, _eigvals, _eigvecs in results:
idx = bioframe.select(eigvec_table, _region).index

This comment was marked as resolved.

cooltools/api/eigdecomp.py Show resolved Hide resolved
cooltools/api/eigdecomp.py Show resolved Hide resolved
sergpolly added a commit to sergpolly/cooltools that referenced this pull request Nov 24, 2023
few tweaks and reorderings in eigdecomp to address my comments in open2c#397
Copy link
Member

@sergpolly sergpolly left a comment

Choose a reason for hiding this comment

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

submitted suggested changes nvictus#2

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.

4 participants