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,269 +0,0 @@
|
|
|
1
|
-
# Data access
|
|
2
|
-
|
|
3
|
-
Open, inspect, import, and connect to Scarf DataStores, including Cytebase remote and mounted
|
|
4
|
-
stores. Docs: <https://scarf.readthedocs.io/en/latest/tutorials/data_organization.html>,
|
|
5
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/import_and_export.html>, <https://scarf.readthedocs.io/en/latest/tutorials/cytebase.html>,
|
|
6
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/remote_stores.html>, <https://scarf.readthedocs.io/en/latest/reference/api/datastore.html>, `import_export.html`, `cytebase.html` (same folder).
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- First contact with any dataset: choose read-only or writable, then inspect before computing.
|
|
11
|
-
- Converting 10x, Matrix Market, H5AD, or Seurat RDS input into a Scarf Zarr store.
|
|
12
|
-
- Finding a Cytebase dataset, exploring it remotely, or mounting it for analysis that saves results.
|
|
13
|
-
- Reopening a store or a mount from an earlier session.
|
|
14
|
-
|
|
15
|
-
## Key concepts
|
|
16
|
-
|
|
17
|
-
- A store is one Zarr directory: `cellData` (shared cell table, `ds.cells`), one group per assay
|
|
18
|
-
(`ds.RNA`; feature table `ds.RNA.feats`; counts; assay artifacts), datastore-scoped artifacts,
|
|
19
|
-
and `pipeline/runs`. Cell QC columns are assay-prefixed: `RNA_nCounts`, `RNA_nFeatures`,
|
|
20
|
-
`RNA_percentMito`, `RNA_percentRibo`. Tables are `MetaData` objects, not DataFrames.
|
|
21
|
-
- `I` is the live Boolean cell key (feature tables have one too). `fetch(col)` returns rows where
|
|
22
|
-
`I` is true; `fetch_all(col)` returns every row. Analytical filtering returns a cell-selection
|
|
23
|
-
artifact and never edits `I`.
|
|
24
|
-
- `zarr_mode="r+"` is the default. A writable open WRITES: first-open preparation of a freshly
|
|
25
|
-
written store (QC columns, feature `nCells`/`dropOuts`), the `min_features_per_cell` filter
|
|
26
|
-
applied to `I`, and the `defaultAssay`/`assayTypes` attributes. `zarr_mode="r"` writes nothing;
|
|
27
|
-
producers return a matching existing artifact but raise `PermissionError` instead of computing.
|
|
28
|
-
- RNA assays hold cell-major `counts` plus gene-major `countsT`; other assays hold `counts` only.
|
|
29
|
-
Stores from older releases (Zarr v2, no `countsT`, an `{assay}/state` group) fail to open:
|
|
30
|
-
re-import the source.
|
|
31
|
-
- A mount is a local writable target whose counts resolve from a separate source recorded in the
|
|
32
|
-
root `matrixSource` attribute (absolute path or URI). Metadata is copied once at mount time; new
|
|
33
|
-
artifacts are written only to the target.
|
|
34
|
-
- Cytebase has three layers: `Catalog` (verified local DuckDB copy of the catalog, no counts),
|
|
35
|
-
`open_datastore` (read-only, everything remote), `mount_datastore` (local writable target,
|
|
36
|
-
counts remote, plus a `<target>.cytebase.json` receipt beside it).
|
|
37
|
-
- `workspace` names a group inside one Zarr with its own `cellData`, assays, and artifacts (counts
|
|
38
|
-
under `matrices/`). Writers default to `None` (root layout); keep `None` unless the store was
|
|
39
|
-
written with a workspace. A mount records one source workspace and rejects another.
|
|
40
|
-
|
|
41
|
-
## Recipes
|
|
42
|
-
|
|
43
|
-
### Open and inspect a store
|
|
44
|
-
|
|
45
|
-
Design and annotation inference starts with `scripts/inspect_store.py STORE.zarr`, which ships with
|
|
46
|
-
the maintained copy of this skill in the Scarf repository (this catalogue copy does not include
|
|
47
|
-
it). Read-only, it flags annotation-like columns (values hidden unless
|
|
48
|
-
`--show-annotation-values`), design-like, author-derived and unflagged columns, and checks
|
|
49
|
-
whether counts look raw, corrected or pre-filtered. Flags are name-based hints: review every
|
|
50
|
-
column. By hand, open read-only until you need to write; `summary()` is metadata-only.
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
import scarf
|
|
54
|
-
|
|
55
|
-
scarf.configure_output(level="WARNING", progress=False)
|
|
56
|
-
ds = scarf.DataStore("analysis.zarr", zarr_mode="r")
|
|
57
|
-
print(ds) # "N_active (N_total) cells", assays, column names
|
|
58
|
-
snap = ds.summary().to_dict() # JSON-safe
|
|
59
|
-
print(snap["default_assay"], snap["total_cells"], snap["active_cells"], snap["resources"])
|
|
60
|
-
print(snap["pipeline_run_counts"], snap["labeled_pipeline_runs"])
|
|
61
|
-
print([(a["name"], a["assay_type"], a["total_features"], len(a["artifacts"])) for a in snap["assays"]])
|
|
62
|
-
print(ds.pipeline.list_runs()) # newest first
|
|
63
|
-
print(ds.list_artifacts(complete_only=True)) # default-assay artifacts
|
|
64
|
-
print(ds.list_artifacts(scope="datastore", complete_only=True)) # cell selections, snapshots
|
|
65
|
-
ds.show_zarr_tree(start="RNA", depth=1)
|
|
66
|
-
|
|
67
|
-
# Metadata: request only the columns you need
|
|
68
|
-
meta = ds.cells.to_pandas_dataframe(["ids", "RNA_nCounts", "RNA_nFeatures"], key="I").set_index("ids")
|
|
69
|
-
active_ids = ds.cells.fetch("ids") # rows where I is True
|
|
70
|
-
all_ids = ds.cells.fetch_all("ids") # every row
|
|
71
|
-
genes = ds.RNA.feats.to_pandas_dataframe(["ids", "names", "nCells"])
|
|
72
|
-
by_upper = {str(n).upper(): str(n) for n in ds.RNA.feats.fetch_all("names")} # case-safe lookup
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Convert inputs to Zarr
|
|
76
|
-
|
|
77
|
-
Every writer follows reader then `*ToZarr(...).dump()`. Open each new store writable once.
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
# 10x HDF5: assays inferred from feature types (RNA, ADT, ATAC)
|
|
81
|
-
reader = scarf.CrH5Reader("filtered_feature_bc_matrix.h5")
|
|
82
|
-
print(reader.assayFeats) # assays and feature ranges that will be written
|
|
83
|
-
scarf.CrToZarr(reader, zarr_loc="pbmc.zarr", mem_budget="4G").dump()
|
|
84
|
-
# A default count layout that does not fit mem_budget raises MemoryError before writing and
|
|
85
|
-
# names a smaller policy=CountMatrixPolicy(...) (scarf.storage.count_matrix); raise
|
|
86
|
-
# mem_budget or pass that policy.
|
|
87
|
-
ds = scarf.DataStore("pbmc.zarr", default_assay="RNA") # required when there are 2+ assays
|
|
88
|
-
|
|
89
|
-
# 10x directory (matrix.mtx, genes/features.tsv, barcodes.tsv; .gz accepted)
|
|
90
|
-
scarf.CrToZarr(scarf.CrDirReader("filtered_feature_bc_matrix"), zarr_loc="dir.zarr").dump()
|
|
91
|
-
|
|
92
|
-
# Matrix Market: inspect, then pick one candidate explicitly
|
|
93
|
-
candidates = scarf.inspect_mtx("mtx_dir")
|
|
94
|
-
reader = scarf.MtxReader(candidates[0])
|
|
95
|
-
print(reader.assayFeats)
|
|
96
|
-
scarf.MtxToZarr(reader, zarr_loc="mtx.zarr").dump()
|
|
97
|
-
|
|
98
|
-
# H5AD: inspect first; selected obsm/obs values become artifacts, not live columns
|
|
99
|
-
import h5py
|
|
100
|
-
|
|
101
|
-
insp = scarf.inspect_h5ad("data.h5ad")
|
|
102
|
-
print(insp.matrixKey, insp.matrixCandidates, insp.integerLike, insp.layers, insp.suggestedAssays)
|
|
103
|
-
with h5py.File("data.h5ad", "r") as h5: # pass only keys the file has; a missing one is a KeyError
|
|
104
|
-
obsm = set(h5["obsm"]) if "obsm" in h5 else set()
|
|
105
|
-
obs = h5["obs"]
|
|
106
|
-
obs_cols = set(obs) if isinstance(obs, h5py.Group) else set(obs.dtype.names) # old files
|
|
107
|
-
print(sorted(obsm), sorted(obs_cols))
|
|
108
|
-
roles = {k: r for k, r in {"X_umap": "umap", "X_tsne": "tsne"}.items() if k in obsm}
|
|
109
|
-
kw = dict(embedding_roles=roles, cluster_keys=tuple(c for c in ("clusters",) if c in obs_cols))
|
|
110
|
-
reader = scarf.H5adReader.from_inspect(insp, **kw)
|
|
111
|
-
res = scarf.H5adToZarr(reader, zarr_loc="h5ad.zarr").dump()
|
|
112
|
-
print(dict(res.embeddingArtifacts), dict(res.clusterArtifacts))
|
|
113
|
-
|
|
114
|
-
# Seurat RDS (an on-disk .rds; .h5seurat is not read)
|
|
115
|
-
si = scarf.inspect_seurat("pbmc.rds")
|
|
116
|
-
reductions = [r.name for r in si.reductions if r.importable]
|
|
117
|
-
with scarf.SeuratReader("pbmc.rds", assays=[si.activeAssay], reductions=reductions) as sr:
|
|
118
|
-
out = scarf.SeuratToZarr(sr, zarr_loc="seurat.zarr").dump()
|
|
119
|
-
print(out.defaultAssay, dict(out.reductionArtifacts), out.activeIdentity, len(out.notices))
|
|
120
|
-
|
|
121
|
-
for path in ("dir.zarr", "mtx.zarr", "h5ad.zarr", "seurat.zarr"):
|
|
122
|
-
scarf.DataStore(path) # writable first open prepares the store
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
`CSVReader`/`CSVtoZarr` (small dense CSV) and `SparseToZarr` (SciPy CSR plus IDs) also exist.
|
|
126
|
-
|
|
127
|
-
Every converter refuses this way from 1.0.0rc18 on (1.0.0rc17 shrinks the layout to fit). The
|
|
128
|
-
error is a `MemoryError`; releases after 1.0.0rc19 raise its subclass `CountLayoutMemoryError`, so
|
|
129
|
-
catch `MemoryError`. Prefer a larger `mem_budget` when the host has
|
|
130
|
-
the memory. Otherwise copy the policy numbers from the message exactly and record that choice:
|
|
131
|
-
smaller layouts make every later gene-major read slower.
|
|
132
|
-
|
|
133
|
-
```python
|
|
134
|
-
from scarf.storage.count_matrix import CountMatrixPolicy
|
|
135
|
-
|
|
136
|
-
policy = CountMatrixPolicy(unitBytes=3906250, chunkBytes=390625) # copied from the message
|
|
137
|
-
scarf.CrToZarr(reader, zarr_loc="pbmc.zarr", mem_budget="128M", policy=policy).dump()
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
The need follows genes per cell relative to the gene count, not the number of cells. The 1K PBMC
|
|
141
|
-
CITE-seq file refuses at `512M` and imports at `1G`.
|
|
142
|
-
|
|
143
|
-
### Find a Cytebase dataset
|
|
144
|
-
|
|
145
|
-
```python
|
|
146
|
-
from scarf import cytebase
|
|
147
|
-
|
|
148
|
-
catalog = cytebase.Catalog() # public Nygen/cytebase, no credentials
|
|
149
|
-
hits = catalog.search("bladder immune", limit=5) # every word, case-insensitive
|
|
150
|
-
ids = [row["cytebase_id"] for row in hits] # take IDs from rows, not printed tables
|
|
151
|
-
blood = catalog.find_datasets(tissue="blood", organism="Homo sapiens") # exact labels
|
|
152
|
-
assay_labels = [row["label"] for row in catalog.list_terms("assay")] # exact facet labels
|
|
153
|
-
small = catalog.query(
|
|
154
|
-
"SELECT cytebase_id, cell_count FROM datasets "
|
|
155
|
-
"WHERE status = ? AND cell_count < ? ORDER BY cell_count LIMIT 3",
|
|
156
|
-
parameters=["ready", 5000],
|
|
157
|
-
)
|
|
158
|
-
entry = catalog.dataset(ids[0])
|
|
159
|
-
print(entry.describe()) # Markdown summary; does not open the store
|
|
160
|
-
print(entry.cell_count, entry.source_embeddings()) # source obsm keys, imported or not
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Explore a Cytebase dataset read-only
|
|
164
|
-
|
|
165
|
-
```python
|
|
166
|
-
ds = catalog.open_datastore(entry.id) # zarr_mode="r", min_features_per_cell=-1
|
|
167
|
-
print(cytebase.embeddings(ds)) # {"X_umap": ArtifactRef}: keys actually imported
|
|
168
|
-
umap_ref = cytebase.embedding(ds, "X_umap")
|
|
169
|
-
coords = cytebase.embedding_coordinates(ds, umap_ref) # DataFrame indexed by cell id
|
|
170
|
-
meta = ds.cells.to_pandas_dataframe(["ids", "donor_id"], key="I").set_index("ids") # a design column
|
|
171
|
-
frame = coords.join(meta) # join on ids, never on row order
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Mount a Cytebase dataset for writable analysis
|
|
175
|
-
|
|
176
|
-
The target must be a new local path. Mounting copies metadata and verifies the source; expect a
|
|
177
|
-
few minutes for a few thousand cells.
|
|
178
|
-
|
|
179
|
-
```python
|
|
180
|
-
analysis = catalog.mount_datastore(entry.id, at="work/analysis.zarr")
|
|
181
|
-
# Writes work/analysis.zarr (copied metadata, future artifacts) and work/analysis.zarr.cytebase.json
|
|
182
|
-
print(analysis.zarr_mode, int(analysis.cells.fetch_all("I").sum()), analysis.cells.N)
|
|
183
|
-
print(cytebase.embeddings(analysis)) # {}: source artifacts are not copied into a mount
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Reopen a mount, or mount any store that owns its counts
|
|
187
|
-
|
|
188
|
-
```python
|
|
189
|
-
# Verify against the current published build (needs the .cytebase.json sidecar beside it)
|
|
190
|
-
analysis = catalog.mount_datastore(entry.id, at="work/analysis.zarr")
|
|
191
|
-
# Or open it like any store: counts resolve from matrixSource; no catalog or sidecar needed
|
|
192
|
-
analysis = scarf.DataStore("work/analysis.zarr", min_features_per_cell=-1)
|
|
193
|
-
# Generic mount; for s3:// or gs:// sources also pass storage_options (not executed here)
|
|
194
|
-
mounted = scarf.mount_datastore("shared/data.zarr", at="my_analysis.zarr", default_assay="RNA")
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Download a documentation dataset
|
|
198
|
-
|
|
199
|
-
```python
|
|
200
|
-
repo = scarf.cytebase.connect("scarf_docs")
|
|
201
|
-
print(repo.list_datasets())
|
|
202
|
-
path = repo.download_dataset("tenx_5K_pbmc_rnaseq", destination="scarf_datasets", zarr=True)
|
|
203
|
-
ds = scarf.DataStore(f"{path}/data.zarr", zarr_mode="r") # prepared; run label "docs_default"
|
|
204
|
-
raw = repo.download_dataset("xin_1K_pancreas_rnaseq", destination="scarf_datasets") # source files
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Parameters that matter
|
|
208
|
-
|
|
209
|
-
| Parameter | Default | Change when |
|
|
210
|
-
|---|---|---|
|
|
211
|
-
| `zarr_mode` | `"r+"` | `"r"` to inspect, share, or protect a store; a fresh store needs one `"r+"` open |
|
|
212
|
-
| `default_assay` | stored value, or the only assay | first open of a multi-assay store (otherwise `ValueError`) |
|
|
213
|
-
| `min_features_per_cell` | `10` | `-1` to leave `I` untouched on writable opens |
|
|
214
|
-
| `mito_pattern` / `ribo_pattern` | `None` (`^MT-`, `^RPS\|^RPL\|^MRPS\|^MRPL`) | non-human genes (`^mt-`), only on the FIRST writable open |
|
|
215
|
-
| `assay_types` | inferred from assay names | custom names, e.g. `{"GEX": "RNA"}` |
|
|
216
|
-
| `nthreads`, `mem_budget` | env `SCARF_WORKERS`, `SCARF_MEM_BUDGET`, else detected | see `performance-and-export.md` |
|
|
217
|
-
| `workspace` | `None` | store written into a named workspace |
|
|
218
|
-
| `storage_options` | `None` | object-store credentials or endpoints (read from env vars) |
|
|
219
|
-
| `zarrProfile` | from location (`fast_local`/`cloud`) | affects newly written arrays only |
|
|
220
|
-
| `Catalog(bucket=, token=)` | `Nygen/cytebase`, `None` (HF login if present) | private bucket; `token=False` forces anonymous |
|
|
221
|
-
| `search(limit=)`, `ready_only=` | `50`, `True` | `limit=None` for all; `ready_only=False` for unfinished |
|
|
222
|
-
|
|
223
|
-
## Check before moving on
|
|
224
|
-
|
|
225
|
-
- `print(ds)`: active versus total cells, expected assays, QC columns present.
|
|
226
|
-
- `snap["default_assay"]` is the assay you intend; `snap["labeled_pipeline_runs"]` and
|
|
227
|
-
`list_artifacts` show existing work to reuse (see `pipeline-runs-and-artifacts.md`).
|
|
228
|
-
- Imports: `reader.assayFeats` lists the assays to be written; afterwards check
|
|
229
|
-
`ds.RNA.rawData.shape` and dtype. For H5AD, `insp.integerLike` should be `True` for raw counts,
|
|
230
|
-
but SCT-corrected counts are integers too: run "Check the matrix first" in `quality-control.md`.
|
|
231
|
-
- Cytebase: `entry.row["status"] == "ready"`; check `cytebase.embeddings(ds)` before plotting an
|
|
232
|
-
imported layout.
|
|
233
|
-
- Mounts: `<target>.cytebase.json` exists beside the target; `ds.RNA.rawData.shape` resolves.
|
|
234
|
-
|
|
235
|
-
## Pitfalls
|
|
236
|
-
|
|
237
|
-
- A writable open with `min_features_per_cell=k` silently removes cells with at most `k` features
|
|
238
|
-
from `I` and persists it. Reopening with a lower value does not restore cells;
|
|
239
|
-
`ds.cells.reset_key("I")` does.
|
|
240
|
-
- Stores just written by a writer or `SubsetZarr` raise `Assay 'RNA' is not prepared. Rebuild ...`
|
|
241
|
-
when opened with `zarr_mode="r"`. Open once with `"r+"`; no rebuild is needed.
|
|
242
|
-
- Percent patterns are fixed at first preparation; a different pattern later raises `ValueError`.
|
|
243
|
-
Use `run_feature_percentage` (see `quality-control.md`) for another gene set.
|
|
244
|
-
- `open_datastore` rejects writes and any `min_features_per_cell` other than `-1`. Both mount
|
|
245
|
-
functions reject `zarr_mode="r"`; `scarf.mount_datastore` refuses an existing target, while
|
|
246
|
-
`catalog.mount_datastore` reopens one only when its matching sidecar is present.
|
|
247
|
-
- Catalog reopen needs the sidecar: copying a mount without `<name>.cytebase.json` makes
|
|
248
|
-
`catalog.mount_datastore` raise `FileExistsError`; plain `scarf.DataStore` still opens it.
|
|
249
|
-
- The mount source must stay at its recorded path or URI. Mounting a mount raises; repack first.
|
|
250
|
-
A changed Cytebase build requires a new mount directory.
|
|
251
|
-
- Printed `CatalogResults` tables HTML-escape text (`_` as `_`, `'` as `'`). Read IDs and
|
|
252
|
-
facet labels from the row dicts (`row["cytebase_id"]`, `row["label"]`), never from the table.
|
|
253
|
-
- A fresh mount has no imported source embeddings. Plot them from the read-only `ds` and join by id.
|
|
254
|
-
- `to_pandas_dataframe(columns)` defaults to `key=None` (all rows); pass `key="I"` for active cells.
|
|
255
|
-
- `to_mtx(..., compress=True)` writes the feature `feature_type` column as the 10x feature type.
|
|
256
|
-
CELLxGENE stores keep gene biotypes there, so re-import split one assay into thousands. Inspect
|
|
257
|
-
`reader.assayFeats` before `dump()` or export with `compress=False`.
|
|
258
|
-
- Source column names containing `/` or `\` are stored with `_`. Reserved columns `ids`, `names`,
|
|
259
|
-
`I` from a source are skipped. H5AD multi-assay import needs `assay_split_key` on `H5adToZarr`.
|
|
260
|
-
- `download_dataset(..., zarr=True)` keeps `data.zarr.tar.gz` beside `data.zarr` (double disk).
|
|
261
|
-
- Public atlas matrices (CELLxGENE, Seurat submissions) can hold SCT-corrected counts in `raw.X`,
|
|
262
|
-
with genes such as rRNA removed and cells already filtered. Check before QC or count models.
|
|
263
|
-
|
|
264
|
-
## See also
|
|
265
|
-
|
|
266
|
-
- `performance-and-export.md`: budgets, remote I/O cost, repacking a mount, exports.
|
|
267
|
-
- `pipeline-runs-and-artifacts.md`: runs, artifact inspection, lineage.
|
|
268
|
-
- `quality-control.md`: filtering cells without editing `I`.
|
|
269
|
-
- `plotting.md`: `ds.plots.embedding(layout=umap_ref, ...)` for imported layouts.
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
# Features and graphs
|
|
2
|
-
|
|
3
|
-
Select features, normalize, reduce with PCA and build the neighbourhood graph as an explicit
|
|
4
|
-
chain of artifacts, then branch or subcluster it safely. Docs: <https://scarf.readthedocs.io/en/latest/tutorials/feature_selection.html>,
|
|
5
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/graph_construction.html>, <https://scarf.readthedocs.io/en/latest/tutorials/dimensionality_reduction.html> and
|
|
6
|
-
<https://scarf.readthedocs.io/en/latest/reference/api/graph_construction.html>.
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- A pipeline default (`hvg_count=1000`, `pca_dims=21`, `neighbors_k=11`) needs to change, or two
|
|
11
|
-
settings need comparing side by side.
|
|
12
|
-
- Building a graph on a custom cell selection (QC variant, subset) or feature list.
|
|
13
|
-
- Subclustering one lineage of a coarse partition with its own HVGs, PCA and graph.
|
|
14
|
-
- Diagnosing a graph before clustering or embedding.
|
|
15
|
-
|
|
16
|
-
## Key concepts
|
|
17
|
-
|
|
18
|
-
- RNA chain, each step returning an `ArtifactRef` that the next step consumes:
|
|
19
|
-
cell selection + `select_hvgs` (`feature_selection`) -> `run_normalization` (`normalized`) ->
|
|
20
|
-
`run_pca` (`reduction`) -> optional `run_harmony` -> `build_ann_index` (`ann_index`) ->
|
|
21
|
-
`query_neighbors` (`neighbors`) -> `build_connectivity_map` (`connectivity_map`).
|
|
22
|
-
`build_embedding_initialization(pca)` is a side branch that seeds UMAP and t-SNE only.
|
|
23
|
-
- Identity is operation + scientific parameters + exact inputs. An identical call returns the
|
|
24
|
-
existing ref without recomputing; a changed `k` reuses normalization, PCA and the ANN index.
|
|
25
|
-
Changing cells or features invalidates every downstream stage.
|
|
26
|
-
- `ds.pipeline.run(hvg_count=, pca_dims=, neighbors_k=)` forwards to `select_hvgs(top_n=)`,
|
|
27
|
-
`run_pca(dims=)` and `query_neighbors(k=)`. Explicit calls with the same arguments return the
|
|
28
|
-
very refs in `run[...]`. `pca_dims=0` skips PCA and builds the graph on normalized HVG values.
|
|
29
|
-
- RNA normalization: counts scaled to 1000 over the selected features, then `log1p`. PCA
|
|
30
|
-
standardizes features. HVGs are an artifact, not a feature column; the chain writes no metadata.
|
|
31
|
-
- Count passes: a new cell selection costs one pass for the feature summary (`select_hvgs`,
|
|
32
|
-
`select_detected_features`) and one per `run_normalization`; later stages read local artifacts.
|
|
33
|
-
|
|
34
|
-
## Recipes
|
|
35
|
-
|
|
36
|
-
### Rebuild the chain explicitly from a run
|
|
37
|
-
|
|
38
|
-
Start from any frozen cell selection: `run["analysis_cell_selection"]`, a QC ref, or
|
|
39
|
-
`ds.snapshot_cell_selection("I")`.
|
|
40
|
-
|
|
41
|
-
```python
|
|
42
|
-
import numpy as np
|
|
43
|
-
import pandas as pd
|
|
44
|
-
import scarf
|
|
45
|
-
import scarf.plotting as splt
|
|
46
|
-
|
|
47
|
-
ds = scarf.DataStore("analysis.zarr", min_features_per_cell=-1) # reopen; see data-access.md
|
|
48
|
-
run = ds.pipeline.open(label="baseline")
|
|
49
|
-
cells = run["analysis_cell_selection"]
|
|
50
|
-
|
|
51
|
-
hvg = ds.select_hvgs(cells, top_n=1000, show_plot=False)
|
|
52
|
-
normalized = ds.run_normalization(cells, hvg)
|
|
53
|
-
pca = ds.run_pca(normalized, dims=21)
|
|
54
|
-
ann = ds.build_ann_index(pca)
|
|
55
|
-
neighbors = ds.query_neighbors(ann, k=11)
|
|
56
|
-
graph = ds.build_connectivity_map(neighbors)
|
|
57
|
-
init = ds.build_embedding_initialization(pca)
|
|
58
|
-
print({key: ref == run[key] for key, ref in {
|
|
59
|
-
"highly_variable_features": hvg, "normalized": normalized, "pca": pca, "ann_index": ann,
|
|
60
|
-
"neighbors": neighbors, "connectivity_map": graph, "embedding_initialization": init}.items()})
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Feature-selection diagnostics
|
|
64
|
-
|
|
65
|
-
The HVG artifact stores `values` (selected mask) and `corrected_variance` for every feature.
|
|
66
|
-
|
|
67
|
-
```python
|
|
68
|
-
from scarf.features.gene_families import GENE_FAMILY_PATTERNS
|
|
69
|
-
|
|
70
|
-
hvg_group = ds.load_artifact(hvg)
|
|
71
|
-
selected = np.asarray(hvg_group["values"][:], dtype=bool)
|
|
72
|
-
corrected = np.asarray(hvg_group["corrected_variance"][:])
|
|
73
|
-
names = ds.RNA.feats.fetch_all("names").astype(str)
|
|
74
|
-
print(int(selected.sum()), pd.Series(corrected[selected], index=names[selected]).nlargest(15).round(1).to_dict())
|
|
75
|
-
panel = ["CD3D", "MS4A1", "LYZ", "NKG7", "PPBP", "JCHAIN"]
|
|
76
|
-
print({gene: bool(selected[names == gene].any()) for gene in panel})
|
|
77
|
-
print({family: len(ds.RNA.feats.grep(p)) for family, p in GENE_FAMILY_PATTERNS.items()})
|
|
78
|
-
|
|
79
|
-
# Headless mean-variance plot. show_plot=True only displays, then closes, its figure.
|
|
80
|
-
summary = ds.load_artifact(ds.inspect_artifact(hvg).input_ref("feature_summary"))
|
|
81
|
-
n_cells = np.asarray(summary["normed_n"][:], dtype=float)
|
|
82
|
-
total = np.asarray(summary["normed_tot"][:], dtype=float)
|
|
83
|
-
splt.highly_variable_features(
|
|
84
|
-
mean_nonzero=np.divide(total, n_cells, out=np.zeros_like(total), where=n_cells > 0),
|
|
85
|
-
corrected_variance=corrected, n_cells=n_cells, selected=selected, show=False,
|
|
86
|
-
).save("hvg_mean_variance.png")
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
(10x 5K PBMC docs dataset) The top HVGs were platelet (`PPBP`, `NRGN`), light-chain (`IGLC2`,
|
|
90
|
-
`IGKC`) and `IGHM` genes, which the default blacklist keeps. What to exclude: `gene-blacklists.md`.
|
|
91
|
-
|
|
92
|
-
### Alternative feature sets and a custom blacklist
|
|
93
|
-
|
|
94
|
-
`blacklist` is one regex, matched (`re.match`, ignoring case) against every feature name. It
|
|
95
|
-
replaces the default entirely, so pass a complete string: the default plus add-ons, or a full
|
|
96
|
-
string from `gene-blacklists.md`.
|
|
97
|
-
|
|
98
|
-
```python
|
|
99
|
-
from scarf.features.variability import DEFAULT_HVG_BLACKLIST
|
|
100
|
-
|
|
101
|
-
base = DEFAULT_HVG_BLACKLIST # or a complete string chosen with gene-blacklists.md
|
|
102
|
-
extra_patterns = [] # add-on regexes chosen with gene-blacklists.md; empty adds nothing
|
|
103
|
-
blacklist = "|".join([base, *extra_patterns])
|
|
104
|
-
new, old = set(ds.RNA.feats.grep(blacklist)), set(ds.RNA.feats.grep(DEFAULT_HVG_BLACKLIST))
|
|
105
|
-
print("added:", sorted(new - old)[:20], "released:", sorted(old - new)[:20]) # check both
|
|
106
|
-
hvg_2k = ds.select_hvgs(cells, top_n=2000, show_plot=False, blacklist=blacklist)
|
|
107
|
-
detected = ds.select_detected_features(cells, min_cells=20) # inclusive detection threshold
|
|
108
|
-
everything = ds.select_all_features(from_assay="RNA") # canonical all-true universe
|
|
109
|
-
custom = ds.set_feature_selection(from_assay="RNA", mask=np.isin(names, panel)) # or feature_indexes=
|
|
110
|
-
shared = np.asarray(ds.load_artifact(hvg_2k)["values"][:], dtype=bool) & selected
|
|
111
|
-
print(int(shared.sum()), "of the 1000 baseline HVGs kept")
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
`blacklist=""` disables the name filter; `max_cells=np.inf` disables the ubiquitous-gene filter.
|
|
115
|
-
The blacklist affects HVG selection only; marker search still tests every gene.
|
|
116
|
-
|
|
117
|
-
### Choose PCA dimensions
|
|
118
|
-
|
|
119
|
-
```python
|
|
120
|
-
pca_30 = ds.run_pca(normalized, dims=30) # more PCs than needed; local, no count pass
|
|
121
|
-
scores = np.asarray(ds.load_artifact(pca_30)["data"]) # cells x dims; also "loadings", "center"
|
|
122
|
-
share = scores.var(axis=0, ddof=1)
|
|
123
|
-
share = share / share.sum()
|
|
124
|
-
print(np.round(np.cumsum(share)[[9, 14, 20, 29]], 3)) # share of the 30-PC variance at 10/15/21/30
|
|
125
|
-
splt.elbow(share, show=False).save("pca_elbow.png")
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
An elbow is a hint, not a rule. Too few PCs merge populations; too many restore noise.
|
|
129
|
-
|
|
130
|
-
### Graph diagnostics and a k branch
|
|
131
|
-
|
|
132
|
-
`load_graph` returns a SciPy CSR matrix over the graph's cells, in cell-selection order. The default
|
|
133
|
-
is directed: each row holds exactly `k` weighted edges. Keep every returned ref; downstream calls
|
|
134
|
-
take one graph explicitly, so branches never overwrite each other.
|
|
135
|
-
|
|
136
|
-
```python
|
|
137
|
-
in_graph = np.asarray(ds.load_artifact(cells)["values"][:], dtype=bool)
|
|
138
|
-
G = ds.load_graph(graph)
|
|
139
|
-
S = ds.load_graph(graph, symmetric=True)
|
|
140
|
-
degree = np.asarray((S != 0).sum(axis=1)).ravel()
|
|
141
|
-
print(G.shape, G.nnz, "degree min/median/max", degree.min(), np.median(degree), degree.max())
|
|
142
|
-
qc = ds.cells.to_pandas_dataframe(["RNA_nCounts", "RNA_nFeatures"])[in_graph]
|
|
143
|
-
print(qc.assign(degree=degree).corr(method="spearman").round(2)["degree"])
|
|
144
|
-
splt.graph_qc(G, show=False).save("graph_qc.png")
|
|
145
|
-
|
|
146
|
-
graph_21 = ds.build_connectivity_map(ds.query_neighbors(ann, k=21)) # reuses the ANN index
|
|
147
|
-
leiden = {name: ds.run_leiden_clustering(g, resolution=1.0)
|
|
148
|
-
for name, g in {"k11": graph, "k21": graph_21}.items()}
|
|
149
|
-
labels = {name: np.asarray(ds.load_artifact(ref)["values"][:]) for name, ref in leiden.items()}
|
|
150
|
-
print(pd.crosstab(labels["k11"], labels["k21"]))
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
(10x 5K PBMC docs dataset) Degree vs `RNA_nCounts` Spearman 0.10; 16 clusters at k=11 versus 15
|
|
154
|
-
at k=21 (ARI 0.81). A larger `k` usually absorbs small clusters; the crosstab shows which.
|
|
155
|
-
|
|
156
|
-
### Same knobs through the pipeline
|
|
157
|
-
|
|
158
|
-
`params` forwards other stage settings, including the blacklist. Giving a setting both ways (for
|
|
159
|
-
example `hvg_count` and `params["hvg"]["top_n"]`) raises before anything is written. A completed
|
|
160
|
-
label cannot be run again, even unchanged: reopen it with `ds.pipeline.open` or use a new label.
|
|
161
|
-
|
|
162
|
-
```python
|
|
163
|
-
run_alt = ds.pipeline.run(
|
|
164
|
-
label="hvg2k_pc30_k21_blacklist", hvg_count=2000, pca_dims=30, neighbors_k=21,
|
|
165
|
-
params={"hvg": {"blacklist": blacklist}, "connectivity": {"bandwidth": 1.5}},
|
|
166
|
-
)
|
|
167
|
-
print(run_alt.status, ds.inspect_artifact(run_alt["neighbors"]).parameters["k"])
|
|
168
|
-
print(run_alt["highly_variable_features"] == hvg_2k) # same cells and blacklist: same artifact
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Subcluster one lineage
|
|
172
|
-
|
|
173
|
-
Fix a coarse lineage partition first (`clustering-and-embedding.md`, "Choose the partition"), then
|
|
174
|
-
rebuild HVGs, normalization, PCA and the graph inside the lineage. `ds.cells.insert` writes to the
|
|
175
|
-
store itself; prefix and version column names on shared stores.
|
|
176
|
-
|
|
177
|
-
```python
|
|
178
|
-
from itertools import combinations
|
|
179
|
-
from sklearn.metrics import adjusted_rand_score
|
|
180
|
-
|
|
181
|
-
def on_cell_axis(ref):
|
|
182
|
-
"""Spread Leiden labels over every store cell (-1 outside the ref's selection)."""
|
|
183
|
-
mask = ds.load_artifact(ds.inspect_artifact(ref).input_ref("cell_selection"))["values"][:]
|
|
184
|
-
full = np.full(ds.cells.N, -1)
|
|
185
|
-
full[np.asarray(mask, dtype=bool)] = ds.load_artifact(ref)["values"][:]
|
|
186
|
-
return full
|
|
187
|
-
|
|
188
|
-
def build_graph(cell_selection, top_n=1000, dims=21, k=11):
|
|
189
|
-
hvg = ds.select_hvgs(cell_selection, top_n=top_n, show_plot=False) # summary: one count pass
|
|
190
|
-
pca = ds.run_pca(ds.run_normalization(cell_selection, hvg), dims=dims) # one count pass
|
|
191
|
-
return ds.build_connectivity_map(ds.query_neighbors(ds.build_ann_index(pca), k=k))
|
|
192
|
-
|
|
193
|
-
parent, parent_markers = run["clusters"], run["markers"] # or your chosen Leiden ref and its table
|
|
194
|
-
table = ds.get_markers(marker=parent_markers, min_score=-1, min_frac_exp=-1)
|
|
195
|
-
cd3e = table[table["feature_name"] == "CD3E"].set_index("group_id")["frac_exp"]
|
|
196
|
-
lineage_ids = sorted(int(g) for g in cd3e.index[cd3e > 0.5]) # a T gate; confirm with markers
|
|
197
|
-
sub_cells = ds.select_cells(parent, include=lineage_ids) # frozen, over every store cell
|
|
198
|
-
ds.cells.insert("t_lineage_v1", np.isin(on_cell_axis(parent), lineage_ids), overwrite=True)
|
|
199
|
-
alt_cells = ds.snapshot_cell_selection("t_lineage_v1") # same cells from any boolean column
|
|
200
|
-
assert np.array_equal(*(ds.load_artifact(r)["values"][:] for r in (sub_cells, alt_cells)))
|
|
201
|
-
|
|
202
|
-
sub_graph, sub_leiden, rows = build_graph(sub_cells), {}, []
|
|
203
|
-
for resolution in (0.3, 0.5, 0.8):
|
|
204
|
-
refs = [ds.run_leiden_clustering(sub_graph, resolution=resolution, random_seed=seed)
|
|
205
|
-
for seed in (4444, 1, 2)]
|
|
206
|
-
seeds = [np.asarray(ds.load_artifact(ref)["values"][:]) for ref in refs]
|
|
207
|
-
sub_leiden[resolution] = refs[0]
|
|
208
|
-
rows.append({"resolution": resolution, "n_clusters": len(np.unique(seeds[0])),
|
|
209
|
-
"min_seed_ari": min(adjusted_rand_score(a, b) for a, b in combinations(seeds, 2))})
|
|
210
|
-
print(pd.DataFrame(rows).round(3))
|
|
211
|
-
|
|
212
|
-
# Choose as for a global partition; then check markers, covariates, HVG count, parent overlap.
|
|
213
|
-
sub_resolution = 0.3 # the finest resolution that passed the seed check above
|
|
214
|
-
sub = sub_leiden[sub_resolution]
|
|
215
|
-
sub_full, parent_full = on_cell_axis(sub), on_cell_axis(parent)
|
|
216
|
-
in_sub = sub_full >= 0
|
|
217
|
-
sub_markers = ds.run_marker_search(sub, features=run["feature_universe"]) # one count pass
|
|
218
|
-
print(ds.get_markers(marker=sub_markers).groupby("group_id", sort=False)["feature_name"]
|
|
219
|
-
.agg(n="size", top=lambda s: ", ".join(s.head(6)))) # groups missing here have 0 markers
|
|
220
|
-
print(pd.crosstab(sub_full[in_sub], parent_full[in_sub]))
|
|
221
|
-
print(pd.DataFrame({"sub": sub_full, "counts": ds.cells.fetch_all("RNA_nCounts"), "doublet":
|
|
222
|
-
run.cells.fetch_all("doublet_score")})[in_sub].groupby("sub").median().round(2))
|
|
223
|
-
sub_2k = ds.run_leiden_clustering(build_graph(sub_cells, top_n=2000), resolution=sub_resolution)
|
|
224
|
-
print("ARI vs 2000 HVGs", round(ds.metric_label_concordance(sub, sub_2k), 3))
|
|
225
|
-
|
|
226
|
-
combined = np.where(in_sub, np.char.add("T.", sub_full.astype(str)), parent_full.astype(str))
|
|
227
|
-
combined = np.where(parent_full < 0, "not analyzed", combined).astype(object)
|
|
228
|
-
ds.cells.insert("clusters_tsub_v1", combined, overwrite=True) # new suffix for each new version
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
(10x 5K PBMC docs dataset) The T subgraph at 0.3 split naive and memory CD4, naive CD8,
|
|
232
|
-
cytotoxic and FOXP3/CTLA4 groups, with ARI 0.94 at 2,000 HVGs. The parent had no FOXP3 group.
|
|
233
|
-
|
|
234
|
-
## Parameters that matter
|
|
235
|
-
|
|
236
|
-
| Parameter | Default | Change when |
|
|
237
|
-
| --- | --- | --- |
|
|
238
|
-
| `select_hvgs(top_n=)` / `hvg_count` | `1000` | Weak or rare populations (raise); noisy programs dominate (lower). |
|
|
239
|
-
| `select_hvgs(blacklist=)` | `DEFAULT_HVG_BLACKLIST` | A family dominates the HVGs or is the question; what to add: `gene-blacklists.md`. |
|
|
240
|
-
| `select_hvgs(min_cells=, max_cells=)` | `20`, `None` (= selected cells - 20) | Tiny subsets; `max_cells=np.inf` keeps ubiquitous genes. |
|
|
241
|
-
| `run_pca(dims=)` / `pca_dims` | `21` | After a variance and stability check; `0` in the pipeline means no PCA. |
|
|
242
|
-
| `run_pca(pca_cell_selection=)` | `None` | Fit on a subset (for example one batch) and project all cells. |
|
|
243
|
-
| `query_neighbors(k=)` / `neighbors_k` | `11` (clamped to cells - 1) | Larger data or smoother graphs (15 to 30); smaller to resolve rare groups. |
|
|
244
|
-
| `load_graph(symmetric=, use_k=)` | `False`, all `k` | `True` for degree and connectivity checks; `use_k` to thin edges. |
|
|
245
|
-
|
|
246
|
-
## Check before moving on
|
|
247
|
-
|
|
248
|
-
- HVGs: count equals `top_n`; expected lineage markers are selected; the top of the list is not
|
|
249
|
-
one contaminant or technical program. If canonical lineage genes are missing, or one family
|
|
250
|
-
(Ig, haemoglobin, platelet) leads the list, branch with more HVGs and an explicit blacklist
|
|
251
|
-
(`gene-blacklists.md`) and compare partitions.
|
|
252
|
-
- PCA and `k`: a second setting gives a similar partition, or the differences are explained by
|
|
253
|
-
markers. Boundaries that move with `k` or `dims` are provisional.
|
|
254
|
-
- Graph: symmetric degree min is at least `k`; degree barely tracks counts. A strong correlation
|
|
255
|
-
means depth is shaping the graph.
|
|
256
|
-
- Subclusters: keep one only when it is seed-stable, has its own named markers, is not explained
|
|
257
|
-
by counts or doublet score, and survives the HVG change. Merge the rest into the parent label.
|
|
258
|
-
Write labels to a versioned column and keep the parent labels.
|
|
259
|
-
|
|
260
|
-
## Pitfalls
|
|
261
|
-
|
|
262
|
-
- Reading in-degree from the directed graph as isolation. `(G != 0).sum(axis=0)` is zero for 85
|
|
263
|
-
cells (10x 5K PBMC docs dataset), yet every cell has `k` out-edges; use `symmetric=True`.
|
|
264
|
-
- Passing a feature selection to UMAP, clustering or markers on a graph: graph consumers take the
|
|
265
|
-
graph ref. `query_neighbors(coordinates=)` only checks equality; it cannot retarget an index.
|
|
266
|
-
- `show_elbow_plot=True` draws only on a new PCA fit. More than 4096 features or several narrow
|
|
267
|
-
blocks switch PCA to IncrementalPCA, and `batch_size` then joins the artifact identity.
|
|
268
|
-
- Subclustering on the parent graph, or carrying subcluster IDs across artifacts. Rebuild inside
|
|
269
|
-
the subset, join on the cell axis, and keep the parent labels. `select_cells(include=[])`
|
|
270
|
-
raises; integer cluster artifacts need integer `include` values.
|
|
271
|
-
- `select_hvgs` is RNA only. ATAC uses `select_prevalent_peaks` then `run_lsi`.
|
|
272
|
-
|
|
273
|
-
## See also
|
|
274
|
-
|
|
275
|
-
- `gene-blacklists.md`: which gene families to pass as `blacklist=`, and why.
|
|
276
|
-
- `quality-control.md`: building the cell selection this chain starts from.
|
|
277
|
-
- `clustering-and-embedding.md`: Leiden, Paris, UMAP and t-SNE on the graph; choosing a partition.
|
|
278
|
-
- `integration-and-comparisons.md`: `run_harmony` between PCA and the ANN index.
|
|
279
|
-
- `pipeline-runs-and-artifacts.md`: `inspect_artifact`, lineage and reuse.
|