# sctk

`sctk` is a Jupyter-first toolkit for reproducible single-cell transcriptomics
analysis. It provides small, explicit helpers around AnnData, Scanpy, PyDESeq2,
Harmony, scVI, LIANA, and selected R/Bioconductor methods.

## Start here

1. Follow [Installation and environments](CONDA_ENVIRONMENT.md) and select the
   `Python (sctk)` Jupyter kernel.
2. Read [Data model and conventions](DATA_MODEL.md) before modifying `.X` or
   creating layers.
3. Run [QC and preprocessing](QC_PREPROCESSING.md).
4. Continue with the topic guide that matches the analysis:
   [expression and annotation](EXPRESSION_ANNOTATION.md),
   [pseudobulk differential expression](PSEUDOBULK_DE.md),
   [integration](INTEGRATION.md), or
   [cell-cell communication](CELL_COMMUNICATION.md).
5. Use the [API reference](API_REFERENCE.md) while writing notebooks.

The [quickstart notebook](quickstart.ipynb) is a short executable example.
The [single-cell workflow](single_cell_workflow.ipynb) is a longer analysis
case study with saved outputs.

## Analysis principles

- Preserve raw integer counts in `adata.layers["counts"]`.
- Keep normalized expression in a separate layer such as `"log1p_norm"`.
- Review QC decisions before removing cells.
- Treat biological samples—not cells—as replicates for differential expression.
- Evaluate batch correction for both mixing and biological conservation.
- Treat marker-based labels and ligand-receptor predictions as hypotheses that
  require biological review.
- Keep optional Python and R backends lazy so core workflows remain importable.

## Current scope

The implemented package covers single-cell QC, preprocessing, clustering,
expression summaries, marker scoring, pseudobulk DE, enrichment, integration,
cell-cell communication, plotting, scDblFinder, SoupX, and limma-voom.

AnnData helpers may also be useful for spatial transcriptomics objects, but a
dedicated spatial-analysis module is not yet part of the public API.

## Where results are written

| Operation | Result |
| --- | --- |
| QC | `adata.obs`, `adata.var` |
| Normalization | `adata.layers["log1p_norm"]` |
| PCA/integration | `adata.obsm` |
| Neighbors | `adata.obsp`, `adata.uns` |
| Clustering/annotation | `adata.obs` |
| LIANA | `adata.uns["liana_res"]` |
| Pseudobulk | a new AnnData object |
| DE/enrichment | pandas DataFrames |

For behavior that differs from the old scripts, see the
[migration map](MIGRATION_MAP.md).
