Coder Social home page Coder Social logo

ccplotr's Introduction

CCPlotR

A small R package for visualising results from tools that predict cell-cell interactions from scRNA-seq data

This R package makes generic plots that can be used to visualise results from multiple tools such as Liana, CellPhoneDB, NATMI etc. All it requires as input is a dataframe with columns source, target, ligand, receptor and score. It should look something like this:

source target ligand receptor score
B CD8 T HLA-DQA1 LAG3 7.22
B CD8 T HLA-DRA LAG3 5.59
CD8 T NK B2M KIR2DL3 5.52
B CD8 T HLA-DQA2 LAG3 5.41
NK B LGALS1 CD69 4.15
B CD8 T ICAM3 ITGAL 2.34

For some of the plots, there is an option to also show the expression of the ligands and receptors in each cell type. For those plots, a second dataframe is required, which holds the mean expression values for each gene in each cell type and should look something like this:

cell_type gene mean_exp
B ACTR2 0.363
B ADA 0.0170
B ADAM10 0.0833
B ADAM28 0.487
B ADCY7 0.0336
B ADRB2 0.0178

The package comes with toy datasets (toy_data, toy_exp) which you can see for examples of input data.


Installation

The R package can be installed by running:

# install development version
devtools::install_github("Sarah145/CCPlotR")

# or install from Bioconductor
if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}

BiocManager::install("CCPlotR")

Plot types

The package contains functions for making six types of plots: cc_heatmap, cc_dotplot, cc_network, cc_circos, cc_arrow and cc_sigmoid. Below are some examples of each plot type.

Heatmaps (cc_heatmap)

This function can generate heatmaps in four different styles. Option A just displays the total number of interactions between each pair of cell types and option B shows the ligands, receptors and cell types involved in each interaction as well as their score. For option B, only a small portion of top interactions are shown to avoid cluttering the plot. There is also an option to generate heatmaps in the style of popular cell-cell interaction prediction tools such as CellPhoneDB and Liana.

library(CCPlotR)
data(toy_data, toy_exp, package = 'CCPlotR')
cc_heatmap(toy_data)
cc_heatmap(toy_data, option = 'B', n_top_ints = 10)
cc_heatmap(toy_data, option = 'CellPhoneDB')

Dotplots (cc_dotplot)

This function can generate dotplots in four different styles. Option A just displays the total number of interactions between each pair of cell types and option B shows the ligands, receptors and cell types involved in each interaction as well as their score. For option B, only a small portion of top interactions are shown to avoid cluttering the plot. There is also an option to generate dotplots in the style of popular cell-cell interaction prediction tools such as CellPhoneDB and Liana.

cc_dotplot(toy_data)
cc_dotplot(toy_data, option = 'B', n_top_ints = 10)
cc_dotplot(toy_data, option = 'Liana', n_top_ints = 15)

Network (cc_network)

This function can generate two different types of network plots. In option A, the nodes are cell types and the weight of the edges corresponds to the total number of interactions between a given pair of cell types. In option B, the nodes are ligand and receptor genes, coloured by which cell type is expressing them. For option B, only a small portion of top interactions are shown to avoid cluttering the plot.

cc_network(toy_data)
cc_network(toy_data, colours = c('orange', 'cornflowerblue', 'hotpink'), option = 'B')

Circos plot (cc_circos)

This function can generate three different types of circos plots. Option A generates a circos plot where the width of the links represents the total number of interactions between each pair of cell types. Option B generates a circos plot showing the ligands, receptors and cell types involved in the top portion of interactions. Option C expands on option B by also showing the mean expression of the ligand and receptor genes in each cell type. In options B and C, the weight of the links represents the score of the interaction.

cc_circos(toy_data)
cc_circos(toy_data, option = 'B', n_top_ints = 10)
cc_circos(toy_data, option = 'C', n_top_ints = 15, exp_df = toy_exp, cell_cols = c(`B` = 'hotpink', `NK` = 'orange', `CD8 T` = 'cornflowerblue'), palette = 'PuRd')

Paired arrow plot (cc_arrow)

This function generates plots showing the interactions between a given pair of cell types. Option A just shows which ligands/receptors are interacting between a pair of cell types and option B also shows the expression of the ligand/receptor genes in each cell type. In both options, the weight of the arrow represents the score of the interaction.

cc_arrow(toy_data, cell_types = c('B', 'CD8 T'), colours = c(`B` = 'hotpink', `CD8 T` = 'orange'))
cc_arrow(toy_data, cell_types = c('NK', 'CD8 T'), option = 'B', exp_df = toy_exp, n_top_ints = 10, palette = 'OrRd')

Sigmoid plot (cc_sigmoid)

This function plots a portion of interactions using the geom_sigmoid function from the ggbump R package to connect ligands in sender cells to receptors in receiver cells.

cc_sigmoid(toy_data)

ccplotr's People

Contributors

sarah145 avatar

Stargazers

 avatar  avatar SNP avatar  avatar  avatar  avatar Zhaoyu Guo avatar DONGZHU avatar Paul Myers avatar StarFall avatar Bin avatar  avatar Alex avatar melvin luo avatar  avatar Zhe Pan avatar Andrew Allen Bruce avatar  avatar Sora Yonezawa avatar Enes Daşdemir avatar Gina Reynolds avatar antx avatar CHEN_Yu avatar James Ward avatar Evan Rosa-Roseberry, MS avatar Paul L. Maurizio avatar Mark Keller avatar Kamil Slowikowski avatar Darek Kedra avatar Clint Valentine avatar Dimitris Polychronopoulos avatar Xue Huiwen avatar Markus Joppich avatar  avatar

Watchers

 avatar

Forkers

szegezdilab

ccplotr's Issues

legend error in cc_dotplot for option CellPhoneDB

Hi,

When using cc_dotplot(toy_data, option = 'CellPhoneDB', n_top_ints = 15) to generate a dotplot, the color order and the size of the circles in the legend representing the score are exactly opposite to what is displayed in the plot. Could you take a look at this?

image

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.