anntools
A command line utility for working with AnnData files.
anntools provides tools to manipulate, analyze, and transform AnnData (.h5ad) files commonly used in single-cell genomics. It offers efficient operations for quality control, downsampling, concatenation, pseudobulking, and more.
Installation
anntools can be installed using uv or pip:
# Using uv (recommended)
uv tool install anntools-bio
# Using pip
pip install anntools-bio
# From source
git clone https://github.com/noamteyssier/anntools.git
cd anntools
uv tool install -U -e .
Usage
# Get help information
anntools --help
# Get help for specific commands
anntools downsample --help
anntools concat --help
anntools info --help
Commands
info
Display comprehensive information about an h5ad file including shape, sparsity, layers, and metadata.
# Basic info
anntools info input.h5ad
# Detailed info with metadata summaries
anntools info input.h5ad -v
downsample
Downsample UMIs or cells to a specified fraction.
# Downsample UMIs using binomial sampling
anntools downsample input.h5ad 0.5 -o output.h5ad
# Downsample cells
anntools downsample input.h5ad 0.8 --which cells
# Use multinomial sampling
anntools downsample input.h5ad 0.5 --method multinomial
# Set random seed for reproducibility
anntools downsample input.h5ad 0.5 --seed 42
concat
Concatenate multiple h5ad files along the observation axis.
# Concatenate with inner join (only common variables)
anntools concat output.h5ad file1.h5ad file2.h5ad file3.h5ad
# Concatenate with outer join (all variables)
anntools concat output.h5ad file1.h5ad file2.h5ad --join outer
# Add batch labels
anntools concat output.h5ad file1.h5ad file2.h5ad --batch-key batch
# Specify custom batch labels
anntools concat output.h5ad file1.h5ad file2.h5ad --batch-key batch --batch-categories "ctrl,treat"
pseudobulk
Aggregate single-cell data into pseudobulk profiles.
Pseudobulking is done using adpbulk.
# Pseudobulk by cell type
anntools pseudobulk input.h5ad cell_type -o output.h5ad
# Pseudobulk by multiple grouping variables
anntools pseudobulk input.h5ad cell_type sample_id
# Use different aggregation methods
anntools pseudobulk input.h5ad cell_type --method sum
anntools pseudobulk input.h5ad cell_type --method median
# Pseudobulk a specific layer
anntools pseudobulk input.h5ad cell_type --layer counts
qc
Calculate quality control metrics.
# Add QC metrics to a new file
anntools qc input.h5ad -o output_qc.h5ad
# Replace existing file with QC metrics
anntools qc input.h5ad --replace
sparse
Convert data to CSR sparse format.
# Convert to sparse format
anntools sparse input.h5ad -o output_sparse.h5ad
# Replace existing file
anntools sparse input.h5ad --replace
view-obs / view-var
Export observation or variable metadata to TSV.
# View observation metadata
anntools view-obs input.h5ad > obs.tsv
# View variable metadata
anntools view-var input.h5ad > var.tsv
License
MIT License - see LICENSE for details.
Release files for anntools-bio 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anntools_bio-0.1.2.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anntools_bio-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / anntools_bio-0.1.2.tar.gz
| Download URL | anntools_bio-0.1.2.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06f3436764f2e8939377662ab5640815d97669803c4955e823558a6fd6e27ac5
|
|
BLAKE2b-256 checksum How to use checksums |
cf224632c2c44ba3d66a5dd5891b9baf491e8ec4dc1987048a8f1e2603a20352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / anntools_bio-0.1.2-py3-none-any.whl
| Download URL | anntools_bio-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e784af9db6316367c690de21b02380c0e22e223517b34568d0aa85aaa5be503
|
|
BLAKE2b-256 checksum How to use checksums |
8d8091c1dffc1126e4d385f0506d1c1b8dd635a89a17edd29c0fef7e14365d0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|