A CLI-driven AnnData toolkit
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anntools_bio-0.1.1.tar.gz.
File metadata
- Download URL: anntools_bio-0.1.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38b57088686794dbd7aceac471ce4ba83686a75ef02974143298bebe64b49bb
|
|
| MD5 |
e40f1e00a1b3b0eb4d0ab73d17f27e19
|
|
| BLAKE2b-256 |
6f06a5aeb6404be717dbc1d2cc36b6f84dd88f5809ab3ba6fc28465f7e5c86b1
|
File details
Details for the file anntools_bio-0.1.1-py3-none-any.whl.
File metadata
- Download URL: anntools_bio-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42a22b55d3801ac4f05f2244ac365a7b5dacc7f0e1a01c7abffccfb87d66d476
|
|
| MD5 |
62b0393c3131771cfa41bbb55d495665
|
|
| BLAKE2b-256 |
103e652557bc8a779650775b688a50085375a4f622d53cf147258f20c4c83700
|