Home

Awesome

CellPhoneDB

:warning: We have updated CellPhoneDB to v3 and migted CellPhoneDB to a new repository. <br> Please refer to ventolab/CellphoneDB for the most up to date version.

What is CellPhoneDB?

CellPhoneDB is a publicly available repository of curated receptors, ligands and their interactions. Subunit architecture is included for both ligands and receptors, representing heteromeric complexes accurately. This is crucial, as cell-cell communication relies on multi-subunit protein complexes that go beyond the binary representation used in most databases and studies.

CellPhoneDB integrates existing datasets that pertain to cellular communication and new manually reviewed information. Databases from which CellPhoneDB gets information are: UniProt, Ensembl, PDB, the IMEx consortium, IUPHAR.

CellPhoneDB can be used to search for a particular ligand/receptor, or interrogate your own single-cell transcriptomics data.

Starting to use CellPhoneDB

To start using CellPhoneDB, you can use our interactive web application (cellphonedb.org) and run in the analysis in our private cloud, or just run CellPhoneDB with your own computational resources. (The latter is preferable if you are going to work with big datasets).

Installing CellPhoneDB

NOTE: Works with Python v3.6 or greater. If your default Python interpreter is for v2.x (you can check it with python --version), calls to python/pip should be substituted by python3/pip3.

We highly recommend using an isolated python environment (as described in steps 1 and 2) using conda or virtualenv but you could of course omit these steps and install via pip immediately.

  1. Create python=>3.6 environment
  1. Activate environment
  1. Install CellPhoneDB pip install cellphonedb

Running CellPhoneDB Methods

Please, activate your environment if you didn't previously

To use the example data, please download meta/counts test data. i.e.

curl https://raw.githubusercontent.com/Teichlab/cellphonedb/master/in/example_data/test_counts.txt --output test_counts.txt
curl https://raw.githubusercontent.com/Teichlab/cellphonedb/master/in/example_data/test_meta.txt --output test_meta.txt

Note: counts file can be a text file or h5ad (recoommended), h5 or a path to a folder containing mtx/barcode/features.

Example with running the statistical method

cellphonedb method statistical_analysis test_meta.txt test_counts.txt

Example without using the statistical method

Using text files

cellphonedb method analysis test_meta.txt test_counts.txt 

Using h5ad count file

cellphonedb method analysis test_meta.txt test_counts.h5ad

Please check the results documentation in order to understand the results.

Optional Parameters

~ Optional Method parameters:

~ Optional Method Statistical parameters

Usage Examples

Set number of iterations and threads

cellphonedb method statistical_analysis yourmetafile.txt yourcountsfile.txt --iterations=10 --threads=2

Set project subfolder

cellphonedb method analysis yourmetafile.txt yourcountsfile.txt --project-name=new_project

Set output path

mkdir custom_folder
cellphonedb method statistical_analysis yourmetafile.txt yourcountsfile.txt --output-path=custom_folder

Subsampling

cellphonedb method analysis yourmetafile.txt yourcountsfile.txt --subsampling --subsampling-log false --subsampling-num-cells 3000

Plotting statistical method results

In order to plot results from the statistical methods, you need to run it first.

Currently there are two plot types available: dot_plot & heatmap_plot

Once you have the needed files (means & pvalues) you can proceed as follows:

cellphonedb plot dot_plot
cellphonedb plot heatmap_plot yourmeta.txt

dot_plot

This plot type requires ggplot2 R package installed and working

You can tweak the options for the plot with these arguments:

Available output formats are those supported by R's ggplot2 package, among others they are:

This format will be inferred from the --output-name argument

To plot only desired rows/columns (samples for rows and columns based in example data files):

cellphonedb plot dot_plot --rows in/rows.txt --columns in/columns.txt

heatmap_plot

This plot type requires pheatmap R package installed and working This plot type includes two features count & log_count

You can tweak the options for the plot with these arguments:

Available output formats are those supported by R's pheatmap package, among others they are:

This format will be inferred from the --count-name & --log-name arguments.

Using different database versions

CellPhoneDB databases can be updated from the remote repository through our tool. Furthermore, available versions can be listed and downloaded for use.

To use one of those versions, a user must provide the argument --database <version_or_file> to the method to be executed.

If the given parameter is a readable database file, it will be used as is. Otherwise it will use some of the versions matching the selected version.

If the selected version does not exist in the local environment it will be downloaded from the remote repository. (See below.) If no --database argument is given in methods execution, it will use the latest local version available.

