Skip to main content

cellitac

Cell type Identification using Transcription factor Analysis and Chromatin accessibility

A pipeline for single-cell multiome (scATAC + scRNA) data that identifies cell types from transcription-factor motif activity. RNA is used only to derive labels; the classifier itself is trained purely on TF activity, so the model learns chromatin-level regulatory signal.


Pipeline

Stage Steps Tools
1. Preprocessing (R) multiome H5 → joint RNA+ATAC QC on shared barcodes Seurat, Signac
SingleR labels from the Monaco immune reference SingleR, celldex
JASPAR motif scan → chromVAR per-cell TF activity JASPAR2020, motifmatchr, chromVAR
2. Machine learning (Python) class composition, unsupervised feature cleaning pandas, scikit-learn
Logistic Regression, Random Forest, SVM, XGBoost scikit-learn, xgboost, imbalanced-learn
TF ↔ cell-type association (Mann-Whitney + BH-FDR + effect size) scipy
figures, tables and a JSON report matplotlib, seaborn, networkx

Scope. cellitac has been developed and tested on human PBMC multiome data, using the Monaco immune reference for SingleR labels. It works on any human tissue whose cell types are covered by that reference (blood, bone marrow, immune infiltrates).

Genome builds: hg38 (default) and hg19.


Requirements

  • Linux or macOS (Windows via WSL)
  • Python 3.9 – 3.12
  • Conda / Miniconda
  • R ≥ 4.3 with the Bioconductor packages listed below (for the preprocessing stage). The ML stage runs on Python alone.

Installation

Take the R packages from conda as pre-built binaries — do not let BiocManager compile them from source (recent GCC versions fail on some of the older Bioconductor C code, which then cascades through every downstream package).

conda create -n cellitac -c conda-forge -c bioconda -y \
  python=3.11 rpy2 r-base=4.4 \
  r-seurat r-signac r-data.table \
  bioconductor-jaspar2020 bioconductor-tfbstools \
  bioconductor-motifmatchr bioconductor-chromvar \
  bioconductor-singler bioconductor-celldex \
  bioconductor-biovizbase bioconductor-rtracklayer \
  bioconductor-summarizedexperiment bioconductor-biocparallel \
  bioconductor-bsgenome.hsapiens.ucsc.hg38 \
  bioconductor-ensdb.hsapiens.v86

conda activate cellitac
pip install cellitac

For hg19 data, swap the last two conda packages for bioconductor-bsgenome.hsapiens.ucsc.hg19 and bioconductor-ensdb.hsapiens.v75.

Verify:

cellitac --version
cellitac-install-r --check-only   # must say: all N R packages present

If you only need the ML stage (you already have preprocessed CSVs), install with pip alone — no R required:

pip install cellitac

Input files

Files required by the pipeline

cellitac detects files by extension, so file names do not matter. From the 10x page above, download the three files with these extensions into one folder:

Required Files

File Extension
Filtered feature-barcode matrix .h5
ATAC fragments .tsv.gz
Fragments tabix index .tsv.gz.tbi

Download via CLI

Alternatively, you can download these files directly from the command line:

wget https://cf.10xgenomics.com/samples/cell-arc/2.0.0/pbmc_unsorted_10k/pbmc_unsorted_10k_filtered_feature_bc_matrix.h5
wget https://cf.10xgenomics.com/samples/cell-arc/2.0.0/pbmc_unsorted_10k/pbmc_unsorted_10k_atac_fragments.tsv.gz
wget https://cf.10xgenomics.com/samples/cell-arc/2.0.0/pbmc_unsorted_10k/pbmc_unsorted_10k_atac_fragments.tsv.gz.tbi

Missing the tabix index? Create it with tabix -p bed <fragments>.tsv.gz.


Usage

Command line

The package installs four commands. Every command supports --help for the full flag list.

# full pipeline (preprocessing + ML)
cellitac --input /path/to/data --output /path/to/results

# preprocessing already finished — go straight to the ML stage
cellitac --input /path/to/data --output /path/to/results --skip-preprocessing

# force re-running the R stage even if its outputs exist
cellitac --input /path/to/data --output /path/to/results --force-preprocessing

# data aligned to hg19
cellitac --input /path/to/data --output /path/to/results --genome hg19

