Skip to content

[feat] Add gene expression and cell types over time - #132

Merged
ehuan2 merged 10 commits into
li-lab-mcgill:mainfrom
ehuan2:eric/meta-metric
Jun 18, 2026
Merged

[feat] Add gene expression and cell types over time#132
ehuan2 merged 10 commits into
li-lab-mcgill:mainfrom
ehuan2:eric/meta-metric

Conversation

@ehuan2

@ehuan2 ehuan2 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Alongside with some OT-CFM fixes, we added the ability to measure gene expression and cell types over time.

ehuan2 added 9 commits June 12, 2026 14:33
This change makes it easier for the perturbation to be set going
forwards.
1. Cell type proportions return trajectory
2. Can properly measure trajectory => timepoints x cell types
3. Classifier renormalizes by default
4. We solve OT-CFM for renormalization
According to the cell type trajectory that's provided here.
We redid this so that later on it'll be easy to extend for the genes.
For the perturbation, we now plot the max and min expression over
cells as well, to get a better understanding of the distribution.
@ehuan2
ehuan2 requested a review from aosakwe June 17, 2026 16:29
This applies a global perturbation for data going from t to t + 1
Comment thread methods/ot_cfm/run.py
predicted_ann_data = sc.AnnData(predicted_x)
predicted_ann_data = log_normalize_to_counts(
undo_log_normalization(predicted_ann_data)
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what's the reason for this step? we would need to do this in all methods to remain consistent - were the count distributions completely off without it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah so OT-CFM would explode the counts otherwise, so clipping it and then renormalizing it was the best way to get it done properly

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok do we reckon we do it for all methods or on a case-by-case?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess I can go through the others and see if it's a recurring issue - if so it's worth raising as a general problem or highlighting as just an OT-CFm thing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ouhh yeah good idea, actually I think something that would be good generally would be to move everything (generate_next_gex, etc.) to rely on a separate move_gex_t_t1 instead. Will raise this in an issue, and then we can force it to be an all methods thing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Which is done here: #127

@aosakwe aosakwe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM - just see comment about the un-norm + log-norm step in the loop

@ehuan2
ehuan2 merged commit 7ee1485 into li-lab-mcgill:main Jun 18, 2026
1 check passed
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