Coder Social home page Coder Social logo

Comments (4)

MingzeDong avatar MingzeDong commented on July 24, 2024

Hi, the individual treatment effect matrix is stored in the AnnData "de", which is an output of co.cinemaot.cinemaot_unweighted in the tutorial. Happy to answer further questions.

from cinema-ot.

domcke avatar domcke commented on July 24, 2024

Thanks so much for your quick response! I do have two questions:

  1. The main part that is not clear to me is how I can get the DE genes between the OT-matched perturbed and non-stimulated cells (not e.g. Monocyte vs rest within the perturbed group like in your example), since the "de" object only contains perturbed cells, and I accordingly can’t do e.g.
sc.tl.rank_genes_groups(de, 'perturbation', method='t-test')

I see that below you calculate

de_c = sc.AnnData(subset_mock.X.toarray()-de.X) ; where "de" in this case has the dimensions of "No stimulation", not the perturbed dimensions as above, and then you assign it the respective perturbation class.

I assume it would not be correct to do this for my purpose?:

response = adata_[adata_.obs['perturbation'].isin(['Control']),:]
sc.pp.pca(adata_)
cf, ot, de = co.cinemaot.cinemaot_unweighted(adata_,obs_label='perturbation', ref_label=‘Control', expr_label='Perturbation_X',mode='parametric',thres=0.5,smoothness=1e-4,eps=1e-2,preweight_label=None)
subset_mock = adata_[adata_.obs['perturbation'].isin(['Control']),:]
de_c = sc.AnnData(subset_mock.X.toarray()-de.X)
de_c.obs['perturbation'] = 'Perturbation_X'
de_c.var_names = subset_mock.var_names
response = sc.concat([response,de_c])
sc.pp.pca(response)
sc.pp.neighbors(response)
sc.tl.umap(response)
sc.tl.rank_genes_groups(response, 'perturbation', method='t-test’)

Any pointers on how to extract DE genes between OT-matched perturbed and non-stimulated cells would be appreciated!

  1. What is the preweight_label parameter in co.cinemaot.cinemaot_unweighted? I assume this normalizes across different cell numbers per cell type in your example. If I only have one cell type, but different experimental batches with different cell numbers but similar ratios of perturbed and control cells, I assume the correct setting here would be None?

Thanks for your help!

from cinema-ot.

MingzeDong avatar MingzeDong commented on July 24, 2024

To get the OT-matched unstimulated cells in the tutorial, you can use command "adata[adata.obs['perturbation'].isin(['IFNb'])].X-de.X". This returns the counterfactual population of unstimulated cells in the "stimulated space". For your purpose you can concatenate this matrix with the original normalized count matrix of the stimulated cells and do downstream DE analysis. This means your codes are actually right in your setting.

However, CINEMA-OT is designed for identifying causal pairs, and your implementation "sc.tl.rank_genes_groups" still uses the unpaired statistical test, in which case I anticipate using the CINEMA-OT won't make much difference. Instead, you may consider running paired statistical test (scipy.stats.wilcoxon) on the de matrix. This should be the correct way to identify differential expressed genes in your setting using CINEMA-OT. However, it should be noted that more theoretical work is needed for establishing the p-values accounting for the uncertainty of CINEMA-OT matching.

For the second question, in principle the experimental batch is also a confounder here. Therefore it is correct to set the preweight_label to be the batch label. However, if the ratios of perturbed and control cells are similar (as you described), the result should not be much different if we set the preweight label to None.

from cinema-ot.

domcke avatar domcke commented on July 24, 2024

Great, that is very helpful, thanks for clarifying!

from cinema-ot.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.