# the two stages separately
cellitac-preprocess --input /path/to/data --output /path/to/results
cellitac-model      --data /path/to/results/preprocessing --output /path/to/results/ml_results

# one-off: install the R/Bioconductor dependencies
cellitac-install-r [--genome hg19] [--check-only]

cellitac is resumable: if <output>/preprocessing/ already contains cellitac_TF_activity.csv and cell_labels.csv, the R stage is skipped and only the ML stage runs. Use --force-preprocessing to override.

Python API

from cellitac import run_full_pipeline, run_preprocessing, run_model

run_full_pipeline(input_dir="/path/to/data", output_dir="/path/to/results")

# skip R when preprocessing is already done
run_full_pipeline(input_dir="/path/to/data",
                  output_dir="/path/to/results",
                  skip_preprocessing=True)

# stages separately
run_preprocessing(input_dir="/path/to/data",
                  output_dir="/path/to/results/preprocessing")
run_model(data_dir="/path/to/results/preprocessing",
          output_dir="/path/to/results/ml_results")

# direct access to the ML class
from cellitac.mainModel import CellitacPipeline
pipe = CellitacPipeline(data_dir="/path/to/results/preprocessing",
                        out_dir="/path/to/results/ml_results")
pipe.run()
print(pipe.metrics_df)

Output layout

<output>/
├── preprocessing/                    # stage 1 (R)
│   ├── cellitac_TF_activity.csv      # X — cells × TF motifs (chromVAR z-scores)
│   ├── cell_labels.csv               # y — cell_id, cell_type
│   ├── motif_to_TF_map.csv           # JASPAR motif ID → TF symbol
│   └── multiome_processed.rds        # full Seurat object
└── ml_results/                       # stage 2 (Python)
    ├── cellitac_ml_report.json
    ├── fig01_umap_TFactivity_before_training.png
    ├── fig02_class_composition_pies.png
    ├── fig03_class_imbalance_handling.png
    ├── fig04_model_comparison.png
    ├── fig05_confusion_matrices.png
    ├── fig06_importance_<model>.png
    ├── fig07_TF_network_<model>.png
    ├── fig08_learning_curves.png
    ├── fig09_umap_tsne_after_training.png
    ├── table01_class_composition.csv
    ├── table02_model_performance.csv
    ├── table03_accuracy_and_overfitting.csv
    ├── table04_per_class_metrics.csv
    ├── table05_per_class_recall.csv
    ├── table06_top20_TF_all_models.csv
    ├── table07_TF_celltype_associations_full.csv
    ├── table08_network_edges_<model>.csv
    └── table09_learning_curve.csv

Troubleshooting

Problem Solution
rpy2 is not available conda install -c conda-forge r-base rpy2 — only the preprocessing stage needs it
Missing R packages: ... install them from conda (see Installation), not from source
Could not find the H5 matrix file check that --input points at the folder holding the raw files
tabix index ... missing tabix -p bed <fragments>.tsv.gz
compilation failed for package 'rtracklayer' GCC 14 vs old UCSC C code. Use the conda binaries; or add CFLAGS = -std=gnu17 -O2 to ~/.R/Makevars
Preprocessing appears to re-run every time it doesn't — outputs are detected and skipped. Use --force-preprocessing if you actually want to re-run it

Contributors

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cellitac-2.0.0.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cellitac-2.0.0-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file cellitac-2.0.0.tar.gz.

File metadata

  • Download URL: cellitac-2.0.0.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.16

File hashes

Hashes for cellitac-2.0.0.tar.gz
Algorithm Hash digest
SHA256 065bf4560b40cd89d24847f1cfd3d9a3cb4dfce29a3c108b8313bb57288fc727
MD5 fa98bdac97cb7971f65adcc46dedc89e
BLAKE2b-256 e98a5daacd6e518771e89335b1c8b6f96d3001ee05299a2890fcdc703a2dd13c

See more details on using hashes here.

File details

Details for the file cellitac-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cellitac-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.16

File hashes

Hashes for cellitac-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 721af4fc5aaca0fe1dfee91124ab226f0df1dfc0a621de73847e0764fb4854cd
MD5 1544aac69f2cd872d0fd14cd468c9fbe
BLAKE2b-256 6f289d66db77badb07b74debb53606db288fedba24606a8d6668333da100165a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page