scrnaseq-clustering
Skill4 starsChanged 12 days agoMITView on GitHub
Normalization, highly variable gene selection, PCA, UMAP, and Leiden/Louvain clustering of single-cell RNA-seq data.
In this repository56 other files it gives its agents.
- bioinformatics-env-setupSkill
- design-thermostable-mutationsSkill
- download-gdcSkill
- download-geoSkill
- download-sraSkill
- source-summarizerSkill
- genome-alignment-qcSkill
- genome-read-alignmentSkill
- genome-variant-annotationSkill
- genome-variant-callingSkill
- genome-variant-filteringSkill
- metagenome-assemblySkill
- metagenome-binningSkill
- metagenome-functional-profilingSkill
- metagenome-host-removalSkill
- metagenome-taxonomic-profilingSkill
- ncbi-eutilities-assistantSkill
- ngs-quality-controlSkill
- ngs-read-preprocessingSkill
- paper-to-briefSkill
- predict-protein-heat-stabilitySkill
- researchSkill
- rnaseq-alignment-qcSkill
- rnaseq-differential-expressionSkill
- rnaseq-functional-enrichmentSkill
- rnaseq-read-alignmentSkill
- rnaseq-read-countingSkill
- rnaseq-transcript-quantificationSkill
- rpsblast-assistantSkill
- scrnaseq-cellranger-countSkill
- scrnaseq-cell-type-annotationSkill
- scrnaseq-differential-expressionSkill
- scrnaseq-integrationSkill
- scrnaseq-quality-controlSkill
- scrnaseq-trajectory-analysisSkill
- search-enaSkill
- search-geoSkill
- search-gsaSkill
- search-ncbi-datasetsSkill
- search-sraSkill
- stat-analyze-distributionSkill
- stat-assess-data-qualitySkill
- stat-bayesian-estimationSkill
- stat-cluster-samplesSkill
- stat-compare-multiple-groupsSkill
- stat-compare-two-groupsSkill
- stat-fit-glmSkill
- stat-fit-linear-modelSkill
- stat-learn-bayesian-networkSkill
- stat-logistic-regressionSkill
- stat-nonlinear-embeddingSkill
- stat-pairwise-correlationSkill
- stat-pcaSkill
- stat-survival-analysisSkill
- structured-intelligence-skill-creatorSkill
- <skill-id>Skill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Run PCA on the HVG-scaled matrix (sc.tl.pca or RunPCA).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: scRNA-seq Clustering
Use When
- User has a QC-filtered count matrix and wants to cluster cells into groups.
- User wants to generate UMAP or tSNE embeddings for visualization.
- User needs to perform dimensionality reduction before cell type annotation or differential expression.
Inputs
- Required:
- Filtered AnnData (.h5ad) or Seurat object (.rds)
- Optional:
- Framework:
scanpyorseurat(default:scanpy) - Normalization method:
lognormorscttransform(default:lognorm) - Number of highly variable genes (default: 3000)
- Number of PCs to compute (default: 50)
- Number of PCs to use for neighbor graph (default: 30; refine with elbow plot)
- Number of neighbors for kNN graph (default: 15)
- Clustering resolution (default: 0.5; range 0.1–2.0)
- Clustering algorithm:
leidenorlouvain(default:leiden) - Variables to regress out (default: none; options:
nCount_RNA,percent.mt) - Random seed (default: 42)
- Framework:
Workflow
- Normalize counts: CPM normalization (counts per 10,000) followed by log1p transformation (
sc.pp.normalize_total+sc.pp.log1pin Scanpy;NormalizeDatain Seurat), or run SCTransform (Seurat v5 /scranfor Scanpy). - Select highly variable genes (HVGs): use
seurat_v3flavor in Scanpy orFindVariableFeaturesin Seurat; default to top 3000 HVGs. - Scale gene expression to zero mean and unit variance (
sc.pp.scaleorScaleData). If regression is requested, regress outnCount_RNAand/orpercent.mtduring scaling. Skip scaling for SCTransform workflows. - Run PCA on the HVG-scaled matrix (
sc.tl.pcaorRunPCA); compute 50 PCs. Plot an elbow plot to identify where variance plateaus and select the number of PCs for the neighbor graph. - Compute the k-nearest neighbor (kNN) graph in PCA space (
sc.pp.neighborsorFindNeighbors) using the selected number of PCs. - Cluster cells with the Leiden algorithm (
sc.tl.leiden) or Louvain (sc.tl.louvain/FindClusters). Test at least two resolutions (e.g., 0.3 and 0.8) and compare cluster stability. - Compute UMAP embedding (
sc.tl.umaporRunUMAP); optionally compute tSNE. Always set a fixed random seed. - Plot UMAP colored by: cluster ID, QC metrics (
nFeature_RNA,nCount_RNA,percent.mt), and sample of origin. Flag clusters with elevated QC metrics as potentially low-quality. - Save updated AnnData (.h5ad) or Seurat object (.rds) with embeddings and cluster labels.
Output Contract
- Updated AnnData (.h5ad) or Seurat object (.rds) with cluster labels (
leidenorseurat_clusterscolumn) and UMAP/tSNE coordinates - UMAP plots colored by cluster, QC metrics, and sample (PDF)
- PCA elbow plot (PDF)
- Cluster membership table (TSV): cell barcode, cluster ID, UMAP1, UMAP2
Limits
- Leiden resolution parameter strongly controls granularity: lower values (0.1–0.3) yield fewer, broader clusters; higher values (1.0–2.0) yield many fine-grained clusters.
- Scaling with regression is incompatible with SCTransform; choose one normalization path.
- UMAP is non-deterministic without a fixed random seed; always set
random_state=42. - Cell cycle effects may separate proliferating cells into their own cluster regardless of lineage; regress out cell cycle scores if this is not the biology of interest (
sc.tl.score_genes_cell_cycle). - SCTransform is computationally expensive for datasets with more than 100,000 cells; use
lognormfor very large datasets. - Neighbor graph quality depends on the number of PCs chosen; too few PCs lose biological signal, too many add noise. Use the elbow plot as a guide.
- Common failure cases:
- Leiden clustering producing a single cluster (resolution too low) or as many clusters as cells (resolution too high); adjust resolution.
- UMAP looks identical across runs due to missing random seed; check
random_stateparameter. - SCTransform failing due to insufficient memory on large datasets (>200k cells); fall back to lognorm.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

