⚠️ This package is superseded by anndataR.
anndataRprovides a pure R implementation of theAnnDatadata structure with no Python required. It reads and writes.h5adfiles natively and supports conversion to/fromSingleCellExperimentandSeuratobjects. New users should installanndataRfrom Bioconductor instead:BiocManager::install("anndataR")Existing users of
anndatacan follow the migration guide for guidance on switching toanndataR.
anndata for R is a reticulate wrapper for the Python anndata package.
Installation
Note: New projects should use anndataR instead. See the migration guide.
You can install anndata for R from CRAN as follows:
install.packages("anndata")Normally, reticulate should take care of installing Miniconda and the Python anndata.
If not, try running:
reticulate::install_miniconda()
anndata::install_anndata()Getting started
The API of anndata for R is very similar to its Python counterpart. Here is an example:
## AnnData object with n_obs × n_vars = 713 × 33538
## var: 'gene_ids', 'feature_types', 'genome', 'highly_variable', 'means', 'dispersions', 'dispersions_norm'
## uns: 'hvgParameters', 'normalizationParameters', 'pca', 'pcaParameters'
## obsm: 'X_pca'
## varm: 'PCs'
Matrix::rowMeans(ad$X[1:10, ])## AAACCCAAGTGGTCAG-1 AAAGGTATCAACTACG-1 AAAGTCCAGCGTGTCC-1 AACACACTCAAGAGTA-1
## 0.06499579 0.06385104 0.06102355 0.06739055
## AACACACTCGACGAGA-1 AACAGGGCAGGAGGTT-1 AACAGGGCAGTGTATC-1 AACAGGGTCAGAATAG-1
## 0.08891241 0.08648681 0.09318970 0.09140243
## AACCTGAAGATGGTCG-1 AACGGGATCGTTATCT-1
## 0.06664118 0.07866523See ?anndata for a full list of the functions provided by this package. Check out any of the other vignettes by clicking any of the links below:
Future work
This package is no longer under active development as it has been superseded by anndataR. Bug fixes may still be applied, but no new features are planned.