算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
celltypist【设计与创意】Use CellTypist for single-cell RNA-seq cell type annotation, model management, custom classifier training, CLI usage, and result visualization workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a task involves CellTypist, automated scRNA-seq cell type annotation, CellTypist model downloads or local model pickles, celltypist.annotate, the celltypist CLI, custom CellTypist classifier training, or CellTypist result exports and plots.
Install CellTypist from PyPI or conda, then verify the import and CLI:
pip install celltypist
python -c "import celltypist; print(celltypist.__version__)"
celltypist --help
CellTypist uses scanpy, anndata, scikit-learn, pandas, numpy, openpyxl, click, requests, and leidenalg. GPU paths are optional: rapids-singlecell affects over-clustering during majority voting, and cuml affects GPU logistic regression training.
celltypist.annotate, count tables, Matrix Market input, .h5ad, in-memory AnnData, CLI annotation, best-match vs probability-match modes, majority voting, and table export.CELLTYPIST_FOLDER, Model.load, Model.write, marker extraction, model conversion, model subsetting, and tiny offline model fixtures.celltypist.train, training matrix/label/gene validation, logistic regression vs SGD vs mini-batch, feature selection, sparse-memory settings, GPU training caveats, and downsample_adata.AnnotationResult tables, Excel export, AnnData insertion, confidence scores, UMAP plot files, and celltypist.dotplot comparisons against manual labels or clusters.Prefer an explicit local model path when the user needs offline behavior. Built-in model names and model=None can consult the CellTypist model cache and may need network access if the cache is empty.
import celltypist
predictions = celltypist.annotate(
"query_counts.csv",
model="local_model.pkl",
mode="best match",
)
predictions.to_table(folder="results", prefix="query_")
For CLI usage, create the output directory first:
mkdir -p results
celltypist --indata query_counts.csv --model local_model.pkl --outdir results --prefix query_ --quiet
Use the model-management helpers to avoid accidental downloads:
python sub-skills/model-management/scripts/model_cache_check.py --verify-model ./local_model.pkl
python sub-skills/model-management/scripts/tiny_model_factory.py --output tiny_model.pkl --write-query-csv tiny_query.csv
Then pass ./local_model.pkl or an absolute path to Model.load() or celltypist.annotate().
Before expensive training, validate the matrix/label/gene shape and algorithm feasibility:
python sub-skills/training-and-custom-models/scripts/training_data_check.py \
--matrix reference.csv --labels labels.txt --genes genes.txt
Use with_mean=False for sparse data that should not be densified, and use check_expression=False only when the user intentionally trains on a subset such as highly variable genes that cannot satisfy whole-transcriptome normalization checks.
Use the visualization sub-skill when the user already has an AnnotationResult:
adata = predictions.to_adata(insert_labels=True, insert_conf=True, insert_prob=True)
predictions.to_table(folder="results", prefix="query_", xlsx=True)
For celltypist.dotplot(), remember that the default prediction column is majority_voting; use use_as_prediction="predicted_labels" when majority voting was not run.
celltypist command exposes expected options without running downloads or annotation../ or absolute paths for strict offline loading; bare filenames can trigger built-in inventory checks.