Coder Social home page Coder Social logo

cinema-ot's Introduction

Causal INdependent Effect Module Attribution + Optimal Transport (CINEMA-OT)

CINEMA-OT is a causal framework for perturbation effect analysis to identify individual treatment effects and synergy at the single cell level.

Architecture

image

Read our preprint on bioRxiv:

System requirements

Hardware requirements

CINEMA-OT requires only a standard computer with enough RAM to perform in-memory computations.

OS requirements

The CINEMA-OT package is supported for all OS in principle. The package has been tested on the following systems:

  • macOS: Monterey (12.4)
  • Linux: RHEL Maipo (7.9), Ubantu (18.04)

Dependencies

See setup.cfg for details.

Installation

CINEMA-OT requires python version 3.7+. Install directly from pip with:

pip install cinemaot

The installation should take no more than a few minutes on a normal desktop computer.

Usage

For detailed usage, follow our step-by-step tutorial here:

Download the data used for the tutorial here:

cinema-ot's People

Contributors

mingzedong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cinema-ot's Issues

R code for labeled volcano plot

Got the package working nicely...great work on the package! Might you be willing to share the python/R code for generating the labeled volcano plot?

Question about typebatch

Thank you for creating this great package!

I have a question based on your tutorial https://github.com/vandijklab/CINEMA-OT/blob/main/cinemaot_tutorial.ipynb, and my question is about the "typebatch".

If I understand the process correctly, after running CINEMIA-OT, you clustered cells based on the response matrix, and they fell into two clusters (i.e., typebatches), CD4 T cells and monocytes, in your example. However, in the graph on the right, which was colored by original cell type, there are multiple other cell types.

My questions is, what does "typebatch" mean here? Why there are only two cell types in the typebatch variable, when there are multiple other cell types? Does this mean that CD4 T cells and monocytes are main ones driving the classification of typebatches, cells with similar response were clustered in the same cluster, and therefore the typebatches were named after the main cell types in the batch? Based on this result, can I say that CD4 T cells and monocytes are the ones that are most responsive to the treatment (and therefore can be considered as interventional targets)?

A couple of questions!

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?

Individual treatment effect matrices

It is not clear to me from the tutorial how to extract the cell x gene 'Individual treatment effect' matrices for downstream clustering, DE analysis etc. Would you mind sharing some code for that? Thanks!

module 'cinemaot' has no attribute 'utils'

Hi
After reading your paper, I thought it was a very useful tool, so I'm using it for my data.
Installation proceeded without problem, but the error below occurred :

co.utils.assignleiden(de,'celltype','leiden','typebatch')
AttributeError: module 'cinemaot' has no attribute 'utils'

I'll be waiting for your feedback. Thank you.

Can't import cinemaot module after pip install from git

Hi CINEMA-OT team,

First off, thanks for releasing your method in such a nice package! I'm excited to try it out on some scRNA-seq data that I've been working with.

I'm opening this issue to flag some potential issues with your package setup: In particular, this morning I tried to install the CINEMA-OT package in a clean conda environment using the instructions in the README (i.e., the pip+git command). The command runs without any errors, however I'm still not able to import the cinemaot module. When I look in my conda environment's site-packages directory, I see that a folder cinemaot-0.0.1.dist-info has been created, though the package itself is missing (I would expect another folder just named cinemaot).

I'm able to successfully import CINEMA-OT's dependencies (scanpy etc.), so I think there may be a problem somewhere in the structure of the package.

install error

Enjoyed reading your paper and excited to try this approach. On install I got the following error. Seems like an easy fix but wanted to bring it to your attention:


$ pip install cinemaot
Collecting cinemaot
  Obtaining dependency information for cinemaot from https://files.pythonhosted.org/packages/aa/90/8401068c8bfc6e318dcb0aaeb5a3fdc84146743550e820d760f5c7729b34/cinemaot-0.0.4-py3-none-any.whl.metadata
  Using cached cinemaot-0.0.4-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: numpy in ./anaconda3/lib/python3.11/site-packages (from cinemaot) (1.24.4)
Requirement already satisfied: pandas in ./anaconda3/lib/python3.11/site-packages (from cinemaot) (2.1.1)
Requirement already satisfied: scanpy in ./anaconda3/lib/python3.11/site-packages (from cinemaot) (1.9.6)
Collecting sklearn (from cinemaot)
  Using cached sklearn-0.0.post11.tar.gz (3.6 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
      rather than 'sklearn' for pip commands.
      
      Here is how to fix this error in the main use cases:
      - use 'pip install scikit-learn' rather than 'pip install sklearn'
      - replace 'sklearn' by 'scikit-learn' in your pip requirements files
        (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
      - if the 'sklearn' package is used by one of your dependencies,
        it would be great if you take some time to track which package uses
        'sklearn' instead of 'scikit-learn' and report it to their issue tracker
      - as a last resort, set the environment variable
        SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error
      
      More information is available at
      https://github.com/scikit-learn/sklearn-pypi-package
      
      If the previous advice does not cover your use case, feel free to report it at
      https://github.com/scikit-learn/sklearn-pypi-package/issues/new
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

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.