Downloaded versions will be stored in a user folder under ~/.cpdb/releases

Listing remote available versions

The command to list available versions from the remote repository is:

cellphonedb database list_remote

Listing local available versions

The command to list available versions from the local repository is:

cellphonedb database list_local

Download version

The command to download a version from the remote repository is:

cellphonedb database download

or

cellphonedb database download --version <version_spec|latest> 

whereby version_spec must be one of the listed in the database list_remote command. If no version is specified or latest is used as a version_spec, the newest available version will be downloaded

Generating user-specific custom database

A user can generate custom databases and use them. In order to generate a new database, a user can provide his/her own lists.

These lists can be: genes, proteins, complexes and/or interactions. In the generation process they will get merged with the ones from the CellPhoneDB release sources. The user lists have higher precedence than the ones included in CellPhoneDB package.

To generate such a database the user has to issue this command:

cellphonedb database generate  

Generate specific parameters:

Result database file is generated in the folder out with cellphonedb_user_{datetime}.db. The user defined input tables will be merged with the current CellPhoneDB input tables. To use this database, please use --database parameter in methods. E.g:

 cellphonedb method statistical_analysis in/example_data/test_meta.txt in/example_data/test_counts.txt --database out/cellphonedb_user_2019-05-10-11_10.db

Examples for user-specific custom database

  1. To add or correct some interactions

    Input:

    • your_custom_interaction_file.csv: Comma separated file (use mandatory columns!) with interactions to add/correct.

    Command:

    cellphonedb database generate --user-interactions your_custom_interaction_file.csv 
    

    Result:

    New database file with CellPhoneDB interactions + user custom interactions. For duplicated interactions, user lists overwrite the CellPhoneDB original data.

  2. To use only user-specific interactions

    Input:

    • your_custom_interaction_file.csv: Comma separated file (use mandatory columns!) with interactions to use.

    Command:

    cellphonedb database generate --user-interactions your_custom_interaction_file.csv --user-interactions-only
    

    Result:

    New database file with only user custom interactions.

  3. To correct any protein data

    Input:

    • your_custom_protein_file.csv: Comma separated file (use mandatory columns!) with proteins to overwrite.

    Command:

    cellphonedb database generate --user-protein your_custom_protein_file.csv 
    

    Result:

    New database file with CellPhoneDB interactions + user custom interactions. For duplicated interactions or proteins, user lists overwrite the CellPhoneDB original data.

  4. To add some interactions and correct any protein data

    Input:

    • your_custom_interaction_file.csv: Comma separated file (use mandatory columns!) with interactions to add/correct.
    • your_custom_protein_file.csv: Comma separated file (use mandatory columns!) with proteins to overwrite.

    Command:

    cellphonedb database generate --user-interactions your_custom_interaction_file.csv --user-protein your_custom_protein_file.csv 
    

    Result:

    New database file with CellPhoneDB interactions + user custom interactions. On duplicated interactions or proteins, user list overwrites CellPhoneDB original data.

  5. To update remote sources (UniProt, IMEx, ensembl, etc.)

    IMPORTANT

    This command uses external resources allocated in external servers. The command may not end correctly if external servers are not available. The timing of this step depends on external servers and the user's internet connection and can take a lot of time.

    Input:

    • your_custom_interaction_file.csv: Comma separated file (use mandatory columns!) with interactions to add/correct.
    • your_custom_protein_file.csv: Comma separated file (use mandatory columns!) with proteins to overwrite.

    Command:

    cellphonedb database generate --fetch 
    

    Result:

    New database file with CellPhoneDB interactions + user custom interactions. For duplicated interactions or proteins, user lists overwrite the CellPhoneDB original data.

Some lists can be downloaded from original sources while creating the database, e.g. uniprot, ensembl. By default, the snapshots included in the CellPhoneDB package will be used---to enable a fresh copy --fetch must be appended to the command.

In order to use specific lists those can be specified like this --user-protein, --user-gene, --user-complex, --user-interactions, --user-interactions-only followed by the corresponding file path.

The database file can be then used as explained below. The intermediate lists used for the generation will be saved along the database itself.

As the lists are processed, then filtered, and lastly collected, two versions may exist: _generated is the unfiltered one whereas _input is the final state prior being inserted in the database.

Contributing to CellPhoneDB

CellPhoneDB is an open-source project. If you are interested in contributing to this project, please let us know.

You can check all project documentation in the Docs section