scrnaseq-integration
Skill4 starsChanged 12 days agoMITView on GitHub
Multi-sample batch correction and integration of single-cell RNA-seq datasets using Harmony, Seurat CCA/RPCA, or scVI.
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-clusteringSkill
- scrnaseq-differential-expressionSkill
- 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
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Run per-sample normalization (log1p or SCTransform) using identical parameters across all samples.
- Distinctive: line 34
Run PCA on the unintegrated data.
- Distinctive: line 35
Run the selected integration method:
- Very specific: line 36
Harmony: run sc.external.pp.harmony_integrate (Scanpy) or RunHarmony (Seurat) on the PCA embedding.
- Very specific: line 37
Seurat CCA: run FindIntegrationAnchors with reduction = "cca" then IntegrateData.
- Very specific: line 38
Seurat RPCA: run FindIntegrationAnchors with reduction = "rpca" then IntegrateData.
≈ “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 Integration
Use When
- User has multiple samples or batches and wants to correct batch effects before clustering and cell type annotation.
- User wants to build a joint embedding from datasets generated at different times, labs, or with different protocols.
- User needs to assess integration quality with quantitative metrics.
- User wants to compare integration methods for a given dataset.
Inputs
- Required:
- Multiple AnnData (.h5ad) or Seurat objects (.rds), one per sample or batch, or a single concatenated object with a batch/sample label column
- Optional:
- Framework:
scanpyorseurat(default:scanpy) - Integration method:
harmony,seurat-cca,seurat-rpca, orscvi(default:harmony) - Batch variable column name (default:
batch) - Number of HVGs (default: 3000)
- Number of PCs for integration (default: 30)
- Number of Harmony iterations (default: 10)
- scVI latent dimensions (default: 20)
- Clustering resolution after integration (default: 0.5)
- Framework:
Workflow
- Load all sample objects and concatenate into a single AnnData or Seurat object, adding a
batch(orsample) column to obs/metadata. - Run per-sample normalization (log1p or SCTransform) using identical parameters across all samples. Do not normalize again after concatenation.
- Select HVGs using batch-aware selection: compute HVGs per batch and take the union of the top genes appearing in most batches (
sc.pp.highly_variable_geneswithbatch_keyparameter). - Run PCA on the unintegrated data; plot a UMAP to visualize the extent of batch effects before integration.
- Run the selected integration method:
- Harmony: run
sc.external.pp.harmony_integrate(Scanpy) orRunHarmony(Seurat) on the PCA embedding. Harmony corrects only the PCA coordinates; raw counts remain unchanged. - Seurat CCA: run
FindIntegrationAnchorswithreduction = "cca"thenIntegrateData; produces a corrected expression matrix. - Seurat RPCA: run
FindIntegrationAnchorswithreduction = "rpca"thenIntegrateData; faster than CCA for large datasets. - scVI: train a variational autoencoder using
scvi.model.SCVIwith the batch key; extract latent representation (20 dimensions) as the integrated embedding.
- Harmony: run
- Compute the kNN graph and Leiden/Louvain clusters on the integrated embedding.
- Compute UMAP on the integrated embedding. Plot UMAP colored by batch/sample (to confirm mixing) and by cluster (to confirm biological signal is preserved).
- Assess integration quality:
- LISI score (Local Inverse Simpson's Index): higher batch LISI = better mixing; higher biological LISI = preserved biology.
- kBET (k-nearest neighbor batch effect test): fraction of cells with well-mixed neighborhoods.
- Silhouette score: positive for biological clusters, near-zero for batch.
- Save integrated AnnData (.h5ad) or Seurat object (.rds) with the integrated embedding and cluster labels.
Output Contract
- Integrated AnnData (.h5ad) or Seurat object (.rds) with integrated embedding (
X_pca_harmony,X_scVI, or equivalent) and cluster labels - UMAP plots before and after integration, colored by batch and cluster (PDF)
- Integration quality metrics table (TSV): LISI (batch), LISI (bio), kBET acceptance rate, silhouette score
- Per-sample cell count summary table (TSV): sample, n_cells, n_clusters
Limits
- Harmony corrects only the PCA embedding; do not use Harmony-corrected PCA coordinates as a substitute for corrected expression values in differential expression.
- scVI requires GPU for practical runtime on large datasets (>100k cells); training on CPU can take many hours.
- Over-integration can merge biologically distinct cell types with similar transcriptomes (e.g., tissue macrophages and circulating monocytes); always validate cluster identity with canonical markers after integration.
- Different integration methods may produce meaningfully different results; Harmony is the recommended starting point due to speed and reliability. Escalate to scVI if Harmony leaves visible batch structure.
- Datasets with very different protocols (e.g., 10x v2 vs v3, or FACS-sorted vs droplet) may require protocol-specific covariates in addition to the batch variable.
- Common failure cases:
- Harmony not converging (LISI not improving after iterations); check that the batch variable has more than one level and that HVG selection used
batch_key. - scVI training producing NaN loss; reduce learning rate or check for cells with zero counts after filtering.
- Seurat CCA failing on very large datasets (>500k cells) due to memory; switch to RPCA or scVI.
- Harmony not converging (LISI not improving after iterations); check that the batch variable has more than one level and that HVG selection used
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.

