Pegasus for Single Cell Analysis

PyPI PyPIDownload Conda Python License Docs Build

Pegasus is a tool for analyzing transcriptomes of millions of single cells. It is a command line tool, a python package and a base for Cloud-based analysis workflows.

Read documentation

Release Highlights in Current Stable

1.5.0 March 9, 2022

New Features

  • Spatial data analysis:

    • Enable pegasus.read_input function to load 10x Visium data: set file_type="visium" option.

    • Add pegasus.spatial function to generate spatial plot for 10x Visium data.

    • Add Spatial Analysis Tutorial in Tutorials.

  • Pseudobulk analysis: see summary

    • Add pegasus.pseudobulk function to generate pseudobulk matrix.

    • Add pegasus.deseq2 function to perform pseudobulk differential expression (DE) analysis, which is a Python wrapper of DESeq2.

      • Requires rpy2 and the original DESeq2 R package installed.

    • Add pegasus.pseudo.markers, pegasus.pseudo.write_results_to_excel and pegasus.pseudo.volcano functions for processing pseudobulk DE results.

    • Add Pseudobulk Analysis Tutorial in Tutorials.

  • Add pegasus.fgsea function to perform Gene Set Enrichment Analysis (GSEA) on DE results and plotting, which is a Python wrapper of fgsea.

    • Requires rpy2 and the original fgsea R package installed.

API Changes

  • Function correct_batch, which implements the L/S adjustment batch correction method, is obsolete. We recommend using run_harmony instead, which is also the default of --correct-batch-effect option in pegasus cluster command.

  • pegasus.highly_variable_features allows specify custom attribute key for batches (batch option), and thus remove consider_batch option. To select HVGs without considering batch effects, simply use the default, or equivalently use batch=None option.

  • Add dist option to pegasus.neighbors function to allow use distance other than L2. (Contribution by hoondy in PR 233)

    • Available options: l2 for L2 (default), ip for inner product, and cosine for cosine similarity.

  • The kNN graph returned by pegasus.neighbors function is now stored in obsm field of the data object, no longer in uns field. Moreover, the kNN affinity matrix is stored in obsp field.


  • Adjust pegasus.write_output function to work with Zarr v2.11.0+.