Skip to content

Heiser analysis figures#12

Closed
nbedanova wants to merge 13 commits intomainfrom
Heiser-Analysis
Closed

Heiser analysis figures#12
nbedanova wants to merge 13 commits intomainfrom
Heiser-Analysis

Conversation

@nbedanova
Copy link
Contributor

@aarmey Added a few figures to look at deviance transform factorization. When importing the Heiser data using the import_Heiser() function, you can include argument import_Heiser(deviance=True) to use deviance transformation code to prepare the dataset. Default is false and will just do our typical normalization.

"/home/nicoleb/'C3TAg_50" Is the factorization with our typical normalization with rank 50.

Aaron Meyer added 2 commits May 15, 2025 12:34
ranksList: list[int],
runs: int,
):
# Plots FMS when using different Pf2 components comparing the deviance transformed data vs how we usually normalize
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be able to reuse code that calculates the FMS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rewrote this as I was thinking to calculate FMS between the factorization results using the deviance transform vs our previous normalization method, not by bootstrapping. In hindsight not sure if this will actually tell us much.

# Plots FMS when using different Pf2 components
fmsLists = []

for j in range(0, runs, 1):
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this should go in a non-figure file. Also, separate calculation from plotting.

dataX = pf2(X, rank, doEmbedding=False)

fmsLists = []

Copy link
Member

Choose a reason for hiding this comment

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

Seems like this should go in a non-figure file. Also, separate calculation from plotting.


non_y_ij = n_i[:, None] - y_ij
mu_ij = n_i[:, None] * pi_j[None, :]
signs = np.sign(y_ij - mu_ij[None, :])
Copy link
Member

Choose a reason for hiding this comment

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

@nbedanova I had an error in my code here. I thought I had passed along the fix, but apparently not. This is now correct, so see if it changes the results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok will redo analysis, thanks!

X.obs["condition_unique_idxs"] = X.obs["condition_unique_idxs"].astype("category")

# Pre-calculate gene means
X.var["means"] = np.zeros(X.shape[1])
Copy link
Member

Choose a reason for hiding this comment

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

There shouldn't be a need to subtract off the mean with this transformation—it is already centered at the MLE.

@nbedanova nbedanova marked this pull request as ready for review June 26, 2025 22:33
@nbedanova nbedanova requested a review from Copilot June 26, 2025 22:34
Copy link
Contributor

Copilot AI left a comment

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 enhances data import functionality by introducing an optional deviance transformation and updates various dependency versions and figure plotting parameters. Key changes include:

  • Adding deviance transformation support to the import_Heiser() function with a new prepare_dataset_deviance() helper.
  • Updating dependency version constraints in pyproject.toml and adjusting file paths in figure scripts.
  • Removing the gating.py module.

Reviewed Changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.

File Description
pyproject.toml Upgraded Python and dependency versions.
pf2rnaseq/imports.py Added deviance transformation function and adjusted imports.
Multiple figure files Updated rank ranges, file paths, and plotting function parameters.
pf2rnaseq/gating.py File removed.

@nbedanova
Copy link
Contributor Author

nbedanova commented Jun 26, 2025

Fixed suggested changes including moving FMS calculation out of figure files and into plotGeneral. Although perhaps the FMS calculation should instead be moved to the factorization file? Renamed the 50 rank factorization to "/home/nicoleb/C3TAg_50". Fixed docstring. Deleted some files that are from previous analysis that I have not used (ie. CITEseq files). I upgraded packages from main and there was an incompatibility with datashader so also updated that.

nbedanova and others added 4 commits June 26, 2025 15:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@aarmey aarmey left a comment

Choose a reason for hiding this comment

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

Please split this into separate branches and PRs that address one thing. This has gotten too large and unreviewable.

@nbedanova nbedanova changed the title Heiser Deviance Figures Updating pf2 and packages Jun 27, 2025
@nbedanova nbedanova changed the title Updating pf2 and packages Heiser analysis figures Jun 27, 2025
@nbedanova nbedanova closed this Jul 21, 2025
@nbedanova nbedanova deleted the Heiser-Analysis branch October 16, 2025 23:58
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