MSP: Multi-Sample Pipeline
Find recurring noise and annotate cell types across samples.
Why MSP · Workflow · Get started · Results · Documentation
MSP uses cross-sample integration to identify recurring noisy populations and annotate cell types in single-cell RNA-seq data. It combines Harmony, cluster structure, and QC evidence in a browser report, with optional AI agents for inspection and annotation. Start from OSP outputs or your own compatible H5AD files.
Why review samples together?
Outliers are scarce within one sample, but similar noisy cells can recur across many samples. After integration, they can accumulate into dense groups, separating from the main populations while retaining traces of their cell-type identity. This repeated core-and-satellite pattern, or fractal structure, makes noise that was scattered within samples easier to locate and assess together. Recurrence across samples can therefore reveal shared technical effects as well as shared biology.
From structure to noise filtering
MSP locates separated fragments within broad cell populations and compares their QC profiles with core cells. Contamination, doublet, stress, mitochondrial, and inherited QC evidence contribute removal candidates. AI inspection checks markers, sample composition, and cluster structure; annotation applies removals and records their sources. A detached group needs supporting evidence before being interpreted as noise.
How it works
Integration builds the shared map and finds fragments. Inspection reviews quality and biological evidence. Annotation assigns broad and fine labels, merges groups judged to represent the same population, and writes a filtered dataset. The report brings the structures, evidence, and decisions together.
Get started
1. Install
Use Python 3.10 or newer in a separate environment. Install from PyPI with
AI support; omit [agent] if you only need integration. No GPU or torch is
needed: Harmony runs on the CPU through harmonypy 2.
python -m pip install "msp-sc[agent]"
For the development version, install from GitHub instead:
python -m pip install "msp-sc[agent] @ git+https://github.com/chansigit/msp.git"
2. Prepare your samples
Provide one H5AD per sample, with raw counts in layers["counts"] and a sample
column in obs. Files must share the same genes in the same order, and cell
IDs must be unique across files. Replace the paths and sample_id below with
your own; see the user guide for details.
3. Run the analysis
This command integrates samples and creates msp_out/report.html without an
API key. To include AI inspection and annotation, follow the example below it.
python -m msp A/clustered.h5ad B/clustered.h5ad \
--batch-col sample_id --species human --outdir msp_out
Add AI inspection and annotation
This example uses Doubao through Volcengine Ark and requires an Ark API key
with model access; provider charges may apply. --annotate also runs inspection.
For other runtimes, see AI configuration.
export ARK_API_KEY="YOUR_ARK_API_KEY"
python -m msp A/clustered.h5ad B/clustered.h5ad \
--batch-col sample_id --species human --outdir msp_out \
--annotate --harness openai --model doubao-seed-2-1-turbo-260628
Add --design-context "one plate = one mouse x one FACS sort gate" when sample
identity encodes the study design: the text is shown verbatim to the inspection
and annotation agents (and kept in msp_out/design_context.txt) so a cluster
confined to one sample is judged against the design rather than as a batch artefact.
Find and understand your results
Open msp_out/report.html in your browser; download it first if you ran on
a server. Start with sample composition and cell maps, then compare flagged
groups against their markers and QC. Review the proposed labels, merges, and
removals before downstream analysis. The HTML embeds its plots and can be
shared as one file.
| Output | What you get |
|---|---|
report.html |
Cell maps, quality evidence, and completed AI reviews. |
integrated.h5ad |
All input cells in the shared space, with inspection proposals when available. |
annotated.h5ad |
Retained cells with broad and fine cell-type labels after annotation. |
annotation_removed.csv |
Removed cell IDs and the sources of each removal decision. |
FAQ
Does MSP remove cells?
Integration and inspection retain all cells. Annotation applies the union of
integration's removal candidates, inspection's drop proposals, and its own
removal decisions. It writes survivors to annotated.h5ad, preserves
integrated.h5ad, and records removed cells in annotation_removed.csv.
Can I continue or rerun an analysis?
Repeat the command to reuse completed steps and accepted cluster submissions.
Inspection decisions and cluster refinements are saved atomically; annotation
resumes the pending clusters after checking the saved input identity and each
decision. Changing models continues from accepted decisions. Use --force or
a new output directory to redo them. Rerunning an upstream stage archives and
invalidates downstream progress; see rerunning.
SIGTERM requests a pause after the current integration, inspection, or
annotation step. The CLI exits with code 3; repeat the command to resume.
Do I need OSP or ECA-RSI?
MSP runs independently with compatible inputs. OSP handles sample-level QC and annotation; ZMIP continues with closer analysis of individual lineages. ECA-RSI coordinates these steps and iterative review, starting from data prepared with ECA-PP.
Documentation
Read the user guide for input preparation, report reading, and reruns, or the developer guide for APIs, data fields, and stage contracts. A folder-based example runs MSP over OSP outputs. Questions and problems belong in GitHub Issues. MSP uses the MIT license.
Metadata
Release files for msp-sc 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| msp_sc-0.5.2.tar.gz | 135.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| msp_sc-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 240.0 kB
Release files / msp_sc-0.5.2.tar.gz
| Download URL | msp_sc-0.5.2.tar.gz |
|---|---|
| Size | 135.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f71633410df12babe5d0ddb2e217b6ed134974b0b2cbdd91ac471f63fcaced5
|
|
BLAKE2b-256 checksum How to use checksums |
b3153cef70173b9666a9e58a84371ba20b9c606b09a3b849e67d112513081a76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|
Release files / msp_sc-0.5.2-py3-none-any.whl
| Download URL | msp_sc-0.5.2-py3-none-any.whl |
|---|---|
| Size | 104.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60cb3c053bb8dada281596e237fead03ee0aeb11e5ad7ad2b687e676d6ccd854
|
|
BLAKE2b-256 checksum How to use checksums |
5d45bec3e5f115a2213bc9b75aec4a3aa84bcebb6e1b416503c60df7ad9f0660
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|