Skip to content

Interface for the several tools that predict cells communication from Single-Cell RNA sequencing data

License

Notifications You must be signed in to change notification settings

VladimirShitov/communiquer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

communiquer

A simple interface for the tools that predict cells communication from Single-Cell RNA sequencing data

Installation for the development

  1. Clone the repository
$ git clone https://github.com/VladimirShitov/communiquer.git
  1. Install poetry. Recommended way:
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

Alternative way (not recommended):

$ pip install --user poetry
  1. Install project's python dependencies:
$ poetry install
  1. Install tools for inferring cells communications. Follow the instructions from the repositories:

Make sure that cellphonedb is added to the PATH (i. e. you can run it via command line from any directory)

  1. Run the code!

Examples

Preparation

Import packages:

from pathlib import Path

from communiquer.launchers import CellChatLauncher, CellPhoneDBLauncher
from communiquer.drawing import draw_chord_diagram

Provide paths to the data. You have to prepare 2 files:

  1. Normalized counts matrix. Rows are genes, columns are barcodes (or other cells IDs
  2. Meta information about cells. It must have 2 columns: the first one with cell IDs (e.g. barcodes), and the second with cells labels (e.g. cell types)
counts_path = Path("data/pbmc3k_counts.tsv")
meta_path = Path("data/pbmc3k_meta.txt")

cpdb_output_path = Path("data/cpdb_output")

Example of the meta file:

Cell cell_type
AAACATACAACCAC-1 RPS expressing
AAACATTGAGCTAC-1 B
AAACATTGATCAGC-1 CD4 T
AAACCGTGCTTCCG-1 CD14 Monocytes
AAACCGTGTATGCG-1 NK
...

Running CellPhoneDB

cpdb_launcher = CellPhoneDBLauncher(
    meta_file_path=meta_path,
    counts_file_path=counts_path,
    output_path=cpdb_output_path,  # CellPhoneDB saves its output to the files
    project_name="pbmc3k",
    counts_data="gene_name"  # If you have Ensemble IDs, leave default
)
cpdb_launcher.run()
cpdb_launcher.read_output(convert_to_cellchat_format=True)

Then you can display the output by checking:

cpdb_launcher.pvalues_df
cpdb_launcher.means_df

To see outputs of this code, check example notebook

Count significant interactions and build a chord diagram with them:

cpdb_launcher.count_significant_interactions() # This sets cpdb_launcher.counts_df
cpdb_launcher.visualise_interactions()

cellphoneDB cells communications

Or a dot plot:

cellphoneDB cells communications_dotplot

Running CellChat

cellchat_launcher = CellChatLauncher(counts_file_path=counts_path, meta_file_path=meta_path)
cellchat_launcher.run()
cellchat_launcher.read_output()

You can then view the output:

cellchat_launcher.weights_df
cellchat_launcher.pvalues_dfs
cellchat_launcher.probabilities_dfs

Cellchat stores every interaction in a different matrix. You can access these interactions by name:

cellchat_launcher.pvalues_dfs["ESAM_ESAM"]

Check the outputs in the example notebook

You can run visualisations with the same interface:

cellchat_launcher.visualise_interactions()

cellchat cells communications

cellchat_launcher.dotplot_counts()

cellchat cells communications_dot_plot

About

Interface for the several tools that predict cells communication from Single-Cell RNA sequencing data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published