vandijklab / CINEMA-OT

GNU Affero General Public License v3.0
26 stars 5 forks source link

A couple of questions! #7

Closed chriswzou closed 1 day ago

chriswzou commented 11 months ago

Thanks for putting together this package! I'm really excited to use it.

I had a couple of questions on how details from the paper end up being implemented in the code.

First, in the paper, we have the algorithm step $ITE ← X[z = 1]M − X[z = 0]$ that generates the ITE matrix. It seems that in the code, we implemented it like so:

te2 = adata.X.toarray()[adata.obs[obs_label]==ref_label,:] - np.matmul(ot_matrix/np.sum(ot_matrix,axis=1)[:,None],adata.X.toarray()[adata.obs[obs_label]==expr_label,:])

These two seem reversed. Does that mean that the ITE matrix generated from the code is the control / treatment as opposed to treatment / control? In general, we seem to generate an ITE matrix for the control instead of the experiment—am I reading this right? I might be thinking about it the wrong way.

Second, in the Jupyter notebook example, why is No stimulation passed in as the expr_label and IFNb passed in as the ref_label? It seems that the resulting de matrix contains perturbed cells, but only because we passed in the perturbation as the control group. So should it normally contain control cells only?

chriswzou commented 11 months ago

One more question, about the synergy score calculation:cinamot.synergy seems to take one of the treatments as a baseline for AB instead of taking the same no stimulation baseline as the others. I might be missing something—does this expression simplify to the synergy score described in the paper and implemented in the tutorial?

MingzeDong commented 10 months ago

Thank you for using the package! Sorry I somehow lost the Github notification on my email. For the first question, if we use expr_label as "No stimulation" and ref label as "IFNb", then the logic would be right and consistent with the manuscript. The only problem here is the names "expr_label" and "ref_label" are counterintuitive because of historical issues. I am not sure whether I should flip it in next versions as it can cause obvious conflicts. This is fixed in the pertpy version.

For the next question, our implemented approach in the code indeed can be simplified into the synergy score defined in the main text. Specifically, we compute 2 quantities: effect of AB minus B; effects of A minus baseline. If we project them in the same space (by optimal transport from B space to baseline space), then by a re-combination we get: (AB-B) - (A-0) = (AB-0) - (A-0) - (B-0).

Sorry again for the late reply and I would be happy to answer further questions.