opencode-skills-collection 4.1.15 → 4.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/bundled-skills/.antigravity-install-manifest.json +1 -214
- package/bundled-skills/advanced-evaluation/SKILL.md +44 -21
- package/bundled-skills/ai-sre-incident-response/SKILL.md +4 -5
- package/bundled-skills/antigravity-maintainer-batch-release/SKILL.md +13 -77
- package/bundled-skills/api-integration/SKILL.md +22 -6
- package/bundled-skills/api-rate-limit-handler/SKILL.md +27 -34
- package/bundled-skills/awareness-stage-mapper/SKILL.md +1 -1
- package/bundled-skills/brand-perception-psychologist/SKILL.md +1 -1
- package/bundled-skills/content-strategy/SKILL.md +1 -1
- package/bundled-skills/content-strategy/references/headless-cms.md +3 -5
- package/bundled-skills/copywriting-psychologist/SKILL.md +1 -1
- package/bundled-skills/customer-psychographic-profiler/SKILL.md +1 -1
- package/bundled-skills/data-storytelling/SKILL.md +2 -4
- package/bundled-skills/deprecation-and-migration/SKILL.md +1 -3
- package/bundled-skills/emotional-arc-designer/SKILL.md +1 -1
- package/bundled-skills/glasser/SKILL.md +1 -1
- package/bundled-skills/headline-psychologist/SKILL.md +1 -1
- package/bundled-skills/identity-mirror/SKILL.md +1 -1
- package/bundled-skills/jobs-to-be-done-analyst/SKILL.md +1 -1
- package/bundled-skills/liuguang-banlan-ui/SKILL.md +18 -22
- package/bundled-skills/liuguang-banlan-ui/assets/starter/launcher.css +2 -2
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/index.html +4 -5
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme-config.js +10 -3
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme.css +62 -48
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/index.html +4 -5
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme-config.js +35 -27
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme.css +62 -48
- package/bundled-skills/liuguang-banlan-ui/assets/starter/shared/spectral-field.js +148 -135
- package/bundled-skills/liuguang-banlan-ui/references/style-contract.md +7 -26
- package/bundled-skills/liuguang-banlan-ui/references/verification.md +7 -19
- package/bundled-skills/liuguang-banlan-ui/scripts/measure_preview.py +47 -78
- package/bundled-skills/liuguang-banlan-ui/scripts/validate_manifest.py +3 -34
- package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package-lock.json +12 -16
- package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package.json +2 -4
- package/bundled-skills/loki-mode/examples/todo-app-generated/frontend/package-lock.json +15 -15
- package/bundled-skills/loki-mode/examples/todo-app-generated/frontend/package.json +2 -3
- package/bundled-skills/loss-aversion-designer/SKILL.md +1 -1
- package/bundled-skills/objection-preemptor/SKILL.md +1 -1
- package/bundled-skills/on-call-handoff-patterns/SKILL.md +4 -6
- package/bundled-skills/onboarding-cro/SKILL.md +2 -6
- package/bundled-skills/onboarding-psychologist/SKILL.md +1 -1
- package/bundled-skills/parallel-search-mcp/SKILL.md +0 -12
- package/bundled-skills/pitch-psychologist/SKILL.md +1 -1
- package/bundled-skills/price-psychology-strategist/SKILL.md +1 -1
- package/bundled-skills/python-testing-patterns/resources/implementation-playbook.md +2 -6
- package/bundled-skills/riffkit/SKILL.md +13 -22
- package/bundled-skills/scarcity-urgency-psychologist/SKILL.md +1 -1
- package/bundled-skills/seo-content-refresher/SKILL.md +4 -8
- package/bundled-skills/sequence-psychologist/SKILL.md +1 -1
- package/bundled-skills/social-proof-architect/SKILL.md +1 -1
- package/bundled-skills/subject-line-psychologist/SKILL.md +1 -1
- package/bundled-skills/system-prompt-lookup/SKILL.md +1 -1
- package/bundled-skills/telegram/assets/boilerplate/nodejs/package-lock.json +12 -16
- package/bundled-skills/telegram/assets/boilerplate/nodejs/package.json +2 -4
- package/bundled-skills/testing-patterns/SKILL.md +3 -2
- package/bundled-skills/trust-calibrator/SKILL.md +1 -1
- package/bundled-skills/typescript-expert/scripts/ts_diagnostic.py +19 -40
- package/bundled-skills/usage-based-pricing/SKILL.md +1 -3
- package/bundled-skills/usage-based-pricing/references/detailed-guide.md +9 -11
- package/bundled-skills/ux-persuasion-engineer/SKILL.md +1 -1
- package/bundled-skills/visual-emotion-engineer/SKILL.md +1 -1
- package/bundled-skills/waf-setup/SKILL.md +1 -1
- package/bundled-skills/wcag-audit-patterns/resources/implementation-playbook.md +8 -12
- package/bundled-skills/whatsapp-cloud-api/assets/boilerplate/nodejs/package-lock.json +12 -16
- package/bundled-skills/whatsapp-cloud-api/assets/boilerplate/nodejs/package.json +2 -4
- package/bundled-skills/youtube-summarizer/SKILL.md +3 -3
- package/package.json +1 -1
- package/skills_index.json +8846 -883
- package/bundled-skills/360-feedback-system/SKILL.md +0 -481
- package/bundled-skills/aas-compose-stack/SKILL.md +0 -39
- package/bundled-skills/aas-discover/SKILL.md +0 -35
- package/bundled-skills/aas-review-stack/SKILL.md +0 -37
- package/bundled-skills/access-matrix/SKILL.md +0 -338
- package/bundled-skills/accounting-audit-system-builder/SKILL.md +0 -302
- package/bundled-skills/accounting-audit-system-builder/references/catalog.md +0 -114
- package/bundled-skills/accounting-software-selection/SKILL.md +0 -427
- package/bundled-skills/accounting-software-selection/references/build-artifacts.md +0 -362
- package/bundled-skills/accounting-software-selection/references/common-pitfalls.md +0 -44
- package/bundled-skills/accounting-software-selection/references/field-reference.md +0 -93
- package/bundled-skills/accounting-software-selection/references/select-options.md +0 -202
- package/bundled-skills/admin-access-register/SKILL.md +0 -381
- package/bundled-skills/advanced-analytics-dashboard/SKILL.md +0 -318
- package/bundled-skills/agent-reels/SKILL.md +0 -107
- package/bundled-skills/ai-agent-evaluation-benchmarking/SKILL.md +0 -124
- package/bundled-skills/ai-agent-tool-routing/SKILL.md +0 -136
- package/bundled-skills/ai-code-generation-guardrails/SKILL.md +0 -142
- package/bundled-skills/ai-headshot-studio/SKILL.md +0 -267
- package/bundled-skills/ai-image-generation-studio/SKILL.md +0 -259
- package/bundled-skills/ai-logo-maker/SKILL.md +0 -259
- package/bundled-skills/ai-multilingual-dubbing/SKILL.md +0 -259
- package/bundled-skills/ai-photo-restyler/SKILL.md +0 -259
- package/bundled-skills/ai-podcast-voiceover/SKILL.md +0 -259
- package/bundled-skills/ai-prompt-regression-testing/SKILL.md +0 -130
- package/bundled-skills/alumni-re-hire-tracker/SKILL.md +0 -314
- package/bundled-skills/announcement-board/SKILL.md +0 -336
- package/bundled-skills/api-contract-testing/SKILL.md +0 -116
- package/bundled-skills/arcmira-find-quotes/SKILL.md +0 -89
- package/bundled-skills/arcmira-find-quotes/references/LICENSE.md +0 -202
- package/bundled-skills/ask-human-expert/SKILL.md +0 -141
- package/bundled-skills/assay/SKILL.md +0 -162
- package/bundled-skills/asset-it-management/SKILL.md +0 -407
- package/bundled-skills/attendance/SKILL.md +0 -331
- package/bundled-skills/audit-log/SKILL.md +0 -314
- package/bundled-skills/audit-preparation/SKILL.md +0 -416
- package/bundled-skills/axonx/SKILL.md +0 -374
- package/bundled-skills/axonx/references/LICENSE.md +0 -201
- package/bundled-skills/beatra/SKILL.md +0 -260
- package/bundled-skills/board-governance/SKILL.md +0 -360
- package/bundled-skills/brand-growth-system-builder/SKILL.md +0 -360
- package/bundled-skills/brand-kit-print-collateral/SKILL.md +0 -498
- package/bundled-skills/browser-extension-launch/SKILL.md +0 -102
- package/bundled-skills/browser-extension-launch/references/acceptance.md +0 -103
- package/bundled-skills/browser-extension-launch/references/complex-workflow.md +0 -46
- package/bundled-skills/browser-extension-launch/references/dependencies.md +0 -62
- package/bundled-skills/browser-extension-launch/references/development.md +0 -42
- package/bundled-skills/browser-extension-launch/references/efficient-delivery.md +0 -52
- package/bundled-skills/browser-extension-launch/references/host-compatibility.md +0 -58
- package/bundled-skills/browser-extension-launch/references/playwright-mcp.md +0 -102
- package/bundled-skills/browser-extension-launch/references/product-loop.md +0 -35
- package/bundled-skills/browser-extension-launch/references/publishing.md +0 -103
- package/bundled-skills/browser-extension-launch/references/required-skills.json +0 -153
- package/bundled-skills/browser-extension-launch/references/workflow.md +0 -71
- package/bundled-skills/buddy-program-manager/SKILL.md +0 -329
- package/bundled-skills/budget-cash-flow/SKILL.md +0 -352
- package/bundled-skills/build-ui/SKILL.md +0 -181
- package/bundled-skills/busabase/SKILL.md +0 -118
- package/bundled-skills/business-email-template/SKILL.md +0 -480
- package/bundled-skills/business-email-template/references/common-pitfalls.md +0 -30
- package/bundled-skills/business-website-setup/SKILL.md +0 -489
- package/bundled-skills/business-website-setup/references/common-pitfalls.md +0 -32
- package/bundled-skills/byagent/SKILL.md +0 -125
- package/bundled-skills/candidate-talent-pool/SKILL.md +0 -359
- package/bundled-skills/capacity-workload-planner/SKILL.md +0 -354
- package/bundled-skills/changelog-entry/SKILL.md +0 -141
- package/bundled-skills/clients-accounts/SKILL.md +0 -398
- package/bundled-skills/cline-pilot/README.md +0 -138
- package/bundled-skills/cline-pilot/SKILL.md +0 -301
- package/bundled-skills/cline-pilot/assets/global-memory-bank-prompt.en.md +0 -66
- package/bundled-skills/cline-pilot/assets/global-memory-bank-prompt.md +0 -56
- package/bundled-skills/cline-pilot/references/cold-start.md +0 -58
- package/bundled-skills/cline-pilot/references/decision-log.example.md +0 -9
- package/bundled-skills/cline-pilot/references/local-config.example.md +0 -26
- package/bundled-skills/cline-pilot/references/project-profiles.example.md +0 -10
- package/bundled-skills/cline-pilot/scripts/session_report.py +0 -151
- package/bundled-skills/cloudish/SKILL.md +0 -188
- package/bundled-skills/cockney/SKILL.md +0 -104
- package/bundled-skills/code-of-conduct/SKILL.md +0 -488
- package/bundled-skills/code-of-conduct/references/common-pitfalls.md +0 -31
- package/bundled-skills/company-email-accounts/SKILL.md +0 -404
- package/bundled-skills/competency-matrix/SKILL.md +0 -335
- package/bundled-skills/contract-document-renewal/SKILL.md +0 -396
- package/bundled-skills/course-upskilling-requests/SKILL.md +0 -354
- package/bundled-skills/court/SKILL.md +0 -141
- package/bundled-skills/court/references/jurors.json +0 -14
- package/bundled-skills/court/scripts/court.py +0 -348
- package/bundled-skills/credit-cycle-analysis/SKILL.md +0 -303
- package/bundled-skills/credit-cycle-analysis/references/best-practices.md +0 -35
- package/bundled-skills/credit-cycle-analysis/references/common-pitfalls.md +0 -5
- package/bundled-skills/credit-cycle-analysis/references/examples.md +0 -34
- package/bundled-skills/credit-cycle-analysis/references/field-reference.md +0 -47
- package/bundled-skills/credit-cycle-analysis/references/how-it-works.md +0 -494
- package/bundled-skills/credit-cycle-analysis/references/security-notes.md +0 -16
- package/bundled-skills/credit-cycle-analysis/references/select-options.md +0 -32
- package/bundled-skills/cross-chain-relayer-audit/SKILL.md +0 -136
- package/bundled-skills/csv-manual-export/SKILL.md +0 -499
- package/bundled-skills/csv-manual-export/references/common-pitfalls.md +0 -19
- package/bundled-skills/culture-retention/SKILL.md +0 -346
- package/bundled-skills/darkmoon-pentest/SKILL.md +0 -123
- package/bundled-skills/data-export-engine/SKILL.md +0 -308
- package/bundled-skills/data-privacy-controls/SKILL.md +0 -309
- package/bundled-skills/datacircle/SKILL.md +0 -141
- package/bundled-skills/day-book/SKILL.md +0 -499
- package/bundled-skills/day-book/references/best-practices.md +0 -32
- package/bundled-skills/day-book/references/common-pitfalls.md +0 -58
- package/bundled-skills/day-book/references/field-reference.md +0 -45
- package/bundled-skills/day-book/references/how-it-works.md +0 -7
- package/bundled-skills/day-book/references/related-skills.md +0 -18
- package/bundled-skills/day-book/references/relations.md +0 -14
- package/bundled-skills/day-book/references/reusable-prompt.md +0 -50
- package/bundled-skills/day-book/references/security-safety-notes.md +0 -19
- package/bundled-skills/day-book/references/select-options.md +0 -38
- package/bundled-skills/deep-research-framework/SKILL.md +0 -81
- package/bundled-skills/defi-yield-strategy-allocator/SKILL.md +0 -124
- package/bundled-skills/define-my-content-pillars/SKILL.md +0 -127
- package/bundled-skills/dei-dashboard/SKILL.md +0 -307
- package/bundled-skills/design-theme-guide/SKILL.md +0 -472
- package/bundled-skills/disciplinary-pip-tracker/SKILL.md +0 -345
- package/bundled-skills/document-management-system/SKILL.md +0 -328
- package/bundled-skills/draft-my-comments/SKILL.md +0 -132
- package/bundled-skills/dropthehassle-publish/SKILL.md +0 -151
- package/bundled-skills/ecommerce-listing-image-set/SKILL.md +0 -259
- package/bundled-skills/email-marketing-bible/SKILL.md +0 -413
- package/bundled-skills/employee-suggestion-hub/SKILL.md +0 -322
- package/bundled-skills/equibles/SKILL.md +0 -185
- package/bundled-skills/esop-equity-tracker/SKILL.md +0 -331
- package/bundled-skills/etsy-search-listings/SKILL.md +0 -122
- package/bundled-skills/etsy-shop-sales-history/SKILL.md +0 -119
- package/bundled-skills/events-activities/SKILL.md +0 -355
- package/bundled-skills/expense-accounting/SKILL.md +0 -496
- package/bundled-skills/expense-accounting/references/common-pitfalls.md +0 -41
- package/bundled-skills/expense-accounting/references/related-skills.md +0 -11
- package/bundled-skills/expense-accounting/references/reusable-prompt.md +0 -36
- package/bundled-skills/expense-management/SKILL.md +0 -351
- package/bundled-skills/five-axis-code-review/SKILL.md +0 -78
- package/bundled-skills/free-design-resources/SKILL.md +0 -480
- package/bundled-skills/free-design-resources/references/common-pitfalls.md +0 -44
- package/bundled-skills/free-design-resources/references/related-skills.md +0 -24
- package/bundled-skills/free-design-resources/references/reusable-prompt.md +0 -12
- package/bundled-skills/fxmacrodata/SKILL.md +0 -224
- package/bundled-skills/gamification-engine/SKILL.md +0 -307
- package/bundled-skills/gbp-local-seo-intent/SKILL.md +0 -466
- package/bundled-skills/gbp-local-seo-intent/references/best-practices.md +0 -41
- package/bundled-skills/gbp-local-seo-intent/references/common-pitfalls.md +0 -40
- package/bundled-skills/gbp-local-seo-intent/references/related-skills.md +0 -17
- package/bundled-skills/gbp-local-seo-intent/references/reusable-prompt.md +0 -11
- package/bundled-skills/gbp-local-seo-intent/references/security-safety-notes.md +0 -27
- package/bundled-skills/get-seen-in-replies/SKILL.md +0 -134
- package/bundled-skills/git-commit-message/SKILL.md +0 -76
- package/bundled-skills/health-wellness/SKILL.md +0 -334
- package/bundled-skills/idea-to-blueprint/LICENSE +0 -21
- package/bundled-skills/idea-to-blueprint/SKILL.md +0 -260
- package/bundled-skills/idea-to-blueprint/assets/AGENTS.md.template +0 -38
- package/bundled-skills/idea-to-blueprint/assets/CLAUDE.md.template +0 -38
- package/bundled-skills/idea-to-blueprint/assets/DECISIONS.md.template +0 -14
- package/bundled-skills/idea-to-blueprint/assets/PROGRESS.md.template +0 -47
- package/bundled-skills/idea-to-blueprint/assets/session-prompt.md +0 -23
- package/bundled-skills/idea-to-blueprint/references/architecture-decisions.md +0 -202
- package/bundled-skills/idea-to-blueprint/references/blueprint-template.md +0 -259
- package/bundled-skills/idea-to-blueprint/references/code-quality-and-review.md +0 -216
- package/bundled-skills/idea-to-blueprint/references/design-minimal.md +0 -96
- package/bundled-skills/idea-to-blueprint/references/edge-case-catalog.md +0 -239
- package/bundled-skills/idea-to-blueprint/references/intake-questions.md +0 -105
- package/bundled-skills/idea-to-blueprint/references/research-protocol.md +0 -196
- package/bundled-skills/idea-to-blueprint/references/session-protocol.md +0 -133
- package/bundled-skills/idea-to-blueprint/references/stories-ac-tests.md +0 -194
- package/bundled-skills/idea-to-blueprint/references/ux-writing-guide.md +0 -128
- package/bundled-skills/idea-to-blueprint/scripts/lint_blueprint.py +0 -460
- package/bundled-skills/intern-program/SKILL.md +0 -354
- package/bundled-skills/internal-communication/SKILL.md +0 -318
- package/bundled-skills/inventory-stock-reconciliation/SKILL.md +0 -470
- package/bundled-skills/inventory-stock-reconciliation/references/best-practices.md +0 -18
- package/bundled-skills/inventory-stock-reconciliation/references/common-pitfalls.md +0 -42
- package/bundled-skills/inventory-stock-reconciliation/references/related-skills.md +0 -13
- package/bundled-skills/inventory-stock-reconciliation/references/relations.md +0 -8
- package/bundled-skills/inventory-stock-reconciliation/references/reusable-prompt.md +0 -31
- package/bundled-skills/inventory-stock-reconciliation/references/security-safety-notes.md +0 -17
- package/bundled-skills/inventory-stock-reconciliation/references/select-options.md +0 -45
- package/bundled-skills/invoices-billing/SKILL.md +0 -385
- package/bundled-skills/invokely-statistics/SKILL.md +0 -124
- package/bundled-skills/invokely-statistics/references/LICENSE.md +0 -21
- package/bundled-skills/ios-screens/SKILL.md +0 -172
- package/bundled-skills/issue-grievance-tracker/SKILL.md +0 -400
- package/bundled-skills/jet-browser/SKILL.md +0 -155
- package/bundled-skills/json-schema-manual/SKILL.md +0 -309
- package/bundled-skills/json-schema-manual/references/best-practices.md +0 -9
- package/bundled-skills/json-schema-manual/references/common-pitfalls.md +0 -25
- package/bundled-skills/json-schema-manual/references/input-modules.md +0 -203
- package/bundled-skills/json-schema-manual/references/related-skills.md +0 -8
- package/bundled-skills/json-schema-manual/references/reusable-prompt.md +0 -10
- package/bundled-skills/json-schema-manual/references/security-safety-notes.md +0 -13
- package/bundled-skills/kernel-prompt/SKILL.md +0 -64
- package/bundled-skills/knowledge-base/SKILL.md +0 -318
- package/bundled-skills/kpi-tracker/SKILL.md +0 -345
- package/bundled-skills/learning-career-development/SKILL.md +0 -349
- package/bundled-skills/leave-management/SKILL.md +0 -341
- package/bundled-skills/legal-compliance-vault/SKILL.md +0 -324
- package/bundled-skills/linkdigest-social-link-reader/SKILL.md +0 -232
- package/bundled-skills/linktree-link-hub/SKILL.md +0 -453
- package/bundled-skills/liuguang-banlan-ui/scripts/serve_preview.py +0 -35
- package/bundled-skills/liuguang-banlan-ui/tests/test_measure_preview.py +0 -119
- package/bundled-skills/liuguang-banlan-ui/tests/test_serve_preview.py +0 -38
- package/bundled-skills/liuguang-banlan-ui/tests/test_validate_manifest.py +0 -73
- package/bundled-skills/lognorm/SKILL.md +0 -86
- package/bundled-skills/lognorm/references/playbooks.md +0 -76
- package/bundled-skills/logo-image-design/SKILL.md +0 -459
- package/bundled-skills/looot/SKILL.md +0 -188
- package/bundled-skills/mcd-secret-menu-lab/SKILL.md +0 -110
- package/bundled-skills/meeting-notes/SKILL.md +0 -80
- package/bundled-skills/mentorship-program/SKILL.md +0 -332
- package/bundled-skills/mirrord/SKILL.md +0 -90
- package/bundled-skills/monthly-closing-statements/SKILL.md +0 -488
- package/bundled-skills/monthly-closing-statements/references/related-skills.md +0 -17
- package/bundled-skills/monthly-closing-statements/references/reusable-prompt.md +0 -8
- package/bundled-skills/music-generation-studio/SKILL.md +0 -259
- package/bundled-skills/notification-reminder-hub/SKILL.md +0 -324
- package/bundled-skills/notion-manual-import/SKILL.md +0 -376
- package/bundled-skills/notion-manual-import/references/best-practices.md +0 -10
- package/bundled-skills/notion-manual-import/references/common-pitfalls.md +0 -26
- package/bundled-skills/notion-manual-import/references/input-modules.md +0 -203
- package/bundled-skills/notion-manual-import/references/related-skills.md +0 -7
- package/bundled-skills/notion-manual-import/references/reusable-prompt.md +0 -8
- package/bundled-skills/notion-manual-import/references/security-safety-notes.md +0 -15
- package/bundled-skills/observability-cloud-planning/SKILL.md +0 -487
- package/bundled-skills/observability-cloud-planning/references/common-pitfalls.md +0 -39
- package/bundled-skills/observability-cloud-planning/references/related-skills.md +0 -20
- package/bundled-skills/observability-cloud-planning/references/reusable-prompt.md +0 -12
- package/bundled-skills/observability-cloud-planning/references/security-safety-notes.md +0 -30
- package/bundled-skills/offboarding-exit/SKILL.md +0 -343
- package/bundled-skills/offer-appointment/SKILL.md +0 -351
- package/bundled-skills/okr-system/SKILL.md +0 -355
- package/bundled-skills/omentir-linkedin-outreach/SKILL.md +0 -96
- package/bundled-skills/onboarding-playbook/SKILL.md +0 -292
- package/bundled-skills/organization-design/SKILL.md +0 -324
- package/bundled-skills/party-ledger-reconciliation/SKILL.md +0 -411
- package/bundled-skills/payment-accounting/SKILL.md +0 -421
- package/bundled-skills/payments-received/SKILL.md +0 -315
- package/bundled-skills/payroll-finance/SKILL.md +0 -351
- package/bundled-skills/people-directory/SKILL.md +0 -459
- package/bundled-skills/performance-management/SKILL.md +0 -367
- package/bundled-skills/petty-cash-management/SKILL.md +0 -448
- package/bundled-skills/placecall/SKILL.md +0 -237
- package/bundled-skills/policy-acknowledgement/SKILL.md +0 -314
- package/bundled-skills/policy-library/SKILL.md +0 -327
- package/bundled-skills/poster-design-studio/SKILL.md +0 -259
- package/bundled-skills/pre-boarding/SKILL.md +0 -326
- package/bundled-skills/presentation-deck/SKILL.md +0 -491
- package/bundled-skills/presentation-deck/references/related-skills.md +0 -19
- package/bundled-skills/presentation-deck/references/reusable-prompt.md +0 -11
- package/bundled-skills/probation-tracker/SKILL.md +0 -347
- package/bundled-skills/product-photo-studio/SKILL.md +0 -259
- package/bundled-skills/project-based-performance/SKILL.md +0 -323
- package/bundled-skills/projects-work-management/SKILL.md +0 -368
- package/bundled-skills/promotion-upgrade-requests/SKILL.md +0 -377
- package/bundled-skills/purchase-accounting/SKILL.md +0 -414
- package/bundled-skills/qrx/SKILL.md +0 -131
- package/bundled-skills/qrx/references/prompt-guide.md +0 -30
- package/bundled-skills/qrx/references/rest-api.md +0 -40
- package/bundled-skills/receipt-accounting/SKILL.md +0 -424
- package/bundled-skills/recognition-rewards/SKILL.md +0 -324
- package/bundled-skills/recruitment-pipeline/SKILL.md +0 -399
- package/bundled-skills/remote-work-tracker/SKILL.md +0 -306
- package/bundled-skills/repo-foundation/SKILL.md +0 -166
- package/bundled-skills/repo-foundation/references/LICENSE.md +0 -21
- package/bundled-skills/repo-foundation/references/bootstrap.md +0 -63
- package/bundled-skills/repo-foundation/references/companion.md +0 -9
- package/bundled-skills/repo-foundation/references/continuity.md +0 -50
- package/bundled-skills/repo-foundation/references/evolution.md +0 -60
- package/bundled-skills/repo-foundation/references/migration-examples.md +0 -53
- package/bundled-skills/repo-foundation/references/shared-contracts.md +0 -48
- package/bundled-skills/repo-foundation/references/verification.md +0 -50
- package/bundled-skills/repo-native-refactor/SKILL.md +0 -225
- package/bundled-skills/repo-native-refactor/references/LICENSE.md +0 -21
- package/bundled-skills/repo-native-refactor/references/deterministic-tooling.md +0 -101
- package/bundled-skills/repo-native-refactor/references/error-reliability.md +0 -117
- package/bundled-skills/repo-native-refactor/references/finding-taxonomy.md +0 -181
- package/bundled-skills/repo-native-refactor/references/refactor-examples.md +0 -77
- package/bundled-skills/repo-native-refactor/references/repository-prose.md +0 -157
- package/bundled-skills/repo-native-refactor/references/repository-rehabilitation.md +0 -94
- package/bundled-skills/repo-native-refactor/references/semantic-risk.md +0 -187
- package/bundled-skills/repo-native-refactor/references/shared-contracts.md +0 -48
- package/bundled-skills/repo-native-refactor/references/testing-integrity.md +0 -103
- package/bundled-skills/reports-analytics/SKILL.md +0 -320
- package/bundled-skills/repurpose-into-a-post/SKILL.md +0 -134
- package/bundled-skills/reverse-engineer-anything/SKILL.md +0 -243
- package/bundled-skills/reverse-engineer-anything/references/android-applications.md +0 -34
- package/bundled-skills/reverse-engineer-anything/references/evidence-workflows.md +0 -40
- package/bundled-skills/reverse-engineer-anything/references/javascript-applications.md +0 -70
- package/bundled-skills/reverse-engineer-anything/references/native-and-artifacts.md +0 -146
- package/bundled-skills/reverse-engineer-anything/references/runtime-observation.md +0 -28
- package/bundled-skills/salary-benchmarking/SKILL.md +0 -318
- package/bundled-skills/salary-wage-accounting/SKILL.md +0 -412
- package/bundled-skills/sales-accounting/SKILL.md +0 -494
- package/bundled-skills/sales-accounting/references/common-pitfalls.md +0 -28
- package/bundled-skills/sales-accounting/references/related-skills.md +0 -13
- package/bundled-skills/sales-accounting/references/reusable-prompt.md +0 -8
- package/bundled-skills/same-idea-both-platforms/SKILL.md +0 -111
- package/bundled-skills/scarf-single-cell/SKILL.md +0 -326
- package/bundled-skills/scarf-single-cell/references/LICENSE.md +0 -29
- package/bundled-skills/scarf-single-cell/references/clustering-and-embedding.md +0 -270
- package/bundled-skills/scarf-single-cell/references/data-access.md +0 -269
- package/bundled-skills/scarf-single-cell/references/features-and-graphs.md +0 -279
- package/bundled-skills/scarf-single-cell/references/gene-blacklists.md +0 -182
- package/bundled-skills/scarf-single-cell/references/integration-and-comparisons.md +0 -295
- package/bundled-skills/scarf-single-cell/references/markers-and-annotation.md +0 -280
- package/bundled-skills/scarf-single-cell/references/performance-and-export.md +0 -291
- package/bundled-skills/scarf-single-cell/references/pipeline-runs-and-artifacts.md +0 -273
- package/bundled-skills/scarf-single-cell/references/plotting.md +0 -260
- package/bundled-skills/scarf-single-cell/references/quality-control.md +0 -290
- package/bundled-skills/seo-directory-backlinks/SKILL.md +0 -484
- package/bundled-skills/seo-directory-backlinks/references/common-pitfalls.md +0 -36
- package/bundled-skills/seo-directory-backlinks/references/related-skills.md +0 -15
- package/bundled-skills/seo-directory-backlinks/references/reusable-prompt.md +0 -11
- package/bundled-skills/session-handoff/SKILL.md +0 -112
- package/bundled-skills/shark/SKILL.md +0 -134
- package/bundled-skills/shark/references/investors.json +0 -12
- package/bundled-skills/shark/scripts/shark.py +0 -302
- package/bundled-skills/shipvela-publish/SKILL.md +0 -80
- package/bundled-skills/shipvela-publish/references/LICENSE.md +0 -21
- package/bundled-skills/since-cutoff/SKILL.md +0 -68
- package/bundled-skills/skeleton-first/SKILL.md +0 -163
- package/bundled-skills/skill-gap-analysis/SKILL.md +0 -338
- package/bundled-skills/smart-contract-formal-verification/SKILL.md +0 -136
- package/bundled-skills/smart-contract-upgrade-governance/SKILL.md +0 -130
- package/bundled-skills/social-media-setup/SKILL.md +0 -477
- package/bundled-skills/social-media-setup/references/common-pitfalls.md +0 -34
- package/bundled-skills/social-media-setup/references/related-skills.md +0 -19
- package/bundled-skills/social-media-setup/references/reusable-prompt.md +0 -11
- package/bundled-skills/social-media-setup/references/security-safety-notes.md +0 -27
- package/bundled-skills/sop-company-wiki/SKILL.md +0 -324
- package/bundled-skills/soroban-contract-audit/SKILL.md +0 -136
- package/bundled-skills/soroban-liquidity-pool/SKILL.md +0 -118
- package/bundled-skills/soroban-oracle-data-feed-audit/SKILL.md +0 -118
- package/bundled-skills/soroban-storage-ttl-lifecycle/SKILL.md +0 -118
- package/bundled-skills/soroban-token-minter/SKILL.md +0 -124
- package/bundled-skills/source-document-filing/SKILL.md +0 -368
- package/bundled-skills/spreadsheet-manual-build/SKILL.md +0 -493
- package/bundled-skills/spreadsheet-manual-build/references/best-practices.md +0 -9
- package/bundled-skills/spreadsheet-manual-build/references/common-pitfalls.md +0 -22
- package/bundled-skills/spreadsheet-manual-build/references/related-skills.md +0 -8
- package/bundled-skills/spreadsheet-manual-build/references/reusable-prompt.md +0 -9
- package/bundled-skills/spreadsheet-manual-build/references/security-safety-notes.md +0 -16
- package/bundled-skills/stakeholder-investor-reports/SKILL.md +0 -303
- package/bundled-skills/stellar-anchor-integration/SKILL.md +0 -136
- package/bundled-skills/stellar-asset-clawback-compliance/SKILL.md +0 -118
- package/bundled-skills/stellar-escrow-timelock/SKILL.md +0 -118
- package/bundled-skills/stellar-multisig-threshold-coordinator/SKILL.md +0 -112
- package/bundled-skills/suno-lyrics-to-song/SKILL.md +0 -259
- package/bundled-skills/supercov/SKILL.md +0 -119
- package/bundled-skills/talking-avatar-video/SKILL.md +0 -260
- package/bundled-skills/tastegate/SKILL.md +0 -129
- package/bundled-skills/tastegate/references/THIRD_PARTY_NOTICES.md +0 -25
- package/bundled-skills/tastegate/references/craft-floor.md +0 -53
- package/bundled-skills/tastegate/references/direction.md +0 -59
- package/bundled-skills/tastegate/references/impeccable-LICENSE-Apache-2.0.txt +0 -191
- package/bundled-skills/tastegate/references/taste-skill-LICENSE-MIT.txt +0 -21
- package/bundled-skills/tastegate/scripts/gate.py +0 -401
- package/bundled-skills/tax-register/SKILL.md +0 -363
- package/bundled-skills/tds-booking-payment/SKILL.md +0 -405
- package/bundled-skills/team-calendar/SKILL.md +0 -312
- package/bundled-skills/tech-writing-proofread/SKILL.md +0 -78
- package/bundled-skills/telegram-channel-ads/SKILL.md +0 -139
- package/bundled-skills/template-library/SKILL.md +0 -304
- package/bundled-skills/time-tracking/SKILL.md +0 -353
- package/bundled-skills/tokenleak/SKILL.md +0 -79
- package/bundled-skills/turn-this-into-a-thread/SKILL.md +0 -130
- package/bundled-skills/ui-from-screenshot/SKILL.md +0 -147
- package/bundled-skills/ui-states/SKILL.md +0 -149
- package/bundled-skills/url-to-markdown/SKILL.md +0 -74
- package/bundled-skills/uxkin-research/SKILL.md +0 -127
- package/bundled-skills/vendor-contractor-management/SKILL.md +0 -327
- package/bundled-skills/viral-video-teardown-remake/SKILL.md +0 -260
- package/bundled-skills/voice-cloning-studio/SKILL.md +0 -260
- package/bundled-skills/voiceover-narration-studio/SKILL.md +0 -259
- package/bundled-skills/web3-rate-limiting-circuit-breaker/SKILL.md +0 -130
- package/bundled-skills/web3-transaction-relayer-pool/SKILL.md +0 -124
- package/bundled-skills/what-could-break/SKILL.md +0 -128
- package/bundled-skills/what-could-break/references/LICENSE-pstack.txt +0 -21
- package/bundled-skills/why-did-this-post-flop/SKILL.md +0 -130
- package/bundled-skills/write-design-md/SKILL.md +0 -158
- package/bundled-skills/write-in-my-voice/SKILL.md +0 -140
- package/bundled-skills/zk-proof-verification-pipeline/SKILL.md +0 -124
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: scarf-single-cell
|
|
3
|
-
description: "Analyze single-cell RNA-seq at million-cell scale with Scarf: out-of-core Zarr stores on disk or object storage, provenance-tracked artifacts, audited QC, clustering, markers and donor comparisons."
|
|
4
|
-
category: science
|
|
5
|
-
risk: critical
|
|
6
|
-
source: "https://github.com/NygenAnalytics/scarf/tree/master/skills/scarf-single-cell"
|
|
7
|
-
source_repo: NygenAnalytics/scarf
|
|
8
|
-
source_type: official
|
|
9
|
-
date_added: "2026-10-05"
|
|
10
|
-
author: NygenAnalytics
|
|
11
|
-
license: BSD-3-Clause
|
|
12
|
-
license_source: "https://github.com/NygenAnalytics/scarf/blob/master/LICENSE"
|
|
13
|
-
compatibility: Requires Python 3.12+ and scarf 1.0.0rc17 or newer (pip install "scarf[extra]>=1.0.0rc17"; add the cytebase extra and network access for Cytebase datasets).
|
|
14
|
-
metadata:
|
|
15
|
-
version: "0.4"
|
|
16
|
-
tags: [single-cell, scrna-seq, bioinformatics, genomics, zarr, out-of-core, python]
|
|
17
|
-
tools: [claude, codex, cursor, gemini]
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
# Scarf single-cell analysis
|
|
21
|
-
|
|
22
|
-
Scarf streams Zarr-backed count matrices in bounded blocks and records every computation as an
|
|
23
|
-
immutable, content-addressed artifact. This skill encodes how to drive core Scarf for single-cell
|
|
24
|
-
RNA analysis: which calls to make, in what order, what evidence to check, and what not to do.
|
|
25
|
-
It does not use or describe `scarf.agent`.
|
|
26
|
-
|
|
27
|
-
Read this file first. Then open only the reference modules you need (index below). Paths in this
|
|
28
|
-
skill are relative to the skill directory. The maintained copy lives in the Scarf repository at
|
|
29
|
-
<https://github.com/NygenAnalytics/scarf/tree/master/skills/scarf-single-cell>.
|
|
30
|
-
Every recipe in the modules was run against a real store. Numbers quoted there come from the 10x
|
|
31
|
-
5K PBMC documentation dataset and are illustrations, not thresholds.
|
|
32
|
-
|
|
33
|
-
## When to Use This Skill
|
|
34
|
-
|
|
35
|
-
- Use when a task involves a Scarf `.zarr` store, `scarf.DataStore`, `ds.pipeline` or a
|
|
36
|
-
`PipelineRun`.
|
|
37
|
-
- Use when converting H5AD, 10x, MTX or Seurat data into a Scarf store, or opening and mounting a
|
|
38
|
-
Cytebase dataset.
|
|
39
|
-
- Use for single-cell RNA-seq analysis with core Scarf: QC with removal audits, HVG, PCA and
|
|
40
|
-
neighbour graphs, Leiden and Paris clustering, UMAP, markers and cautious annotation, batch
|
|
41
|
-
correction, donor-level comparisons, headless plotting, provenance and export.
|
|
42
|
-
- Use when counts are too large for memory or live on object storage, so they must be streamed
|
|
43
|
-
under an explicit memory budget.
|
|
44
|
-
- Do not use it for `scarf.agent` (the automated agent package), which this skill does not cover.
|
|
45
|
-
|
|
46
|
-
## Setup
|
|
47
|
-
|
|
48
|
-
- Install into the environment you run Python from: `pip install "scarf[extra]>=1.0.0rc17"`, plus
|
|
49
|
-
`scarf[cytebase]` for Cytebase. The explicit pre-release floor matters: a bare `scarf[extra]` resolves
|
|
50
|
-
to the old 0.32 series, whose API this skill does not describe.
|
|
51
|
-
- Set resources per process before importing Scarf. Defaults claim all detected RAM and every CPU:
|
|
52
|
-
`SCARF_MEM_BUDGET=8G SCARF_WORKERS=8` (memory specs need a unit; a bare `8` is rejected).
|
|
53
|
-
- Headless: `MPLBACKEND=Agg`, call plots with `show=False`, then `result.save(path)` and
|
|
54
|
-
`result.close()`.
|
|
55
|
-
- Quiet logs for scripts: `scarf.configure_output(level="WARNING", progress=False)`.
|
|
56
|
-
- First look at a store: open it read-only and follow "Open and inspect a store"
|
|
57
|
-
(`references/data-access.md`) and "Check the matrix first" (`references/quality-control.md`)
|
|
58
|
-
for cell and feature counts, runs, artifact kinds and whether counts look raw. Then review every
|
|
59
|
-
metadata column yourself: design columns (donor, sample, batch, condition), author annotations to
|
|
60
|
-
hold out (rule 14) and author-derived columns. The maintained copy of this skill in the Scarf
|
|
61
|
-
repository also ships `scripts/inspect_store.py`, a read-only command that runs these checks and
|
|
62
|
-
flags those columns by name (annotation values stay hidden unless you pass
|
|
63
|
-
`--show-annotation-values`). This catalogue copy is Markdown only and does not include the script.
|
|
64
|
-
- Long steps (a pipeline run on tens of thousands of cells over remote counts can take many
|
|
65
|
-
minutes): write the step as a script that logs to a file and ends with a `DONE` or `FAILED` line,
|
|
66
|
-
run it in the background, and wait with a bounded loop that also stops on a `Traceback` or a dead
|
|
67
|
-
process. If you launch through a wrapper such as `uv run`, put `timeout` inside it
|
|
68
|
-
(`uv run timeout N python step.py`; the reverse can leave stale `running` records), and track the process by `$!` rather than `pgrep -f`. See
|
|
69
|
-
`references/performance-and-export.md`. Never poll without a time limit.
|
|
70
|
-
|
|
71
|
-
## Mental model
|
|
72
|
-
|
|
73
|
-
- A **DataStore** is one Zarr directory: a shared cell table `ds.cells`, one group per assay
|
|
74
|
-
(`ds.RNA`, feature table `ds.RNA.feats`, counts as cell-major `counts` plus gene-major `countsT`),
|
|
75
|
-
artifacts, and `pipeline/runs`. QC columns are assay-prefixed: `RNA_nCounts`, `RNA_nFeatures`,
|
|
76
|
-
`RNA_percentMito`, `RNA_percentRibo`.
|
|
77
|
-
- **`I`** is the live boolean cell key. Analytical filters never edit it; they return a frozen
|
|
78
|
-
**cell selection** artifact.
|
|
79
|
-
- Every result is an **`ArtifactRef`** (`scope`, `kind`, `artifact_id`, `assay`). Producers take refs
|
|
80
|
-
and return refs: `select_hvgs -> run_normalization -> run_pca -> build_ann_index ->
|
|
81
|
-
query_neighbors -> build_connectivity_map -> run_leiden_clustering / run_umap ->
|
|
82
|
-
run_marker_search`. An identical call returns the existing artifact without recomputing.
|
|
83
|
-
- **`ds.pipeline.run(label=...)`** runs that whole RNA recipe (filtering, cell cycle, HVG,
|
|
84
|
-
normalization, PCA, graph, UMAP, Leiden at 0.5/0.75/1.0/1.25 with a silhouette pick, Paris,
|
|
85
|
-
doublet scores, markers) and returns a durable **`PipelineRun`**: a mapping of output names to
|
|
86
|
-
refs plus frozen `run.cells` / `run.features` views and `run.report()`.
|
|
87
|
-
- Artifact payload rows follow the artifact's **cell selection**, not `ds.cells.N`.
|
|
88
|
-
- A **mount** is a local writable store whose counts stay in a remote source (`matrixSource`).
|
|
89
|
-
Every pass over counts is a network read; artifacts are written locally.
|
|
90
|
-
|
|
91
|
-
## Golden rules
|
|
92
|
-
|
|
93
|
-
1. **Inspect read-only first.** `scarf.DataStore(path, zarr_mode="r")` writes nothing. A writable
|
|
94
|
-
open (the default) prepares new stores and applies `min_features_per_cell` (default 10) to `I`
|
|
95
|
-
permanently. Reopen existing stores and mounts with
|
|
96
|
-
`scarf.DataStore(path, min_features_per_cell=-1)`.
|
|
97
|
-
2. **Never filter by editing `I`.** Keep the `cell_selection` ref a filter returns and pass it on, or
|
|
98
|
-
insert a boolean column and use `cell_key=`. `ds.cells.reset_key("I")` undoes an accidental
|
|
99
|
-
open-time filter.
|
|
100
|
-
3. **Keep every ref you will reuse in a dict** and record them. Never guess artifact IDs or read
|
|
101
|
-
private Zarr paths. Use `ds.inspect_artifact(ref)`, `ds.load_artifact(ref)` and
|
|
102
|
-
`ds.list_artifacts(...)`. Cell selections need `scope="datastore"` when listing.
|
|
103
|
-
4. **Check the matrix, then audit QC removals before accepting a filter.** Published matrices can
|
|
104
|
-
be corrected (for example SCTransform) or already filtered, which makes QC bounds meaningless;
|
|
105
|
-
the read-only checks in `references/quality-control.md` ("Check the matrix first") report
|
|
106
|
-
this. Pooled MAD filters routinely remove low-complexity populations (platelets,
|
|
107
|
-
erythrocytes, neutrophils) and high-RNA ones (plasma, cycling cells).
|
|
108
|
-
Audit retention per sample and per marker-defined group without author labels, and look at the
|
|
109
|
-
markers of removed cells (`references/quality-control.md`).
|
|
110
|
-
5. **Labels are immutable and runs cannot be resumed.** Use a new `label` for every variant. A rerun
|
|
111
|
-
reuses every complete artifact, so it is cheap. Choose `snapshot_columns` (design columns you
|
|
112
|
-
want inside `run.cells` and exports) on the first run, because changing them recomputes
|
|
113
|
-
everything downstream.
|
|
114
|
-
6. **Read pipeline outputs instead of recomputing them.** `run["markers"]`, `run["cell_cycle"]` and
|
|
115
|
-
`run["doublets"]` already exist. A direct `run_marker_search(run["clusters"], ...)` creates a new
|
|
116
|
-
artifact and rereads all counts.
|
|
117
|
-
7. **Align arrays through the cell selection.** Use `run.cells.fetch(...)` (run cells only) or
|
|
118
|
-
`fetch_all(...)` (full length, with -1, NaN or "" outside the run). For explicit artifacts use
|
|
119
|
-
`ds.inspect_artifact(ref).input_ref("cell_selection")`. Join tables on cell `ids`, never on row
|
|
120
|
-
order.
|
|
121
|
-
8. **Budget count passes on mounts.** QC metrics, the HVG summary, normalization per selection,
|
|
122
|
-
markers, gene plots and AUCell each read counts. For many passes, make a local copy once:
|
|
123
|
-
`python -m scarf.tools.repack_zarr MOUNT.zarr LOCAL.zarr --mem-budget 4G`.
|
|
124
|
-
9. **One DataStore per process; it is not thread-safe.** Run parallel analyses in separate
|
|
125
|
-
processes on separate stores, each with its own `SCARF_MEM_BUDGET`/`SCARF_WORKERS`.
|
|
126
|
-
10. **Payload names differ by kind.** Leiden labels, embeddings, doublet and strength scores live
|
|
127
|
-
under `values`; Paris (`cluster_cut`) under `labels`; PCA under `data`. `get_markers` returns
|
|
128
|
-
string `group_id` while Leiden labels are integers.
|
|
129
|
-
11. **`get_markers` defaults hide genes.** `min_score=0.25, min_frac_exp=0.2`; pass `-1` for both
|
|
130
|
-
to see negatives and full panels.
|
|
131
|
-
12. **Labels are hypotheses.** Name a cluster only with two or more specific positive markers plus
|
|
132
|
-
low lineage-negative markers and a plausible QC and doublet profile. Keep `unresolved` for
|
|
133
|
-
mixed, doublet-like or marker-poor clusters.
|
|
134
|
-
13. **Cells are not replicates, and Scarf does not check your design.** Condition claims need
|
|
135
|
-
donor-level aggregation and at least two independent donors per group. A donor sampled twice is
|
|
136
|
-
repeated measures. A donor with samples in two arms must not count in both:
|
|
137
|
-
`run_statistical_testing(sample_by="sample_id")` silently does that, while `sample_by="donor_id"`
|
|
138
|
-
refuses such a design. `run_harmony` runs silently on a column confounded with the biology you
|
|
139
|
-
want to compare, so audit donors x batch x condition first. When inserting design columns, replace
|
|
140
|
-
missing values explicitly: `ds.cells.insert` stores `None` as `""` and `pd.NA` as `"<NA>"`.
|
|
141
|
-
14. **Hold out annotation columns when they will judge the result.** Do not use author labels
|
|
142
|
-
(`cell_type`, `author_cell_type`, `cell.type.*`, `singler`, `predicted.*`, ...) to choose QC,
|
|
143
|
-
parameters or labels. Use them only in a final, clearly separated comparison.
|
|
144
|
-
15. **Pass an explicit HVG blacklist.** On stores with current gene symbols the default blacklist
|
|
145
|
-
misses replication-dependent histones (`^HIST` matches only pre-2020 names), and its `^CCN`
|
|
146
|
-
family removes the CCN1-6 matricellular genes and non-cell-cycle cyclins. It also leaves Ig V/J
|
|
147
|
-
genes in, which can split plasma cells by light chain instead of biology. Use the species string
|
|
148
|
-
from `references/gene-blacklists.md` (`params={"hvg": {"blacklist": ...}}` in the pipeline). Add
|
|
149
|
-
the clonotype add-on only on marker evidence. A `blacklist=` string replaces the default
|
|
150
|
-
entirely, and changing it creates new HVG, PCA and graph artifacts.
|
|
151
|
-
|
|
152
|
-
## The analysis loop
|
|
153
|
-
|
|
154
|
-
Work in this order. After each step, write the decision and its evidence to an analysis log.
|
|
155
|
-
|
|
156
|
-
| Step | Do | Evidence to record | Module |
|
|
157
|
-
|---|---|---|---|
|
|
158
|
-
| 1. Inspect | read-only open, `ds.summary()`, metadata column profile, existing runs; check raw versus corrected counts | cells, assays, mounted or local, count type, metadata roles | `data-access.md`, `quality-control.md` |
|
|
159
|
-
| 2. Design | identify donor, sample, capture, batch and condition columns; derive missing units | unit of inference, confounding, held-out columns | `integration-and-comparisons.md` |
|
|
160
|
-
| 3. QC | inspect distributions; compare policies; audit removals | chosen policy, cells kept per group, what was removed | `quality-control.md` |
|
|
161
|
-
| 4. Baseline | `ds.pipeline.run(label=..., filtering=<chosen>, snapshot_columns=<design>)` | run id, report, kept cells | `pipeline-runs-and-artifacts.md` |
|
|
162
|
-
| 5. Structure | resolutions, seed stability, nesting, marker support, QC and doublets per cluster | chosen partition and why | `clustering-and-embedding.md` |
|
|
163
|
-
| 6. Branch if needed | HVG count and blacklist, PCs, `k`, subclustering one lineage, Harmony (only if the design allows) | which alternative changed what | `features-and-graphs.md`, `gene-blacklists.md`, `integration-and-comparisons.md` |
|
|
164
|
-
| 7. Annotate | marker tables, canonical panels, gene-set scores | label, markers, negatives, unresolved clusters | `markers-and-annotation.md` |
|
|
165
|
-
| 8. Compare | composition per donor, pseudobulk; only with replicates | what can and cannot be claimed | `integration-and-comparisons.md`, `performance-and-export.md` (pseudobulk export) |
|
|
166
|
-
| 9. Report | figures, tables, handoff JSON, lineage, export | files written, open questions | `plotting.md`, `performance-and-export.md` |
|
|
167
|
-
|
|
168
|
-
## Quick start
|
|
169
|
-
|
|
170
|
-
A complete first pass on an RNA store. Every step after the run reuses the run's artifacts.
|
|
171
|
-
|
|
172
|
-
```python
|
|
173
|
-
from pathlib import Path
|
|
174
|
-
|
|
175
|
-
import matplotlib
|
|
176
|
-
|
|
177
|
-
matplotlib.use("Agg") # headless; select the backend before importing scarf
|
|
178
|
-
import numpy as np
|
|
179
|
-
import pandas as pd
|
|
180
|
-
import scarf
|
|
181
|
-
|
|
182
|
-
scarf.configure_output(level="WARNING", progress=False)
|
|
183
|
-
store = "analysis.zarr"
|
|
184
|
-
out = Path("analysis_out")
|
|
185
|
-
(out / "figures").mkdir(parents=True, exist_ok=True)
|
|
186
|
-
|
|
187
|
-
ds = scarf.DataStore(store, min_features_per_cell=-1)
|
|
188
|
-
|
|
189
|
-
# QC: compare candidate filters and audit them before choosing (quality-control.md).
|
|
190
|
-
cells = ds.snapshot_cell_selection("I")
|
|
191
|
-
mad5 = ds.auto_filter_cells(cell_selection=cells, n_mads=5)
|
|
192
|
-
kept = np.asarray(ds.load_artifact(mad5)["values"][:], dtype=bool)
|
|
193
|
-
print(f"MAD 5 keeps {kept.sum()} of {ds.cells.N} cells")
|
|
194
|
-
|
|
195
|
-
# Baseline run with the chosen policy; freeze design columns you will need later.
|
|
196
|
-
run = ds.pipeline.run(
|
|
197
|
-
label="baseline_mad5",
|
|
198
|
-
filtering={"method": "mad", "n_mads": 5},
|
|
199
|
-
snapshot_columns=[c for c in ("donor_id", "sample_id") if c in ds.cells.columns],
|
|
200
|
-
)
|
|
201
|
-
print(run.status, list(run.keys()))
|
|
202
|
-
(out / "run_report.md").write_text(run.report(format="markdown"))
|
|
203
|
-
|
|
204
|
-
# Figures and tables.
|
|
205
|
-
umap = ds.plots.embedding(run=run, color_by="clusters", show=False)
|
|
206
|
-
umap.save(out / "figures" / "umap_clusters.png", dpi=150)
|
|
207
|
-
umap.close()
|
|
208
|
-
markers = ds.get_markers(marker=run["markers"])
|
|
209
|
-
markers.to_csv(out / "markers_top.csv", index=False)
|
|
210
|
-
print(markers.groupby("group_id", sort=False).head(5)
|
|
211
|
-
.groupby("group_id", sort=False)["feature_name"].agg(", ".join))
|
|
212
|
-
sizes = pd.Series(run.cells.fetch("clusters")).value_counts().sort_index()
|
|
213
|
-
print(sizes.to_dict())
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Record the analysis
|
|
217
|
-
|
|
218
|
-
Keep these in the output directory so another agent or a person can audit and continue:
|
|
219
|
-
|
|
220
|
-
- `analysis_log.md`: the question, the units, and one entry per step (decision, alternatives
|
|
221
|
-
considered, evidence with numbers, figure paths).
|
|
222
|
-
- `handoff.json`: run label and ID, and the refs you relied on (`ref.to_dict()`; restore with
|
|
223
|
-
`scarf.ArtifactRef.from_dict`). Add unsupported claims and open questions. See
|
|
224
|
-
`pipeline-runs-and-artifacts.md`.
|
|
225
|
-
- `run_report.md` (`run.report(format="markdown")`) and `lineage.md`
|
|
226
|
-
(`ds.lineage({...}).to_markdown()`).
|
|
227
|
-
- Figures saved as PNG, and tables as CSV (markers, cluster sizes, composition, label map).
|
|
228
|
-
|
|
229
|
-
## Evaluating against held-out labels
|
|
230
|
-
|
|
231
|
-
When a dataset ships author annotations, run the whole loop without them. Then add one final
|
|
232
|
-
section that crosstabs your labels against theirs, reports ARI and per-type F1 after harmonizing
|
|
233
|
-
vocabularies, and explains disagreements with marker evidence. Report QC retention per author type
|
|
234
|
-
there too, as an audit of the filter. Never go back and tune parameters to raise agreement. Record
|
|
235
|
-
any changes you make after seeing the comparison as such.
|
|
236
|
-
|
|
237
|
-
## Reference modules
|
|
238
|
-
|
|
239
|
-
| Module | Read when |
|
|
240
|
-
|---|---|
|
|
241
|
-
| `references/data-access.md` | opening, inspecting, converting (H5AD, 10x, MTX, Seurat), Cytebase search, open and mount |
|
|
242
|
-
| `references/quality-control.md` | QC metrics, MAD/manual/per-sample filters, removal audits, doublet scores |
|
|
243
|
-
| `references/features-and-graphs.md` | HVGs, normalization, PCA dims, ANN, neighbours, graph diagnostics, branching, subclustering |
|
|
244
|
-
| `references/gene-blacklists.md` | what the default HVG blacklist removes, corrected blacklists for human and mouse, Ig/TCR and haemoglobin add-ons |
|
|
245
|
-
| `references/clustering-and-embedding.md` | Leiden and Paris, choosing a partition, UMAP and t-SNE, labels as arrays |
|
|
246
|
-
| `references/markers-and-annotation.md` | marker tables, canonical marker panels, labelling, AUCell/WAGGR, cell cycle, label comparison |
|
|
247
|
-
| `references/pipeline-runs-and-artifacts.md` | `ds.pipeline.run` options, run reports, artifacts, lineage, failures, handoff record |
|
|
248
|
-
| `references/plotting.md` | headless figures, run mode versus ref mode, every `ds.plots` method |
|
|
249
|
-
| `references/integration-and-comparisons.md` | study design and units, donors in two arms, composition tests, Harmony and its safety, merging, mapping, condition comparisons |
|
|
250
|
-
| `references/performance-and-export.md` | budgets, long-running steps, streaming, mount repacking, AnnData/H5AD/MTX/CSV and pseudobulk export, subset stores |
|
|
251
|
-
|
|
252
|
-
## Troubleshooting
|
|
253
|
-
|
|
254
|
-
| Symptom | Likely cause | Fix |
|
|
255
|
-
|---|---|---|
|
|
256
|
-
| `Assay 'RNA' is not prepared` on a read-only open | store just written by a converter or `SubsetZarr` | open once writable, then read-only |
|
|
257
|
-
| Fewer active cells than expected after opening | writable open applied `min_features_per_cell` | `ds.cells.reset_key("I")`; reopen with `-1` |
|
|
258
|
-
| `ValueError` on `ds.pipeline.run(label=...)` | label already completed | new label; reuse makes it cheap |
|
|
259
|
-
| `PermissionError` from a producer | store opened with `zarr_mode="r"` and no matching artifact | reopen writable |
|
|
260
|
-
| `KeyError: 'values'` on a Paris ref | Paris stores `labels` | `ds.load_artifact(ref)["labels"]` |
|
|
261
|
-
| Array length differs from `ds.cells.N` | payload follows the cell selection | align with `run.cells.fetch_all` or the selection mask |
|
|
262
|
-
| Plot raises with `run=` and a gene or live column | run mode accepts one frozen field only | `layout=run["umap"], color_by=[...]` |
|
|
263
|
-
| `TypeError` from `distribution(grouping="col")` | grouping needs a ref or `CellField` | `grouping=scarf.plotting.CellField("col")` |
|
|
264
|
-
| Very slow steps on a mount | each count pass is a network read | fewer passes; repack locally (rule 8) |
|
|
265
|
-
| `MemoryError` (`CountLayoutMemoryError` after 1.0.0rc19) from a converter | default count layout does not fit `mem_budget` | larger `mem_budget`; else the `policy=` the message names (`references/data-access.md`) |
|
|
266
|
-
| `ValueError` plotting after reopening the store | a `PipelineRun` is bound to the store object that opened it | reopen the run from the new `ds` |
|
|
267
|
-
| `list_artifacts(kind="cell_selection")` is empty | cell selections are datastore-scoped | add `scope="datastore"` |
|
|
268
|
-
| `KeyError: 'groups'` in a dot plot table | with `group_by=` the column is named after the grouping column | read `res.tables["aggregate"].columns` first |
|
|
269
|
-
| A wait for a long step never ends | unbounded polling, or the process died | bounded wait that checks the process and the log tail (Setup) |
|
|
270
|
-
| QC bounds look odd or nothing is filtered | counts are corrected or already filtered | check the matrix first; prefer flag-only or gentle filters |
|
|
271
|
-
| `ValueError: None of the s_genes match the assay feature names` from `ds.pipeline.run` | feature names are not gene symbols (Ensembl IDs, synthetic names); matching ignores case, so mouse symbols work | `cell_cycle=False`, or pass lists in the store's naming via `params={"cell_cycle": {"s_genes": [...], "g2m_genes": [...]}}` |
|
|
272
|
-
|
|
273
|
-
## Limitations
|
|
274
|
-
|
|
275
|
-
- Covers core Scarf only. It does not use or describe `scarf.agent`.
|
|
276
|
-
- Needs Python 3.12+ and scarf 1.0.0rc17 or newer, which is a pre-release. A bare `scarf[extra]`
|
|
277
|
-
install resolves to the 0.32 series, whose API differs from what this skill describes.
|
|
278
|
-
- Scarf does not check the study design. Donor and replicate structure, confounding and held-out
|
|
279
|
-
annotation columns are the analyst's responsibility (rules 13 and 14).
|
|
280
|
-
- Cluster labels from this workflow are hypotheses backed by marker evidence, not a validated
|
|
281
|
-
cell-type classifier.
|
|
282
|
-
- Numbers in the reference modules come from the 10x 5K PBMC documentation dataset. They are
|
|
283
|
-
illustrations, not thresholds.
|
|
284
|
-
- Runtime and memory depend on hardware, storage and data. Measured end-to-end runs are on the
|
|
285
|
-
benchmarks page (`concepts/benchmarks.html`); they are not hardware guarantees.
|
|
286
|
-
- A DataStore is not thread-safe: use one per process.
|
|
287
|
-
- Cytebase datasets need the `cytebase` extra and network access, and a mounted store reads counts
|
|
288
|
-
over the network on every pass.
|
|
289
|
-
- This catalogue copy leaves out `scripts/inspect_store.py` from the maintained copy; use the
|
|
290
|
-
read-only recipes in the reference modules instead.
|
|
291
|
-
|
|
292
|
-
## Security & Safety Notes
|
|
293
|
-
|
|
294
|
-
- `pip install "scarf[extra]>=1.0.0rc17"` installs a pre-release from PyPI into the active Python
|
|
295
|
-
environment. Ask the user before installing, and prefer a virtual environment.
|
|
296
|
-
- Writable opens and every producer write into the store: artifacts, pipeline runs and, unless
|
|
297
|
-
you pass `min_features_per_cell=-1`, the open-time filter on `I` (rule 1). Inspect with
|
|
298
|
-
`zarr_mode="r"` first, and copy a store before the first writable open when the original must
|
|
299
|
-
stay unchanged.
|
|
300
|
-
- Converters, `repack_zarr`, subset stores and exports write new files that can be as large as the
|
|
301
|
-
counts. Check free disk space and confirm output paths before running them.
|
|
302
|
-
- Object-storage paths, mounts and Cytebase read over the network. Cytebase can use an existing
|
|
303
|
-
Hugging Face login for private buckets. Never print, log or copy access tokens into analysis
|
|
304
|
-
logs, handoff files or reports.
|
|
305
|
-
- By default Scarf claims all detected RAM and every CPU. On shared machines set
|
|
306
|
-
`SCARF_MEM_BUDGET` and `SCARF_WORKERS` before importing it.
|
|
307
|
-
- Run long steps in the background with a bounded wait that also stops on a `Traceback` or a dead
|
|
308
|
-
process (Setup). Never poll without a time limit.
|
|
309
|
-
|
|
310
|
-
## Documentation map
|
|
311
|
-
|
|
312
|
-
The docs hold the full explanations, online at <https://scarf.readthedocs.io/en/latest/>:
|
|
313
|
-
`quickstart.html`, `tutorials/<step>.html` (one page per step, for example `quality_control`,
|
|
314
|
-
`graph_construction`, `clustering`, `annotation`, `batch_correction`,
|
|
315
|
-
`pseudobulk_and_differential_expression`, `cytebase`), `concepts/` (`provenance`,
|
|
316
|
-
`memory_and_execution`, `benchmarks`), `analysis_with_agents.html` (scientific decision loop, task
|
|
317
|
-
routing, handoff) and `reference/api/<module>.html` (exact signatures).
|
|
318
|
-
|
|
319
|
-
## Source and License
|
|
320
|
-
|
|
321
|
-
Copyright (c) 2026, Nygen Analytics AB. Licensed under the BSD 3-Clause License; the full text is
|
|
322
|
-
in `references/LICENSE.md`. The maintained copy lives in NygenAnalytics/scarf at
|
|
323
|
-
<https://github.com/NygenAnalytics/scarf/tree/master/skills/scarf-single-cell>. This catalogue
|
|
324
|
-
copy adds catalogue frontmatter and the "When to Use This Skill", "Limitations", "Security & Safety
|
|
325
|
-
Notes" and "Source and License" sections, and leaves out `scripts/inspect_store.py`. The analysis
|
|
326
|
-
guidance is otherwise unchanged.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026, Nygen Analytics AB
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
* Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
# Clustering and embedding
|
|
2
|
-
|
|
3
|
-
Partition a cell graph with Leiden or Paris, choose a partition with evidence, build UMAP or t-SNE
|
|
4
|
-
layouts, and extract labels and coordinates as cell-aligned arrays. Docs:
|
|
5
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/clustering.html>, <https://scarf.readthedocs.io/en/latest/tutorials/dimensionality_reduction.html>,
|
|
6
|
-
<https://scarf.readthedocs.io/en/latest/reference/api/datastore.html>, <https://scarf.readthedocs.io/en/latest/reference/api/integration.html>.
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- A completed run or an explicit graph exists, and you need other resolutions, a hierarchy or a
|
|
11
|
-
new layout on that same graph.
|
|
12
|
-
- You must justify a partition (resolution, seed, representation) before naming clusters.
|
|
13
|
-
- You need cluster labels or layout coordinates as a NumPy array or a DataFrame indexed by cell ID.
|
|
14
|
-
|
|
15
|
-
## Key concepts
|
|
16
|
-
|
|
17
|
-
- Every producer takes an exact graph `ArtifactRef` (`run["connectivity_map"]` or an integrated
|
|
18
|
-
graph) and returns a new immutable `ArtifactRef`. None of them writes to `ds.cells`. Repeating a
|
|
19
|
-
call reuses the stored artifact; `invalidate_cache=True` creates another one.
|
|
20
|
-
- Payloads: Leiden `kind="cluster_labels"` stores `values` (int, numbered from 1); Paris
|
|
21
|
-
`kind="cluster_cut"` stores `labels`; UMAP and t-SNE `kind="embedding"` store `values` with shape
|
|
22
|
-
`(n_cells, dims)`.
|
|
23
|
-
- Payload rows follow the graph's frozen cell selection in stored-axis order, not every cell in
|
|
24
|
-
the store (3,847 of 5,025 cells in the 10x 5K PBMC docs dataset baseline). Recover that
|
|
25
|
-
selection with `ds.inspect_artifact(ref).input_ref("cell_selection")`.
|
|
26
|
-
- The default pipeline stores `leiden_0.5`, `leiden_0.75`, `leiden_1.0`, `leiden_1.25` and `paris`.
|
|
27
|
-
`run["clusters"]` is the Leiden candidate with the best PCA silhouette, recorded in
|
|
28
|
-
`run["cluster_selection"]`. Silhouette favours few compact clusters and can merge distinct
|
|
29
|
-
lineages or states. Treat that pick as a reproducible baseline only.
|
|
30
|
-
- Leiden is seeded (`random_seed=4444`), so a single run says nothing about stability. Agreement
|
|
31
|
-
across seeds, nested resolutions, markers and representations is the evidence.
|
|
32
|
-
- Leiden, Paris, layouts, membership strength and separability use only the graph or PCA and take
|
|
33
|
-
seconds. Marker search is the only step on this page that reads counts.
|
|
34
|
-
|
|
35
|
-
## Recipes
|
|
36
|
-
|
|
37
|
-
### Open the graph and baseline refs
|
|
38
|
-
|
|
39
|
-
```python
|
|
40
|
-
import numpy as np
|
|
41
|
-
import pandas as pd
|
|
42
|
-
import scarf
|
|
43
|
-
|
|
44
|
-
scarf.configure_output(level="WARNING", progress=False)
|
|
45
|
-
ds = scarf.DataStore("analysis.zarr", nthreads=4, min_features_per_cell=-1) # writable
|
|
46
|
-
run = ds.pipeline.open(label="baseline")
|
|
47
|
-
graph = run["connectivity_map"]
|
|
48
|
-
print([key for key in run if key.startswith(("leiden", "paris", "cluster"))])
|
|
49
|
-
|
|
50
|
-
def labels_of(ref):
|
|
51
|
-
"""Return a cluster payload as an array aligned to the ref's cell selection."""
|
|
52
|
-
key = "labels" if ref.kind == "cluster_cut" else "values"
|
|
53
|
-
return np.asarray(ds.load_artifact(ref)[key][:])
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Build the partition evidence table
|
|
57
|
-
|
|
58
|
-
One row per candidate: stability over seeds, nesting in the next coarser candidate, separability,
|
|
59
|
-
graph support and marker support. Each marker search streams counts once.
|
|
60
|
-
|
|
61
|
-
```python
|
|
62
|
-
from itertools import combinations
|
|
63
|
-
from sklearn.metrics import adjusted_rand_score
|
|
64
|
-
|
|
65
|
-
leiden, values, rows = {}, {}, []
|
|
66
|
-
for resolution in (0.5, 1.0, 1.5):
|
|
67
|
-
refs = [ds.run_leiden_clustering(graph, resolution=resolution, random_seed=seed)
|
|
68
|
-
for seed in (4444, 1, 2)]
|
|
69
|
-
name = f"leiden_{resolution}"
|
|
70
|
-
leiden[name], values[name] = refs[0], labels_of(refs[0]) # seed 4444 = the pipeline's
|
|
71
|
-
seeds = [labels_of(ref) for ref in refs]
|
|
72
|
-
rows.append({"candidate": name, "n_clusters": len(np.unique(seeds[0])),
|
|
73
|
-
"smallest": pd.Series(seeds[0]).value_counts().min(),
|
|
74
|
-
"min_seed_ari": min(adjusted_rand_score(a, b) for a, b in combinations(seeds, 2))})
|
|
75
|
-
evidence = pd.DataFrame(rows).set_index("candidate")
|
|
76
|
-
names = list(leiden)
|
|
77
|
-
evidence["nested_frac"] = [np.nan] + [ # share of cells inside one cluster of the coarser one
|
|
78
|
-
pd.crosstab(values[fine], values[coarse]).max(axis=1).sum() / len(values[fine])
|
|
79
|
-
for coarse, fine in zip(names, names[1:])]
|
|
80
|
-
sep = ds.metric_cluster_separability(run["pca"], leiden) # coordinates the graph was built on
|
|
81
|
-
evidence = evidence.join(sep.clustering_scores.set_index("clustering")[
|
|
82
|
-
["macro_f1_mean", "silhouette_score"]])
|
|
83
|
-
for name, ref in leiden.items():
|
|
84
|
-
strength = np.asarray(ds.load_artifact(ds.calc_membership_strength(ref, graph))["values"][:])
|
|
85
|
-
evidence.loc[name, "weak_cells"] = (strength < 0.5).mean()
|
|
86
|
-
per_cluster_strength = pd.Series(strength).groupby(values[name]).mean()
|
|
87
|
-
evidence.loc[name, "min_cluster_strength"] = per_cluster_strength.min()
|
|
88
|
-
found = ds.get_markers(marker=ds.run_marker_search(ref, features=run["feature_universe"]))
|
|
89
|
-
n_markers = found["group_id"].value_counts().reindex(
|
|
90
|
-
[str(g) for g in np.unique(values[name])], fill_value=0)
|
|
91
|
-
evidence.loc[name, "clusters_lt3_markers"] = int((n_markers < 3).sum())
|
|
92
|
-
print(evidence.round(3).to_string())
|
|
93
|
-
print(sep.cluster_scores.sort_values("f1_score").head(5)) # weakest individual clusters
|
|
94
|
-
nesting = ds.smart_label(leiden["leiden_1.0"], leiden["leiden_0.5"]) # "2a", "2b": splits of 2
|
|
95
|
-
print(pd.Series(labels_of(nesting)).value_counts().head(10))
|
|
96
|
-
selection = ds.load_artifact(run["cluster_selection"]) # the pipeline's silhouette choice
|
|
97
|
-
print(dict(zip(selection.attrs["candidateKeys"], np.asarray(selection["scores"][:]).round(3))))
|
|
98
|
-
print("selected:", selection.attrs["selectedKey"], "invalid:", selection.attrs["invalidReasons"])
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Membership strength is the fraction of a cell's graph neighbours sharing its most common label.
|
|
102
|
-
Pass the Harmony ref instead of `run["pca"]` when the graph was built on Harmony coordinates.
|
|
103
|
-
|
|
104
|
-
### QC and doublet covariates per cluster
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
in_run = run.cells.fetch_all("I").astype(bool)
|
|
108
|
-
per_cell = pd.DataFrame({c: ds.cells.fetch_all(c)[in_run]
|
|
109
|
-
for c in ("RNA_nCounts", "RNA_nFeatures", "RNA_percentMito")})
|
|
110
|
-
per_cell["doublet_score"] = run.cells.fetch("doublet_score")
|
|
111
|
-
per_cluster = per_cell.groupby(values["leiden_1.0"]).median()
|
|
112
|
-
print(per_cluster.round(2), per_cell.median().round(2), sep="\n") # each cluster vs all cells
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
A cluster that stands out only on counts, mito or doublet score is technical until markers say
|
|
116
|
-
otherwise. Doublet scores run high in high-RNA types (plasma cells), so compare within a lineage.
|
|
117
|
-
|
|
118
|
-
### Representation sensitivity
|
|
119
|
-
|
|
120
|
-
Repeat the evidence on one branch (more HVGs, other PCs or `k`; `features-and-graphs.md`). The
|
|
121
|
-
cells must match, so labels compare directly.
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
alt = ds.pipeline.run(label="hvg2k_pc30_k21", hvg_count=2000, pca_dims=30, neighbors_k=21)
|
|
125
|
-
assert alt["analysis_cell_selection"] == run["analysis_cell_selection"]
|
|
126
|
-
alt_refs = [ds.run_leiden_clustering(alt["connectivity_map"], resolution=resolution)
|
|
127
|
-
for resolution in (0.5, 1.0, 1.5)]
|
|
128
|
-
for name, ref in leiden.items(): # best match over branch resolutions; k shifts the scale
|
|
129
|
-
evidence.loc[name, "ari_vs_branch"] = max(ds.metric_label_concordance(ref, other)
|
|
130
|
-
for other in alt_refs)
|
|
131
|
-
print(evidence.round(3).to_string())
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Choose the partition
|
|
135
|
-
|
|
136
|
-
`run["clusters"]` (the silhouette pick) is a baseline candidate, never the answer by itself.
|
|
137
|
-
Combine the evidence; no single score decides.
|
|
138
|
-
|
|
139
|
-
1. Stability: keep candidates whose `min_seed_ari` stays near the coarsest one (about 0.9 or
|
|
140
|
-
more is a rule of thumb). Below that, the optimizer moves boundaries between seeds.
|
|
141
|
-
2. Nesting: prefer a candidate that refines the coarser one (`nested_frac` near 1, `smart_label`
|
|
142
|
-
shows "2a", "2b"). A non-nested jump, where many cells change parent, is a reason to reject it.
|
|
143
|
-
3. Markers: every cluster a finer candidate adds needs its own specific markers (about 3 or more
|
|
144
|
-
at default `get_markers` filters, named genes, not only ribosomal, mitochondrial or ambient).
|
|
145
|
-
4. Graph support: added clusters keep high mean membership strength and few weak cells.
|
|
146
|
-
5. QC and doublets: a split explained by counts, mito or doublet score is not a cell type. Keep it
|
|
147
|
-
as `unresolved` (`markers-and-annotation.md`) instead of naming it.
|
|
148
|
-
6. Representation: boundaries that survive an HVG, PC or `k` branch are robust; those that move
|
|
149
|
-
are provisional and need markers to stand.
|
|
150
|
-
|
|
151
|
-
Choose the finest candidate whose added splits all pass 1 to 5, and report 6. If the silhouette
|
|
152
|
-
pick merges populations that markers separate, a finer candidate that passes wins. Prefer a coarser
|
|
153
|
-
global partition plus targeted subclustering (`features-and-graphs.md`, "Subcluster one lineage")
|
|
154
|
-
when the lineage split is stable at a low resolution but finer global resolutions lose seed
|
|
155
|
-
stability, break nesting, or split only one lineage. The usual case is T and NK subsets in blood:
|
|
156
|
-
global HVGs are dominated by between-lineage genes, so a within-lineage graph resolves states
|
|
157
|
-
(naive, memory, regulatory, cytotoxic) that a finer global cut either misses or splits unstably.
|
|
158
|
-
|
|
159
|
-
(10x 5K PBMC docs dataset) Minimum seed ARI was 0.97, 0.82 and 0.60 at 0.5, 1.0 and 1.5; at 1.0,
|
|
160
|
-
four clusters had fewer than 3 markers; ARI with the branch fell from 0.86 to 0.61. The evidence
|
|
161
|
-
kept 0.5. A T-cell subgraph then gave a FOXP3/CTLA4 group (FOXP3 in 0.43 of cells); no global
|
|
162
|
-
cluster up to resolution 2.0 exceeded 0.22.
|
|
163
|
-
|
|
164
|
-
### Build a Paris hierarchy
|
|
165
|
-
|
|
166
|
-
```python
|
|
167
|
-
from dataclasses import asdict
|
|
168
|
-
|
|
169
|
-
paris = ds.run_paris_clustering(graph) # n_clusters="auto"; reuses run["paris"] when identical
|
|
170
|
-
result = ds.load_paris_clustering(paris)
|
|
171
|
-
diag = pd.DataFrame([asdict(item) for item in result.diagnostics])
|
|
172
|
-
print(result.n_clusters, diag[["label", "size", "persistence", "decision_margin", "forced"]])
|
|
173
|
-
paris_8 = ds.run_paris_clustering(graph, n_clusters=8)
|
|
174
|
-
print(ds.metric_label_concordance(paris, leiden["leiden_0.5"]))
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
High `persistence` means a branch survives over a wide range of the hierarchy. `forced=True` groups
|
|
178
|
-
satisfy a structural constraint and are not, by themselves, biological evidence.
|
|
179
|
-
|
|
180
|
-
### Build UMAP and t-SNE layouts
|
|
181
|
-
|
|
182
|
-
```python
|
|
183
|
-
init = run["embedding_initialization"] # K-means initialization built on run["pca"]
|
|
184
|
-
umap_tight = ds.run_umap(graph, init, min_dist=0.5)
|
|
185
|
-
tsne = ds.run_tsne(graph, init, verbose=False)
|
|
186
|
-
# For new coordinates, build a matching init first:
|
|
187
|
-
# init = ds.build_embedding_initialization(new_pca_ref)
|
|
188
|
-
print(ds.load_artifact(umap_tight)["values"].shape, ds.load_artifact(tsne)["values"].shape)
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Get labels and coordinates from a pipeline run
|
|
192
|
-
|
|
193
|
-
```python
|
|
194
|
-
cells = run.cells.to_pandas_dataframe(
|
|
195
|
-
["ids", "clusters", "leiden_1.0", "paris", "umap_1", "umap_2", "doublet_score"])
|
|
196
|
-
print(cells.head()) # one row per run cell, in stored-axis order
|
|
197
|
-
full = run.cells.fetch_all("clusters") # length ds.cells.N; -1 for cells outside the run
|
|
198
|
-
print(len(full), (full == -1).sum())
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
`run.cells.columns` lists the frozen fields. `fetch(...)` returns run cells only. `fetch_all(...)`
|
|
202
|
-
fills cells outside the run with -1 (integers), NaN (floats) or "" (strings).
|
|
203
|
-
|
|
204
|
-
### Get labels and coordinates from explicit artifacts
|
|
205
|
-
|
|
206
|
-
```python
|
|
207
|
-
def cell_ids_of(ref):
|
|
208
|
-
selection = ds.inspect_artifact(ref).input_ref("cell_selection")
|
|
209
|
-
mask = np.asarray(ds.load_artifact(selection)["values"][:], dtype=bool)
|
|
210
|
-
return ds.cells.fetch_all("ids")[mask]
|
|
211
|
-
|
|
212
|
-
ids = cell_ids_of(umap_tight)
|
|
213
|
-
assert np.array_equal(ids, cell_ids_of(leiden["leiden_1.5"])) # same frozen selection
|
|
214
|
-
xy = np.asarray(ds.load_artifact(umap_tight)["values"][:])
|
|
215
|
-
frame = pd.DataFrame({"leiden_1.5": labels_of(leiden["leiden_1.5"]),
|
|
216
|
-
"x": xy[:, 0], "y": xy[:, 1]},
|
|
217
|
-
index=pd.Index(ids, name="cell_id"))
|
|
218
|
-
print(frame.head())
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
The same helper works for membership strength, doublet scores, cell cycle and enrichment scores.
|
|
222
|
-
|
|
223
|
-
## Parameters that matter
|
|
224
|
-
|
|
225
|
-
| Parameter | Default | Change when |
|
|
226
|
-
|---|---|---|
|
|
227
|
-
| `resolution` (Leiden) | `1.0` (pipeline: 0.5, 0.75, 1.0, 1.25) | Raise for finer splits, lower to merge; always compare several |
|
|
228
|
-
| `random_seed` (Leiden) | `4444` | Rerun with 2 or more other seeds to test stability |
|
|
229
|
-
| `backend` (Leiden) | `"igraph"` | `"leidenalg"` only to match an external result |
|
|
230
|
-
| `n_clusters` (Paris) | `"auto"` | An integer to match another partition; it must be cuttable at one height, else `ValueError` |
|
|
231
|
-
| `min_cluster_size` (Paris) | `None` (resolved automatically) | Raise to suppress tiny branches in the auto cut |
|
|
232
|
-
| `min_dist` / `spread` (UMAP) | `1.0` / `2.0` | Lower `min_dist` (0.1 to 0.5) for tighter packing; appearance only |
|
|
233
|
-
| `use_density_map` (UMAP) | `False` | `True` for densMAP when relative density matters |
|
|
234
|
-
| `parallel` (UMAP, t-SNE) | `False` | `True` is faster but not reproducible |
|
|
235
|
-
|
|
236
|
-
## Check before moving on
|
|
237
|
-
|
|
238
|
-
- The evidence table exists for at least three candidates, and the chosen one is justified by
|
|
239
|
-
the six criteria above, not by silhouette alone. Record why coarser and finer were rejected.
|
|
240
|
-
- Every cluster under about 20 cells, or with mean membership strength well below the rest, has
|
|
241
|
-
been reviewed: doublet group, transition, contaminant or over-split.
|
|
242
|
-
- No cluster is named whose only distinction is a QC metric or doublet score.
|
|
243
|
-
- Lineages that need finer structure are listed for targeted subclustering, with the parent
|
|
244
|
-
partition kept for audit.
|
|
245
|
-
|
|
246
|
-
## Pitfalls
|
|
247
|
-
|
|
248
|
-
- Paris stores `labels`, not `values`. `ds.load_artifact(paris)["values"]` raises `KeyError`.
|
|
249
|
-
- Payload length is the selection size, not `ds.cells.N`. Align through the cell selection before
|
|
250
|
-
inserting into `ds.cells` or joining with other metadata.
|
|
251
|
-
- Cluster IDs are arbitrary per artifact. Never carry annotations from one partition to another by
|
|
252
|
-
ID; join on cell IDs or use `smart_label`.
|
|
253
|
-
- `metric_label_concordance` requires both artifacts to share the exact cell-selection ref. For
|
|
254
|
-
labels from different selections or from metadata, use sklearn on aligned arrays.
|
|
255
|
-
- Comparing branches at the same resolution only: `k` and HVG count shift the resolution scale.
|
|
256
|
-
- UMAP and t-SNE distances, empty space and island size are not biological measurements. Never
|
|
257
|
-
choose a resolution from a layout alone.
|
|
258
|
-
- A read-only store (`zarr_mode="r"`) raises `PermissionError` unless an identical artifact exists.
|
|
259
|
-
- `run_tsne` uses an `sgtsne` executable on `PATH` when present, otherwise the `sgtsnepi` Python
|
|
260
|
-
package. The docs state that t-SNE is unsupported on macOS and Windows.
|
|
261
|
-
|
|
262
|
-
## See also
|
|
263
|
-
|
|
264
|
-
- `features-and-graphs.md`: building graphs, HVG and `k` branches, subclustering one lineage.
|
|
265
|
-
- `markers-and-annotation.md`: marker tables and labels for the chosen partition.
|
|
266
|
-
- `quality-control.md`: doublet scores and QC covariates behind technical clusters.
|
|
267
|
-
- `plotting.md`: `ds.plots.embedding(layout=umap_ref, color_by=cluster_ref)`,
|
|
268
|
-
`cluster_connectivity(graph=, groups=, layout=)` and `cluster_tree(graph=, clusters=paris_ref)`.
|
|
269
|
-
- `pipeline-runs-and-artifacts.md`: run keys, `leiden=` pipeline settings, lineage.
|
|
270
|
-
- `integration-and-comparisons.md`: clustering on integrated graphs and batch metrics.
|