Compositional Analysis

Learn how to do a compositional analysis using stacked bar plot and how to create analyses that are customized to your research experiment

A compositional analysis can be used to investigate the proportion of cell types in different sample, disease conditions, or any variable of interest in the experiment.

Cell proportions using stacked bar plot

With stacked bar plots you can visualise the proportion of cell types of other groups.

In this example, we will look at proportion of cell types in COVID and healthy samples i.e. the proportion of cell types in healthy and disease groups.

Prerequisites

Before starting make sure you have completed these steps

  1. Run an analysis on your dataset
  2. Add metadata - disease conditions, treatments, tissue or other groups in the experimental design for the research project
  3. Annotate clusters with cell types - this step can be achieved quickly through Nygen Insights auto annotations, or with manual annotation.

Steps

1. From the explorer page, open the stacked bar plot panel.

2. Select the primary and secondary variable. The primary variable will be shown on the x-axis and the secondary variable will be shown as the stacked values for each of the category in the primary variable.

3. Here in this example, we look at the cell types of different disease conditions: COVID-19 and healthy. The stacked bar can be used to quickly visualise the proportions of the cell types in percentages of cells.

4. The stacked bar plot can be customised to highlight specific groups of interest, the statistical data will not be affected. You can learn more about stacked bar plots from this demo: Stacked bar plot

💡 Extra tips:

What if I want to compare cells using multiple conditions? For example, I have samples from different tissues (blood and bone marrow) and different conditions (disease and healthy ) and I want to visualise the cell type composition in only blood samples with both disease and healthy condition.

Example steps:

  • You can use Selections to create and save groups of cells from multiple conditions, example ‘healthy blood sample’ and ‘disease blood sample’.
  • Create a new custom categorical from the selections (Learn more on: Cell Selections and Custom Categories)
  • Use the Hide cells function to hide any uncategorised cells that are not of interest, this will hide them from the plot in the next step. Use Stacked bar to plot the custom categorical and cell type.

Yi Su

Bioinfomatician