scverse/pertpy-tutorials

Add synergy to CINEMA-OT example

Closed this issue · 2 comments

Since the full CINEMA-OT dataset (containing all three stimulations) is now available via a dataloader (or will be as soon as the PR is merged), I would suggest adding a section on synergy in the tutorial. The example provided in the documentation demonstrates the general usage but doesn't illustrate how to downstream process the result of the synergy method.

The following code can be used for the tutorial:

adata = pt.dt.cinemaot_full()
sc.pp.pca(adata)
model = pt.tl.Cinemaot()
combo = model.synergy(adata,pert_key='perturbation',base='No stimulation',A='IFNb',B='IFNg',AB='IFNb+ IFNg',thres=0.5,smoothness=1e-5,eps=1e-3,solver='Sinkhorn')
sc.pp.pca(combo)
sc.pp.neighbors(combo)
sc.tl.umap(combo)
synergyscore = np.linalg.norm(combo.X[:,np.abs(np.mean(combo.X,axis=0))>0.15],axis=1)
sc.pl.umap(combo,color=['cell_type0528'],wspace=0.5,size=0.3*synergyscore**2)

That'd be great! @MingzeDong do you have an opinion or suggestion here?

Yes that would be great. The code should work as a minimal example for illustrating the synergy workflow.