Skip to main content

cna

Covarying neighborhood analysis is a method for finding structure in- and conducting association analysis with multi-sample single-cell datasets. cna does not require a pre-specified transcriptional structure such as a clustering of the cells in the dataset. It aims instead to flexibly identify differences of all kinds between samples. cna is fast, does not require parameter tuning, produces measures of statistical significance for its association analyses, and allows for covariate correction.

cna is built on top of scanpy and offers a scanpy-like interface for ease of use.

If you prefer R, there is an R implementation maintained separately by Ilya Korsunsky. (Though the R implementation may occasionally lag behind this implementation as updates are made.)

installation

To use cna, you can either install it directly from the Python Package Index by running, e.g.,

pip install cna

or if you'd like to manipulate the source code you can clone this repository and add it to your PYTHONPATH.

demo

Take a look at our tutorial to see how to get started with a small synthetic data set.

talk

You can learn more about cna by watching our talk at the Broad Institute's Models, Inference, and Algorithms seminar, which is preceded by a primer by Dylan Kotliar on nearest-neighbor graphs.

notices

  • April 29, 2025: We have made substantial changes to the cna API and are releasing a new package version 0.2.0. The main changes are that i) cna no longer will cache the NAM, and ii) cna will no longer use the MultiAnnData structure and will instead only use the standard scanpy AnnData structure. Code built for prior versions will likely not work for this new version, but should be easily adaptible by following the new demo.
  • October 19, 2023: We have found a source of miscalibration in cna’s local association testing of individual neighborhoods that applies to unusual datasets, typically with limited sample size and very low complexity. This issue does not affect cna’s global test, which tests for aggregate association between single-cell profiles and a case-control phenotype; it only affects cna’s identification of which individual neighborhoods explain an aggregate association. The miscalibration appears mild on real datasets. However, in simulated datasets we observed miscalibration when i) the case-control phenotype was extremely highly correlated with the first principal component of the neighborhood abundance matrix, and ii) there were many neighborhoods lacking true associations to this phenotype. This issue has been fixed in cna version 0.1.6, which uses the full-rank rather than the rank-k* neighborhood abundance matrix to compute neighborhood coefficients. We re-ran the primary analyses from the index cna paper with this new version of cna and found that the results were broadly unchanged. Although cna found fewer FDR-significant neighborhoods in each dataset, it still found large numbers of neighborhoods corresponding to the key associated cell populations (albeit at FDR 10% rather than 5% for the dataset with the smallest sample size [N=12]). Additionally, the prior and updated neighborhood coefficients remain very similar (R>0.9 in all datasets). We did not modify CNA’s global test, which determines whether there is any association between the single cell profiles and the case-control phenotype, as that portion of the method is unaffected.
  • January 20, 2022: It has come to our attention that a bug introduced on July 16, 2021 caused cna to behave incorrectly for users with anndata version 0.7.2 or later, possibly resulting in false positive or false negative results. This bug was fixed in cna version 0.1.4. We strongly recommend that any users with anndata version 0.7.2 or later either re-clone cna or run pip install --upgrade cna and re-run all analyses that may have been affected.

citation

If you use cna, please cite

[Reshef, Rumker], et al., Co-varying neighborhood analysis identifies cell populations associated with phenotypes of interest from single-cell transcriptomics. [...] contributed equally

Metadata

Release files for cna 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cna 0.2.6
File Size Uploaded
cna-0.2.6.tar.gz 29.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cna 0.2.6
File Interpreter ABI Platform
cna-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 55.5 kB

Release files / cna-0.2.6.tar.gz

Download URL cna-0.2.6.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
48f73bd7ae3ef5869bc43dc5862eed7a5ddd332ee183e1d2e5ac2e33a8b0b0cf
BLAKE2b-256 checksum
How to use checksums
de2ecf6af4153e312fc6598c4815c9948a47c644199d83ecc4f19660cd5c5fa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / cna-0.2.6-py3-none-any.whl

Download URL cna-0.2.6-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
752814b304e325a180069afc6ef87335b22f18bf782d32f0471e56b6c349ff24
BLAKE2b-256 checksum
How to use checksums
e5937b92fe01e280ddc011634b2f53de3451257a91e0ac9f07c779f0fcaa3012
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page