Skip to main content

A tool for comparing populations in single-cell RNA-seq data with average overlap of marker gene lists

Project description

sc_average_overlap

A Python package for comparing clusters in single-cell RNA-seq data using the average overlap metric. This package is designed to work seamlessly with the Scanpy toolkit.

Getting Started

We recommend a Python version of 3.9.0+ in order to use the package.

Installation

Currently, the sc_average_overlap package may be downloaded from TestPyPI.

pip install -i https://test.pypi.org/simple/ sc-average-overlap

Instructions for Use

The functions in this package assume an AnnData object that contains group labels for the cells, and that differential expression analysis with sc.tl.rank_genes_groups() has been performed.

First you may import the sc_average_overlap package as follows:

import sc_average_overlap as ao

make_ao_dendrogram()

def make_ao_dendrogram(
	adata: AnnData,
	groupby: str,
	linkage_method: str = 'complete',
	de_key: str = 'rank_genes_groups',
	key: str = None, 
	genes_to_filter: List = None
) 

Given an AnnData object adata as input, this will first calculate pairwise average overlap scores for the clusters defined by the groupby parameter. You may specify a list of curated genes with the genes_to_filter argument, in which case all average overlap scores are based on the rankings of the user-specified gene list for each cluster.

Once this function is called, dendrogram information is saved into the AnnData. You may use Scanpy's plotting functions and specify the use of the average overlap dendrogram saved in the AnnData object.

An example function call:

ao.make_ao_dendrogram(adata, groupby='leiden')
ao.make_ao_dendrogram(adata, groupby='leiden', genes_to_filter=marker_gene_set) # providing a list of genes in marker_gene_set

plot_ao_dendrogram()

def plot_ao_dendrogram(
	adata: AnnData,
	key: str
)

Once make_ao_dendrogram has been called, you may plot the resulting cluster tree. key should be the name of the observations grouping used during DE gene analysis and when calling make_ao_dendrogram to make the tree.

An example function call:

ao.plot_ao_dendrogram(adata, key='leiden')

plot_ao_heatmap()

def plot_ao_heatmap(
	adata: AnnData,
	key: str,
	plot_zscores: bool = False,
	annot_decimal_format: str = '.1g'
)

You can plot a heatmap of all pairwise average overlap scores computed by calling the plot_ao_heatmap function. key should be the name of the observations grouping used during DE gene analysis and when calling make_ao_dendrogram to make the tree.

You can also plot the distances converted into z-scores. Average overlap follows a normal distribution when calculated on conjoint ranked lists - that is, the two ranked lists contain the same elements, just ranked differently. This gives a statistical interpretation of the resulting average overlap score. Only do this when specifying a specific marker gene set to base cluster rankings from, performed through providing a list of genes to the genes_to_filter argument when calling make_ao_dendrogram.

An exapmle function call:

ao.plot_ao_heatmap(adata, key='leiden')
ao.plot_ao_heatmap(adata, key='leiden', plot_zscores=True)

Authors

  • Christopher Thai

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sc_average_overlap-1.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sc_average_overlap-1.0.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file sc_average_overlap-1.0.3.tar.gz.

File metadata

  • Download URL: sc_average_overlap-1.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for sc_average_overlap-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bf5c954454da7686d46a50a6ae9e3814d6e113b8525829b08117daf4ffa66253
MD5 7655c12b4981101080dc9735488e0e08
BLAKE2b-256 6345fa82aa85735a94d3c846fc91bf0460333b3c8fd8a5728ac1bf53ecf9843c

See more details on using hashes here.

File details

Details for the file sc_average_overlap-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sc_average_overlap-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9ee85bb686133ba5e4110d3c4e9bdcfc32b72f709c1e5ef4fe78c356855457d6
MD5 7ab8b10b4cadbab60aa92caaa2eaa2f2
BLAKE2b-256 ad27fde487cc14e24e77538ead6e40a6ee313a06993baa7bf62c25f6e0ec19dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page