# HTO DND - Demultiplex Hashtag Data
[](https://badge.fury.io/py/hto-dnd)
[](https://github.com/sail-mskcc/hto_dnd/actions/workflows/test.yml)
`hto` is a Python package designed for efficient and accurate demultiplexing of hash-tagged oligonucleotides (HTOs) in single-cell data.
It normalises based on observed background signal and denoises the data to remove batch effects and noise:
- **Normalization**: Normalize HTO data using background signal, inspired by the DSB method (see citation below).
- **Denoising**: Remove batch effects and noise from the data by regressing out cell by cell variation.
- **Demultiplexing**: Cluster and classify cells into singlets, doublets, or negatives using clustering methods like k-means or Gaussian Mixture Models (GMM).
The package supports command-line interface (CLI) usage and Python imports.

## Installation
Using `pip`:
```bash
pip install hto
```
From source:
```bash
git clone https://github.com/sail-mskcc/hto_dnd.git
cd hto_dnd
pip install .
```
## Usage
### Python API
The python API is built around AnnData. it is highly recommended two work with three AnnData objects:
* `adata_hto`: Filtered AnnData object with HTO data, containing only actual cells.
* `adata_hto_raw`: Raw AnnData object with HTO data, containing actual cells and background signal.
* `adata_gex`: Raw AnnData object with gene expression data. This is optional and can be used to construct a more informative background signal.
```python
import hto
# get mockdata
mockdata = hto.data.generate_hto(n_cells=1000, n_htos=3, seed=10)
adata_hto = mockdata["filtered"]
adata_hto_raw = mockdata["raw"]
adata_gex = mockdata["gex"]
# denoise, normalize, and demultiplex
adata_demux = hto.demultiplex(
adata_hto,
adata_hto_raw,
adata_gex=adata_gex,
inplace=False,
)
# see results
adata_demux.obs[["hash_id", "doublet_info"]].head()
```
### Command-Line Interface (CLI)
The CLI provides an API for the `hto demultiplex` scripts. Make sure to define `--adata-out` to save the output.
```
hto demultiplex \
--adata-hto /path/to/adata_hto.h5ad \
--adata-hto-raw /path/to/adata_hto_raw.h5ad \
--adata-gex /path/to/adata_gex.h5ad \
--adata-out /path/to/output.h5ad
```
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/hto/",
"name": "hto",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "single-cell, demultiplexing, HTO",
"author": "Hussen Mohammed Ibrahim",
"author_email": "ibrahih3@mskcc.org",
"download_url": "https://files.pythonhosted.org/packages/8e/80/7d6fb2a0f5efbb8f393ad609c5be2356c6d1c3f05dfdd48505574898e88d/hto-1.1.1.tar.gz",
"platform": null,
"description": "# HTO DND - Demultiplex Hashtag Data\n\n[](https://badge.fury.io/py/hto-dnd)\n[](https://github.com/sail-mskcc/hto_dnd/actions/workflows/test.yml)\n\n`hto` is a Python package designed for efficient and accurate demultiplexing of hash-tagged oligonucleotides (HTOs) in single-cell data.\nIt normalises based on observed background signal and denoises the data to remove batch effects and noise:\n\n- **Normalization**: Normalize HTO data using background signal, inspired by the DSB method (see citation below).\n- **Denoising**: Remove batch effects and noise from the data by regressing out cell by cell variation.\n- **Demultiplexing**: Cluster and classify cells into singlets, doublets, or negatives using clustering methods like k-means or Gaussian Mixture Models (GMM).\n\nThe package supports command-line interface (CLI) usage and Python imports.\n\n\n\n## Installation\n\nUsing `pip`:\n\n```bash\npip install hto\n```\n\nFrom source:\n\n```bash\ngit clone https://github.com/sail-mskcc/hto_dnd.git\ncd hto_dnd\npip install .\n```\n\n## Usage\n\n### Python API\n\nThe python API is built around AnnData. it is highly recommended two work with three AnnData objects:\n\n* `adata_hto`: Filtered AnnData object with HTO data, containing only actual cells.\n* `adata_hto_raw`: Raw AnnData object with HTO data, containing actual cells and background signal.\n* `adata_gex`: Raw AnnData object with gene expression data. This is optional and can be used to construct a more informative background signal.\n\n```python\nimport hto\n\n# get mockdata\nmockdata = hto.data.generate_hto(n_cells=1000, n_htos=3, seed=10)\nadata_hto = mockdata[\"filtered\"]\nadata_hto_raw = mockdata[\"raw\"]\nadata_gex = mockdata[\"gex\"]\n\n# denoise, normalize, and demultiplex\nadata_demux = hto.demultiplex(\n adata_hto,\n adata_hto_raw,\n adata_gex=adata_gex,\n inplace=False,\n)\n\n# see results\nadata_demux.obs[[\"hash_id\", \"doublet_info\"]].head()\n```\n\n### Command-Line Interface (CLI)\n\nThe CLI provides an API for the `hto demultiplex` scripts. Make sure to define `--adata-out` to save the output.\n\n```\nhto demultiplex \\\n --adata-hto /path/to/adata_hto.h5ad \\\n --adata-hto-raw /path/to/adata_hto_raw.h5ad \\\n --adata-gex /path/to/adata_gex.h5ad \\\n --adata-out /path/to/output.h5ad\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A method to demultiplex hashtagged single-cell data.",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://pypi.org/project/hto/",
"Repository": "https://github.com/YOUR-ORG/hto"
},
"split_keywords": [
"single-cell",
" demultiplexing",
" hto"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f55def53026ba5c66363c57e8469431b475916be6da3f12ffd677b5e4348ef4",
"md5": "ecaf1e0d07c7361703346e8b48ff54d1",
"sha256": "00d91f6e7367be6bb92f63b8d2cf27d84edadd470f097e15394ec09368a0bd80"
},
"downloads": -1,
"filename": "hto-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ecaf1e0d07c7361703346e8b48ff54d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 50720,
"upload_time": "2025-08-29T01:56:29",
"upload_time_iso_8601": "2025-08-29T01:56:29.074610Z",
"url": "https://files.pythonhosted.org/packages/7f/55/def53026ba5c66363c57e8469431b475916be6da3f12ffd677b5e4348ef4/hto-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e807d6fb2a0f5efbb8f393ad609c5be2356c6d1c3f05dfdd48505574898e88d",
"md5": "214da03e7fcc8985beb37f5a810dcf17",
"sha256": "e40a55c3e295170c4510d443b7d941871cba8a3093bed5993d42153a9b922ed7"
},
"downloads": -1,
"filename": "hto-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "214da03e7fcc8985beb37f5a810dcf17",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 38663,
"upload_time": "2025-08-29T01:56:30",
"upload_time_iso_8601": "2025-08-29T01:56:30.151435Z",
"url": "https://files.pythonhosted.org/packages/8e/80/7d6fb2a0f5efbb8f393ad609c5be2356c6d1c3f05dfdd48505574898e88d/hto-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-29 01:56:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YOUR-ORG",
"github_project": "hto",
"github_not_found": true,
"lcname": "hto"
}