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,280 +0,0 @@
|
|
|
1
|
-
# Markers and annotation
|
|
2
|
-
|
|
3
|
-
Find cluster markers, turn marker evidence into cautious cell-type labels, separate progenitors
|
|
4
|
-
from multiplets, score gene sets and the cell cycle, and run a final comparison with existing
|
|
5
|
-
labels. Docs: <https://scarf.readthedocs.io/en/latest/tutorials/annotation.html>, <https://scarf.readthedocs.io/en/latest/tutorials/gene_set_scoring.html>,
|
|
6
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/cell_cycle.html>, <https://scarf.readthedocs.io/en/latest/reference/api/datastore.html>.
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- A partition is chosen (`clustering-and-embedding.md`) and its clusters need names.
|
|
11
|
-
- You need marker tables, panel checks, multiplet checks, signature scores or cell-cycle phases.
|
|
12
|
-
- Labels are final and a held-out reference exists for a post-hoc evaluation.
|
|
13
|
-
|
|
14
|
-
## Key concepts
|
|
15
|
-
|
|
16
|
-
- `run_marker_search(clusters, features=...)` takes an exact `cluster_labels` or `cluster_cut` ref
|
|
17
|
-
and a feature-selection ref, streams counts once (remote for mounted stores) and returns
|
|
18
|
-
`ArtifactRef(kind="marker_table")`. `run["markers"]` is the table for `run["clusters"]`.
|
|
19
|
-
- Columns: `score` (Scarf specificity, 0 to 1, summing to 1 across groups for each gene; near
|
|
20
|
-
1/n_groups means ubiquitous), `mean`/`mean_rest`, `frac_exp`/`frac_exp_rest`, `fold_change`,
|
|
21
|
-
`auc`, two-sided Mann-Whitney `p_value` and `p_value_adjusted` (BH within each group). They are
|
|
22
|
-
one-versus-rest statistics over cells, not replicate-aware differential expression.
|
|
23
|
-
- `get_markers` returns a DataFrame with a string `group_id`, rows sorted by `score` within each
|
|
24
|
-
group and groups in natural order (`"2"` before `"10"`). Defaults `min_score=0.25`,
|
|
25
|
-
`min_frac_exp=0.2` hide most genes; pass `-1` for both to get every gene for every group.
|
|
26
|
-
- A label is a hypothesis. It needs named positive markers, low lineage-negative markers and a
|
|
27
|
-
plausible QC and doublet profile. Keep an explicit `unresolved` label instead of forcing a name.
|
|
28
|
-
- Doublet scores rise with RNA content, so plasma cells and other high-RNA types score high as
|
|
29
|
-
whole clusters. Judge doublets within a lineage and per cell, not by a global cut.
|
|
30
|
-
- No public API saves user-assigned labels as an artifact. Store them as a live column with
|
|
31
|
-
`ds.cells.insert` (mutable, unversioned, written into the store).
|
|
32
|
-
- AUCell and WAGGR return `kind="enrichment_scores"` (activity scores, not p-values); cell-cycle
|
|
33
|
-
scoring returns `kind="cell_cycle"` (`phase`, `s_score`, `g2m_score`). Rows follow the selection.
|
|
34
|
-
|
|
35
|
-
## Recipes
|
|
36
|
-
|
|
37
|
-
### Get and read marker tables
|
|
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)
|
|
46
|
-
run = ds.pipeline.open(label="baseline")
|
|
47
|
-
clusters, markers = run["clusters"], run["markers"]
|
|
48
|
-
# Another partition needs its own table (one pass over counts):
|
|
49
|
-
markers_res1 = ds.run_marker_search(run["leiden_1.0"], features=run["feature_universe"])
|
|
50
|
-
|
|
51
|
-
top = ds.get_markers(marker=markers) # min_score=0.25, min_frac_exp=0.2
|
|
52
|
-
print(top.groupby("group_id", sort=False).head(8)
|
|
53
|
-
.groupby("group_id", sort=False)["feature_name"].agg(", ".join))
|
|
54
|
-
one = ds.get_markers(marker=markers, group_id=3) # an int matches the label "3"
|
|
55
|
-
print(one[["feature_name", "score", "frac_exp", "frac_exp_rest", "auc", "p_value_adjusted"]].head())
|
|
56
|
-
everything = ds.get_markers(marker=markers, min_score=-1, min_frac_exp=-1) # all genes x groups
|
|
57
|
-
# ds.export_markers_to_csv(markers, "markers.csv") writes marker names per group, wide format
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Tabulate a canonical marker panel
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
panel = ["CD3E", "IL7R", "CD8A", "NKG7", "GNLY", "MS4A1", "CD79A", "MZB1", "JCHAIN", "CD14",
|
|
64
|
-
"LYZ", "FCGR3A", "FCER1A", "LILRA4", "PPBP", "HBB", "CD34", "MKI67"]
|
|
65
|
-
order = list(dict.fromkeys(everything["group_id"])) # pivot would sort "10" before "2"
|
|
66
|
-
hits = everything[everything["feature_name"].isin(panel)]
|
|
67
|
-
frac = (hits.pivot(index="group_id", columns="feature_name", values="frac_exp")
|
|
68
|
-
.reindex(index=order, columns=[g for g in panel if g in set(hits["feature_name"])]))
|
|
69
|
-
score = hits.pivot(index="group_id", columns="feature_name", values="score").reindex_like(frac)
|
|
70
|
-
print(frac.round(2), score.round(2), sep="\n\n") # detection versus exclusivity
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Flag clusters for review: QC, doublets, multiplets and progenitors
|
|
74
|
-
|
|
75
|
-
Per cell, count lineages whose two specific genes are both detected, and the progenitor program
|
|
76
|
-
genes detected, from one raw-count panel export. Ambient genes (LYZ, HBB, JCHAIN, Ig) are left out
|
|
77
|
-
because they are detected almost everywhere.
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
in_run = run.cells.fetch_all("I").astype(bool)
|
|
81
|
-
review = run.cells.to_pandas_dataframe(["ids", "clusters", "doublet_score"]).set_index("ids")
|
|
82
|
-
review = review.assign(**{c: ds.cells.fetch_all(c)[in_run]
|
|
83
|
-
for c in ("RNA_nCounts", "RNA_percentMito")})
|
|
84
|
-
lineages = {"T": ["CD3D", "CD3E"], "B": ["MS4A1", "CD79B"], "myeloid": ["CD14", "FCN1"],
|
|
85
|
-
"plasma": ["MZB1", "TNFRSF17"]}
|
|
86
|
-
program = ["CD34", "PRSS57", "SPINK2", "CYTL1", "SOX4"] # SOX4 alone is broadly detected
|
|
87
|
-
wanted = list(dict.fromkeys(sum(lineages.values(), []) + program))
|
|
88
|
-
present = [g for g in wanted if g in set(ds.RNA.feats.fetch_all("names"))]
|
|
89
|
-
counts = ds.to_anndata(from_assay="RNA", feature_names=present) # obs_names are cell ids
|
|
90
|
-
hit = (pd.DataFrame(counts.X.toarray() > 0, index=counts.obs_names, columns=present)
|
|
91
|
-
.reindex(index=review.index, columns=wanted, fill_value=False))
|
|
92
|
-
review["n_lineages"] = sum(hit[genes].all(axis=1).astype(int) for genes in lineages.values())
|
|
93
|
-
review["progenitor"] = hit["CD34"] & (hit[program[1:]].sum(axis=1) >= 2) # coherent program
|
|
94
|
-
review["doublet_rank"] = review.groupby("clusters")["doublet_score"].rank(pct=True)
|
|
95
|
-
summary = review.groupby("clusters").agg(
|
|
96
|
-
n=("doublet_score", "size"), doublet=("doublet_score", "median"),
|
|
97
|
-
counts=("RNA_nCounts", "median"), mito=("RNA_percentMito", "median"),
|
|
98
|
-
two_lineages=("n_lineages", lambda s: (s >= 2).mean()), progenitor=("progenitor", "mean"))
|
|
99
|
-
summary["n_markers"] = (top["group_id"].value_counts()
|
|
100
|
-
.reindex(summary.index.astype(str), fill_value=0).to_numpy())
|
|
101
|
-
print(summary.round(2))
|
|
102
|
-
suspects = review[(review["n_lineages"] >= 2) & (review["doublet_rank"] >= 0.9)]
|
|
103
|
-
print(len(suspects), "cells co-detect two lineages and sit in their cluster's top doublet decile")
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Read the flags together, per cluster and per cell:
|
|
107
|
-
|
|
108
|
-
- Progenitor (HSPC): a coherent program in the same cells (CD34 with PRSS57, SPINK2, CYTL1; SOX4
|
|
109
|
-
supports) and few two-lineage cells. Primed progenitors add early genes of one lineage
|
|
110
|
-
(GATA2, KLF1, CPA3) that vary between cells, not mature markers of two lineages per cell.
|
|
111
|
-
- Multiplet: mature markers of two lineages in the same cells (T with myeloid, B or plasma with
|
|
112
|
-
T or myeloid), counts or features above both parent lineages, few markers of its own and a
|
|
113
|
-
high doublet rank. Single multiplets inside large clusters show up only in `suspects`.
|
|
114
|
-
- Doublet scores: compare a cluster with clusters of the same lineage, not the global median. A
|
|
115
|
-
whole plasma cluster scoring high is expected; a plasma subset co-detecting T genes is not.
|
|
116
|
-
- Ambiguous (a program plus two-lineage cells, or high counts without co-detection): keep
|
|
117
|
-
`unresolved` and record both readings.
|
|
118
|
-
|
|
119
|
-
### Assign labels and store them
|
|
120
|
-
|
|
121
|
-
Write the evidence next to each label. The map below is a template with placeholder IDs: never
|
|
122
|
-
copy a map from another dataset. Clusters not named stay `unresolved`.
|
|
123
|
-
|
|
124
|
-
```python
|
|
125
|
-
cluster_values = run.cells.fetch("clusters").astype(str)
|
|
126
|
-
labels = { # TEMPLATE: replace "<id>" and every gene with this dataset's own evidence
|
|
127
|
-
# "<id>": "CD14 monocyte", # + CD14, LYZ, FCN1 | - CD3E, MS4A1 | confidence high
|
|
128
|
-
# "<id>": "CD4 T", # + CD3E, IL7R, CD40LG | - CD8A, NKG7 | medium: CD4 sparse
|
|
129
|
-
# "<id>": "HSPC", # + CD34, PRSS57, SPINK2 | - no two-lineage cells | medium
|
|
130
|
-
# "<id>": "unresolved", # + CD3E with CD14 in the same cells, high counts | low
|
|
131
|
-
}
|
|
132
|
-
per_cell = pd.Series(cluster_values).map(labels).fillna("unresolved").to_numpy()
|
|
133
|
-
print(pd.Series(per_cell).value_counts())
|
|
134
|
-
annotation = np.full(ds.cells.N, "not analyzed", dtype=object)
|
|
135
|
-
annotation[in_run] = per_cell
|
|
136
|
-
ds.cells.insert("annotation_v1", annotation, overwrite=True) # live column, full cell axis
|
|
137
|
-
ds.cells.insert("annotation_v1_cells", in_run, overwrite=True)
|
|
138
|
-
named = sorted(int(c) for c, name in labels.items() if name != "unresolved")
|
|
139
|
-
keep = ds.select_cells(clusters, include=named) if named else run["analysis_cell_selection"]
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
`select_cells(include=[])` raises, hence the guard; `keep` can seed a graph without unresolved
|
|
143
|
-
clusters. Plot evidence with `ds.plots.dotplot(features=..., group_by="annotation_v1",
|
|
144
|
-
cell_key="annotation_v1_cells")` and `ds.plots.marker_heatmap(marker=markers, topn=3)`.
|
|
145
|
-
|
|
146
|
-
### Score gene sets with AUCell and WAGGR
|
|
147
|
-
|
|
148
|
-
```python
|
|
149
|
-
net = pd.DataFrame({ # or scarf.read_gmt("sets.gmt"): one source-target row per gene
|
|
150
|
-
"source": ["T_cell"] * 4 + ["B_cell"] * 3 + ["Monocyte"] * 4 + ["NK"] * 4,
|
|
151
|
-
"target": ["CD3D", "CD3E", "TRAC", "IL7R", "MS4A1", "CD79A", "CD79B",
|
|
152
|
-
"CD14", "LYZ", "S100A8", "FCN1", "NKG7", "GNLY", "KLRD1", "PRF1"]})
|
|
153
|
-
cells = run["analysis_cell_selection"]
|
|
154
|
-
universe = ds.select_all_features(from_assay="RNA")
|
|
155
|
-
aucell = ds.run_aucell(net, cells, features=universe, tmin=3) # one pass over counts
|
|
156
|
-
waggr = ds.run_waggr(net.assign(weight=1.0), cells, features=universe, tmin=3)
|
|
157
|
-
result = ds.get_enrichment(aucell) # lazy; sources=[...] loads a subset
|
|
158
|
-
assert result.cell_selection == cells
|
|
159
|
-
scores = pd.DataFrame(result.data.compute(), columns=list(result.source_names))
|
|
160
|
-
print(scores.groupby(run.cells.fetch("clusters")).mean().round(2))
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
AUCell ranks raw counts within each cell (0 to 1, `n_up` defaults to 5% of the universe). WAGGR
|
|
164
|
-
averages library-size-normalized expression with edge weights (unbounded, signed weights allowed).
|
|
165
|
-
|
|
166
|
-
### Read or compute cell-cycle phase
|
|
167
|
-
|
|
168
|
-
```python
|
|
169
|
-
phase = run.cells.to_pandas_dataframe(["clusters", "cell_cycle_phase", "s_score", "g2m_score"])
|
|
170
|
-
print(pd.crosstab(phase["clusters"], phase["cell_cycle_phase"], normalize="index").round(2))
|
|
171
|
-
cycle = ds.run_cell_cycle_scoring(keep) # new artifact; one pass over counts
|
|
172
|
-
print(pd.Series(np.asarray(ds.load_artifact(cycle)["phase"][:]).astype(str)).value_counts())
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Compare with existing labels (final post-hoc evaluation only)
|
|
176
|
-
|
|
177
|
-
Run once, after labels are frozen. Read the reference column here first, write the map from its
|
|
178
|
-
vocabulary before any crosstab, and never tune labels or parameters on the result.
|
|
179
|
-
|
|
180
|
-
```python
|
|
181
|
-
import hashlib
|
|
182
|
-
from sklearn.metrics import adjusted_rand_score, classification_report
|
|
183
|
-
|
|
184
|
-
ds.cells.to_pandas_dataframe(["ids", "annotation_v1"]).to_csv("labels_v1_frozen.csv", index=False)
|
|
185
|
-
print("sha256", hashlib.sha256(open("labels_v1_frozen.csv", "rb").read()).hexdigest())
|
|
186
|
-
reference = pd.Series(ds.cells.fetch_all("author_cell_type")[in_run]).astype(str) # held out
|
|
187
|
-
print(sorted(reference.unique())) # the vocabulary only; now write the map below
|
|
188
|
-
to_reference = { # TEMPLATE: our label -> reference label, fixed before seeing any agreement
|
|
189
|
-
# "CD4 T": "<reference label>",
|
|
190
|
-
}
|
|
191
|
-
ours = pd.Series(ds.cells.fetch_all("annotation_v1")[in_run]).astype(str)
|
|
192
|
-
pred = ours.map(to_reference).fillna("unmatched")
|
|
193
|
-
print(pd.crosstab(pred, reference))
|
|
194
|
-
shared = sorted(set(to_reference.values()))
|
|
195
|
-
both = (pred != "unmatched") & reference.isin(shared) # drops unresolved and unmapped classes
|
|
196
|
-
print("ARI all cells", round(adjusted_rand_score(reference, pred), 3))
|
|
197
|
-
if both.any():
|
|
198
|
-
print("ARI mapped only", round(adjusted_rand_score(reference[both], pred[both]), 3))
|
|
199
|
-
print(classification_report(reference, pred, labels=shared, zero_division=0))
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
Report precision and recall per class, ARI with and without ambiguous classes, and reference
|
|
203
|
-
classes with no counterpart. Disagreement is evidence: inspect large off-diagonal cells.
|
|
204
|
-
|
|
205
|
-
## Canonical markers
|
|
206
|
-
|
|
207
|
-
Confirm with dataset markers and use two or more genes. Human symbols; mouse symbols are title
|
|
208
|
-
case (`Cd3e`, `Ptprc`, `Mki67`), and panel lookups are exact, so convert the panel.
|
|
209
|
-
|
|
210
|
-
| Population | Positive markers | Notes and negatives |
|
|
211
|
-
|---|---|---|
|
|
212
|
-
| T cell | CD3D, CD3E, TRAC | MS4A1, CD14 low |
|
|
213
|
-
| CD4 T | IL7R, CD40LG, CD4 (often poorly detected) | CD8A, CD8B low; CCR7, SELL, LEF1 mark naive T |
|
|
214
|
-
| CD8 T | CD8A, CD8B | effector GZMK, GZMH, NKG7 |
|
|
215
|
-
| Treg | FOXP3, IL2RA, CTLA4 | within CD4 T |
|
|
216
|
-
| MAIT, gamma-delta T | SLC4A10, KLRB1 (MAIT); TRDC, TRGC1 (gamma-delta) | often within CD8 or effector T |
|
|
217
|
-
| NK | NKG7, GNLY, KLRD1, KLRF1, NCAM1 | CD3E low; NKG7, GNLY also in CD8 effector T |
|
|
218
|
-
| B cell | MS4A1, CD79A, CD19 | naive IGHD, TCL1A |
|
|
219
|
-
| Plasma cell, plasmablast | MZB1, JCHAIN, XBP1, TNFRSF17 | MS4A1 low; plasmablasts express MKI67 |
|
|
220
|
-
| CD14 monocyte | CD14, LYZ, S100A8, S100A9, FCN1 | |
|
|
221
|
-
| CD16 monocyte | FCGR3A, MS4A7, CDKN1C | FCGR3A also on NK |
|
|
222
|
-
| Conventional DC | FCER1A, CD1C, CLEC10A; CLEC9A (cDC1) | FCER1A also on basophils |
|
|
223
|
-
| Plasmacytoid DC | LILRA4, IL3RA, CLEC4C | GZMB shared with NK; MZB1 also high |
|
|
224
|
-
| Basophil, mast cell | CPA3, HDC, MS4A2; TPSAB1, KIT (mast) | |
|
|
225
|
-
| Neutrophil | CSF3R, FCGR3B, CXCR2 | low counts; rare after density gradients |
|
|
226
|
-
| Platelet, megakaryocyte | PPBP, PF4 | often attached to monocytes |
|
|
227
|
-
| Erythroid | HBB, HBA1 | frequent ambient contamination |
|
|
228
|
-
| HSPC | CD34, PRSS57, SPINK2, CYTL1, SOX4 | rare in blood; primed subsets add GATA2, KLF1 or CPA3 |
|
|
229
|
-
| Cycling (a state) | MKI67, TOP2A | label as a state, not a type |
|
|
230
|
-
| Immune, macrophage | PTPRC; C1QA, CD68 (macrophage) | |
|
|
231
|
-
| Epithelium, gut | EPCAM, KRT8, KRT18; LGR5, OLFM4 (stem) | goblet MUC2; colonocyte CA1 |
|
|
232
|
-
| Fibroblast | PDGFRA, COL1A1, DCN | subtypes vary by tissue, e.g. APOD or CCN2 (CTGF) high; `^CCN` is in the default HVG blacklist, markers still test it |
|
|
233
|
-
| Endothelium | PECAM1, VWF, CDH5 | |
|
|
234
|
-
| Smooth muscle, pericyte | ACTA2, MYH11, DES; RGS5 (pericyte) | ACTA2 also on myofibroblasts |
|
|
235
|
-
| Keratinocyte, melanocyte | KRT5, KRT14 (basal), KRT10 (suprabasal); PMEL, MLANA (melanocyte) | |
|
|
236
|
-
| Neuron | RBFOX3, SNAP25; SLC17A7 (excitatory); GAD1, GAD2 (inhibitory) | |
|
|
237
|
-
| Astrocyte, oligodendrocyte | GFAP, AQP4; MBP, PLP1, MOG (oligodendrocyte) | |
|
|
238
|
-
| OPC, microglia | PDGFRA, CSPG4 (OPC); CSF1R, P2RY12 (microglia) | CSF1R also on macrophages |
|
|
239
|
-
|
|
240
|
-
## Parameters that matter
|
|
241
|
-
|
|
242
|
-
| Parameter | Default | Change when |
|
|
243
|
-
|---|---|---|
|
|
244
|
-
| `min_score` (`get_markers`) | `0.25` | `-1` to see negatives and weak genes; raise for a short list |
|
|
245
|
-
| `min_frac_exp` (`get_markers`) | `0.2` | `-1` with `min_score=-1` for complete panel tables |
|
|
246
|
-
| `features` (`run_marker_search`) | required | `run["feature_universe"]` tests every gene; an HVG ref limits the search |
|
|
247
|
-
| `tmin` (AUCell, WAGGR) | `5` | Lower for short sets; sources with fewer matched targets are dropped |
|
|
248
|
-
| `n_up` (AUCell) | `None` (5% of universe) | Fix it when comparing runs; changes the score scale |
|
|
249
|
-
| `s_genes` / `g2m_genes` | built-in human and mouse lists | Other species or naming schemes |
|
|
250
|
-
|
|
251
|
-
## Check before moving on
|
|
252
|
-
|
|
253
|
-
- Every named cluster has at least two positive markers with high `frac_exp` and `score` well above
|
|
254
|
-
1/n_groups, and lineage negatives with low `frac_exp`. The evidence is written next to the label.
|
|
255
|
-
Few markers usually means a split within one lineage: merge, or name a state only with evidence.
|
|
256
|
-
- Clusters with two lineages' markers in the same cells, counts above both parents or a high
|
|
257
|
-
within-lineage doublet rank are `unresolved`. A CD34 program without co-detection is HSPC.
|
|
258
|
-
- Rare types hide in big clusters; check finer resolutions or subcluster the lineage.
|
|
259
|
-
- The label map, marker ref and run ID are recorded. Held-out labels were not read before this.
|
|
260
|
-
|
|
261
|
-
## Pitfalls
|
|
262
|
-
|
|
263
|
-
- Default `get_markers` filters hide negative markers. `group_id` is a string while Leiden labels
|
|
264
|
-
are integers; convert before joining.
|
|
265
|
-
- Direct calls do not reuse pipeline outputs: `run_marker_search(run["clusters"], ...)` and
|
|
266
|
-
`run_cell_cycle_scoring(...)` write new artifacts and reread counts. Read the run's refs instead.
|
|
267
|
-
- Ambient genes (HBB, LYZ, S100A8, JCHAIN, immunoglobulins) show nonzero `frac_exp` in most
|
|
268
|
-
clusters. Use `score` and `auc`, not detection alone, and leave them out of co-detection checks.
|
|
269
|
-
- Small groups inflate `fold_change` and can pass `min_score` with odd genes; check group size.
|
|
270
|
-
- `ds.cells.insert(..., overwrite=True)` silently replaces a column; use versioned names.
|
|
271
|
-
- `select_cells(include=...)` needs integers for integer cluster artifacts (`TypeError` otherwise).
|
|
272
|
-
- Scores from different feature universes, `n_up` or WAGGR `mode`/`log_transform` are not comparable.
|
|
273
|
-
|
|
274
|
-
## See also
|
|
275
|
-
|
|
276
|
-
- `clustering-and-embedding.md`: choosing the partition and aligning artifacts to cell IDs.
|
|
277
|
-
- `features-and-graphs.md`: subclustering one lineage before naming its states.
|
|
278
|
-
- `quality-control.md`: doublet scores and QC covariates behind unresolved clusters.
|
|
279
|
-
- `plotting.md` (`dotplot`, `marker_heatmap`); `integration-and-comparisons.md` (label transfer,
|
|
280
|
-
condition comparisons); `pipeline-runs-and-artifacts.md` (run fields, lineage).
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
# Performance and export
|
|
2
|
-
|
|
3
|
-
Resource budgets, out-of-core rules, remote I/O on mounts, and exporting counts, metadata,
|
|
4
|
-
markers, and pipeline-run results. Docs: <https://scarf.readthedocs.io/en/latest/concepts/memory_and_execution.html>,
|
|
5
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/remote_stores.html>, <https://scarf.readthedocs.io/en/latest/tutorials/import_and_export.html>,
|
|
6
|
-
<https://scarf.readthedocs.io/en/latest/tutorials/custom_analyses.html>, <https://scarf.readthedocs.io/en/latest/concepts/benchmarks.html>.
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- Before a large run, on a shared host, or in a batch job.
|
|
11
|
-
- When analysis on a mount is slow or will make many passes over counts.
|
|
12
|
-
- When handing results to Scanpy, Seurat, R, a count model, or a colleague.
|
|
13
|
-
- When a step may outlast the agent shell's foreground limit.
|
|
14
|
-
|
|
15
|
-
## Key concepts
|
|
16
|
-
|
|
17
|
-
- `mem_budget` is a planning budget (block size, write concurrency, feature batch size), not an
|
|
18
|
-
RSS cap. Graphs, marker batches, and allocator overhead come on top: in the benchmarks a 5M-cell
|
|
19
|
-
run peaked at 51.6 GiB on a 48 GiB budget, and marker search alone added about 32 GiB.
|
|
20
|
-
- Resolution order: explicit `mem_budget`/`nthreads` argument, then env `SCARF_MEM_BUDGET` /
|
|
21
|
-
`SCARF_WORKERS`, then detection (cgroup and CPU-affinity aware). Specs: bytes (int), `"8G"`,
|
|
22
|
-
`"512M"` (binary units, G = 1024^3 bytes), or a fraction of detected memory such as `"0.6"`.
|
|
23
|
-
A bare `"8"` is rejected as ambiguous.
|
|
24
|
-
- More workers mean more concurrent buffers and remote requests; pair them with a `mem_budget`.
|
|
25
|
-
- Converters need a `mem_budget` that fits the default count layout and refuse before writing
|
|
26
|
-
when it does not (`references/data-access.md`). Prefer more memory over the smaller layout the
|
|
27
|
-
refusal names: smaller layouts slow every later gene-major read.
|
|
28
|
-
- A `DataStore` is not thread-safe: call it from one thread at a time. Use separate stores or
|
|
29
|
-
separate mount targets for independent parallel analyses.
|
|
30
|
-
- Opt-in parallel UMAP, tSNE, and ANN builds record the resolved worker count in provenance.
|
|
31
|
-
Pass `nthreads` explicitly when such results must stay reusable across machines.
|
|
32
|
-
- Counts stream in blocks. `ds.RNA.rawData` is a lazy `ChunkedArray`; `.compute()` on a large
|
|
33
|
-
slice materializes it. `ds.to_anndata(...)` always builds `X` in memory; ordinary
|
|
34
|
-
`scarf.to_h5ad(assay, path)` and `scarf.to_mtx` stream.
|
|
35
|
-
- On a mount, every pass over counts is a network read; artifacts (normalized, PCA, graph) live
|
|
36
|
-
in the local target. `local_cache` (PCA) stages normalized data only when the datastore
|
|
37
|
-
location itself is remote, so it is skipped for a local mount target.
|
|
38
|
-
|
|
39
|
-
## Recipes
|
|
40
|
-
|
|
41
|
-
### Set budgets and batch-friendly output
|
|
42
|
-
|
|
43
|
-
```python
|
|
44
|
-
import scarf
|
|
45
|
-
|
|
46
|
-
scarf.configure_output(progress=False, timestamps=True)
|
|
47
|
-
scarf.set_verbosity(level="INFO", filepath="scarf-run.log") # logs go to this file, not stdout
|
|
48
|
-
ds = scarf.DataStore("analysis.zarr", mem_budget="16G", nthreads=8, min_features_per_cell=-1)
|
|
49
|
-
print(ds.summary().to_dict()["resources"]) # {'memory_bytes': ..., 'workers': 8, ...}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Environment equivalent: `SCARF_MEM_BUDGET=16G SCARF_WORKERS=8 python job.py`.
|
|
53
|
-
`configure_output(level=...)` does not hide progress bars; pass `progress=False` explicitly.
|
|
54
|
-
|
|
55
|
-
### Stream counts instead of materializing
|
|
56
|
-
|
|
57
|
-
Slice lazily, then iterate ordered row blocks; never `.compute()` the whole matrix.
|
|
58
|
-
|
|
59
|
-
```python
|
|
60
|
-
import numpy as np
|
|
61
|
-
|
|
62
|
-
run = ds.pipeline.open(label="baseline")
|
|
63
|
-
cell_index = np.flatnonzero(run.cells.fetch_all("I"))
|
|
64
|
-
hvg = np.flatnonzero(np.asarray(run.features.fetch_all("highly_variable_features"), dtype=bool))
|
|
65
|
-
selected = ds.RNA.rawData[:, hvg][cell_index, :]
|
|
66
|
-
detected = np.concatenate(
|
|
67
|
-
[np.count_nonzero(block, axis=1) for block in selected.stream_blocks(nthreads=4, msg="HVGs")]
|
|
68
|
-
)
|
|
69
|
-
print(ds.RNA.rawData[:3, :5].compute()) # tiny slices only
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Make repeated passes over a mount cheap
|
|
73
|
-
|
|
74
|
-
Repack copies the remote counts once into a self-contained local store, keeping artifacts and
|
|
75
|
-
pipeline runs. It needs disk for the full counts plus `countsT`.
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
python -m scarf.tools.repack_zarr work/pbmc.zarr work/pbmc_local.zarr --mem-budget 4G
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
For a mount of a few thousand cells, repack takes tens of seconds and reopening drops from 10 to
|
|
82
|
-
20 s to under 1 s. The output has no `matrixSource`, and `ds.pipeline.open(label=...)` still
|
|
83
|
-
works. `--data-only` drops analyses; `--nthreads`, `--profile {fast_local,cloud}` and
|
|
84
|
-
`--storage-options` (JSON, e.g. `'{"skip_signature": true}'` for public S3) also exist.
|
|
85
|
-
|
|
86
|
-
### Run long steps from an agent shell
|
|
87
|
-
|
|
88
|
-
Some agent shells stop a foreground command after about 10 minutes, and an unbounded wait loop can
|
|
89
|
-
hang for as long. Write the step as a script that logs to a file and ends with `DONE` or `FAILED`:
|
|
90
|
-
|
|
91
|
-
```python
|
|
92
|
-
# step_baseline.py
|
|
93
|
-
import sys
|
|
94
|
-
import traceback
|
|
95
|
-
|
|
96
|
-
import scarf
|
|
97
|
-
|
|
98
|
-
scarf.configure_output(level="WARNING", progress=False)
|
|
99
|
-
try:
|
|
100
|
-
ds = scarf.DataStore("analysis.zarr", min_features_per_cell=-1)
|
|
101
|
-
run = ds.pipeline.run(label="baseline")
|
|
102
|
-
print("run", run.run_id, run.status, flush=True)
|
|
103
|
-
except Exception:
|
|
104
|
-
traceback.print_exc()
|
|
105
|
-
print("FAILED", flush=True)
|
|
106
|
-
sys.exit(1)
|
|
107
|
-
print("DONE", flush=True)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Start it detached with a timeout and keep the PID in a file (shell variables do not survive between
|
|
111
|
-
agent tool calls). Make sure `timeout`'s SIGTERM reaches Python. Behind a wrapper such as `uv run`, put `timeout` inside it: Scarf then recorded
|
|
112
|
-
the run as `interrupted` in 6 of 7 tests; `timeout 1800 uv run ...` left it `running` both times.
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
mkdir -p logs
|
|
116
|
-
nohup timeout 1800 python step_baseline.py > logs/baseline.log 2>&1 &
|
|
117
|
-
echo $! > logs/baseline.pid
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Wait in bounded slices that stay under the shell limit and fail fast:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
LOG=logs/baseline.log; PID=$(cat logs/baseline.pid); state=running
|
|
124
|
-
for i in $(seq 1 50); do # 50 x 10 s, under a 10-minute limit
|
|
125
|
-
alive=1; kill -0 "$PID" 2>/dev/null || alive=0 # check first: a dead process wrote its last line
|
|
126
|
-
if grep -qx DONE "$LOG"; then state=done; break; fi
|
|
127
|
-
if grep -qx FAILED "$LOG" || grep -q Traceback "$LOG"; then state=failed; break; fi
|
|
128
|
-
if [ "$alive" = 0 ]; then state=died; break; fi
|
|
129
|
-
sleep 10
|
|
130
|
-
done
|
|
131
|
-
echo "state=$state"; tail -n 5 "$LOG"
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
`running`: call the loop again. `failed`: read the traceback. `died`: the process ended without a
|
|
135
|
-
final line (timeout, out of memory, kill); `ds.pipeline.list_runs()` shows what was recorded. The
|
|
136
|
-
variable is `state` because zsh reserves `status`.
|
|
137
|
-
Check the saved PID with `kill -0`: `pgrep -f step_baseline.py` also matches the launching shell,
|
|
138
|
-
so it never reports the job as gone. On macOS, `timeout` is `gtimeout` from GNU coreutils.
|
|
139
|
-
|
|
140
|
-
### Export a completed run to AnnData or H5AD
|
|
141
|
-
|
|
142
|
-
Run export uses the frozen cells and feature universe and holds `X` in memory. `cell_type` below
|
|
143
|
-
and in later recipes is a placeholder for your own label column, not held-out author labels.
|
|
144
|
-
|
|
145
|
-
```python
|
|
146
|
-
adata = ds.to_anndata(run=run) # obs: frozen fields; obsm: X_umap; X: raw counts
|
|
147
|
-
live = ds.cells.to_pandas_dataframe(["ids", "cell_type", "RNA_nCounts"]).set_index("ids")
|
|
148
|
-
adata.obs = adata.obs.join(live) # live labels are not in the run: join on cell ids
|
|
149
|
-
adata.obsm["X_pca"] = np.asarray(ds.load_artifact(run["pca"])["data"][:]) # run analysis cells
|
|
150
|
-
graph = ds.load_graph(graph=run["connectivity_map"], symmetric=True, upper_only=False)
|
|
151
|
-
assert graph.shape[0] == adata.n_obs
|
|
152
|
-
adata.obsp["connectivities"] = graph
|
|
153
|
-
adata.write_h5ad("baseline_run.h5ad")
|
|
154
|
-
|
|
155
|
-
scarf.to_h5ad(ds.RNA, "baseline_run_plain.h5ad", run=run) # one call, no extras
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
`adata.var_names` are feature IDs; symbols are in `adata.var["names"]`. Pass
|
|
159
|
-
`snapshot_columns=["cell_type"]` to `ds.pipeline.run` to freeze live labels into future run
|
|
160
|
-
exports (see `pipeline-runs-and-artifacts.md`).
|
|
161
|
-
|
|
162
|
-
### Export a complete assay (streaming)
|
|
163
|
-
|
|
164
|
-
```python
|
|
165
|
-
scarf.to_h5ad(ds.RNA, "full_assay.h5ad") # every cell, including I False; live metadata
|
|
166
|
-
scarf.to_mtx(ds.RNA, "full_assay_mtx") # matrix.mtx, genes.tsv, barcodes.tsv
|
|
167
|
-
scarf.to_mtx(ds.RNA, "full_assay_mtx_gz", compress=True) # Cell Ranger 3 names, .gz
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Export a gene panel or normalized values
|
|
171
|
-
|
|
172
|
-
```python
|
|
173
|
-
panel = ds.to_anndata(from_assay="RNA", feature_names=["CD3E", "MS4A1", "LYZ", "NKG7"])
|
|
174
|
-
normed = ds.to_anndata(run=run, matrix="normed") # library size scaled to 1000 per cell, no log
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
`feature_names` (exact, unique, ordered) and `feature_indexes` are mutually exclusive and are
|
|
178
|
-
rejected together with `run=`. Without `run`, `cell_key` (default `"I"`) selects cells, and
|
|
179
|
-
`obs_names` are the cell `ids`: a panel export is the cheapest per-cell marker table.
|
|
180
|
-
|
|
181
|
-
### Export markers and metadata tables
|
|
182
|
-
|
|
183
|
-
```python
|
|
184
|
-
ds.export_markers_to_csv(marker=run["markers"], csv_filename="markers_wide.csv") # names only
|
|
185
|
-
ds.get_markers(marker=run["markers"]).to_csv("markers_long.csv", index=False) # with stats
|
|
186
|
-
run.cells.to_pandas_dataframe(["ids", "clusters", "doublet_score"]).to_csv("run_cells.csv", index=False)
|
|
187
|
-
ds.cells.to_pandas_dataframe(["ids", "cell_type"], key="I").to_csv("cells.csv", index=False)
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Export pseudobulk counts
|
|
191
|
-
|
|
192
|
-
Raw counts per population x sample plus a design table, for DESeq2, edgeR or another count model.
|
|
193
|
-
|
|
194
|
-
```python
|
|
195
|
-
bulk = ds.make_bulk(
|
|
196
|
-
"cell_type", secondary_groups="sample_id", # one column per population x sample
|
|
197
|
-
cell_selection=run["analysis_cell_selection"],
|
|
198
|
-
aggr_type="sum", feature_label="id", # raw counts; Ensembl ids are unique
|
|
199
|
-
)
|
|
200
|
-
cells = ds.cells.to_pandas_dataframe(["cell_type", "sample_id", "donor_id", "condition"])
|
|
201
|
-
cells = cells[np.asarray(run.cells.fetch_all("I"), dtype=bool)]
|
|
202
|
-
assert cells.groupby("sample_id")[["donor_id", "condition"]].nunique().eq(1).all().all()
|
|
203
|
-
cells["column"] = cells["cell_type"].astype(str) + "_" + cells["sample_id"].astype(str)
|
|
204
|
-
by_column = cells.groupby("column")
|
|
205
|
-
design = by_column.first().assign(n_cells=by_column.size()).reindex(bulk.columns) # empty -> NaN
|
|
206
|
-
design["n_cells"] = design["n_cells"].fillna(0).astype(int)
|
|
207
|
-
keep = design["n_cells"] >= 10 # choose a floor and report what you drop
|
|
208
|
-
assert np.allclose(bulk.to_numpy(), np.round(bulk.to_numpy()))
|
|
209
|
-
bulk.loc[:, keep].round().astype("int64").to_csv("pseudobulk_counts.csv")
|
|
210
|
-
design.loc[keep].to_csv("pseudobulk_design.csv")
|
|
211
|
-
print(design[keep].groupby(["cell_type", "condition"])["donor_id"].nunique().unstack(fill_value=0))
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
`make_bulk` emits every group x subgroup pair (all-zero when empty), named `f"{group}_{subgroup}"`;
|
|
215
|
-
a name collision raises. Sums keep the count dtype (often float32). Model one population at a time
|
|
216
|
-
with donor-level terms; with repeated samples per donor, include the donor (paired) or sum its
|
|
217
|
-
samples first, and avoid rank-deficient designs (integration-and-comparisons.md).
|
|
218
|
-
|
|
219
|
-
### Write a self-contained subset store
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
keep = np.flatnonzero(run.cells.fetch_all("I")) # or cell_key="my_bool_column"
|
|
223
|
-
scarf.SubsetZarr("run_cells.zarr", assays=[ds.RNA], cell_idx=keep).dump()
|
|
224
|
-
sub = scarf.DataStore("run_cells.zarr") # first open must be writable
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
The subset copies counts locally (no `matrixSource`), keeps every feature and cell column, and
|
|
228
|
-
contains no artifacts or pipeline runs. Use it to hand off, or before `to_mtx` of run cells.
|
|
229
|
-
|
|
230
|
-
## What a run export contains
|
|
231
|
-
|
|
232
|
-
| Item | `to_anndata(run=run)` / `to_h5ad(assay, path, run=run)` | Otherwise |
|
|
233
|
-
|---|---|---|
|
|
234
|
-
| Cells | the run's analysis selection | `to_h5ad(ds.RNA, path)` exports all rows |
|
|
235
|
-
| Features | the full feature universe; HVG flag in `var["highly_variable_features"]` | `feature_names=` without `run` |
|
|
236
|
-
| `X` | raw counts; `matrix="normed"` (to_anndata only) for scaled values | |
|
|
237
|
-
| `obs` | frozen fields: cell-cycle, `leiden_*`, `paris`, `clusters`, `doublet_score`, `snapshot_columns` | join `ds.cells` by `ids` |
|
|
238
|
-
| `obsm` | `X_umap` | PCA: `ds.load_artifact(run["pca"])["data"]` |
|
|
239
|
-
| `obsp`, markers, run report | not exported | `ds.load_graph`, `get_markers`, `run.report(format="markdown")` |
|
|
240
|
-
| MTX | `to_mtx` has no `run=` | `SubsetZarr` with run cells, then `to_mtx` |
|
|
241
|
-
|
|
242
|
-
## Parameters that matter
|
|
243
|
-
|
|
244
|
-
| Parameter | Default | Change when |
|
|
245
|
-
|---|---|---|
|
|
246
|
-
| `mem_budget` / `SCARF_MEM_BUDGET` | detected system or cgroup memory | shared host or batch job; leave headroom for graphs and markers |
|
|
247
|
-
| `nthreads` / `SCARF_WORKERS` | detected CPUs | shared host, remote stores, reproducible parallel UMAP/ANN |
|
|
248
|
-
| `configure_output(progress=)` | `True` | `False` in logs and batch jobs |
|
|
249
|
-
| `run_pca(local_cache=)` | `"auto"` | path string to keep scratch for a remote store; plan `cells x features x 4` bytes |
|
|
250
|
-
| `to_anndata(matrix=)` | `"raw"` | `"normed"` for scaled values |
|
|
251
|
-
| `to_h5ad(embeddings_cols=)` | `["UMAP", "tSNE"]` live column prefixes | legacy stores only; rejected with `run=` |
|
|
252
|
-
| `to_mtx(compress=)` | `False` | `True` for Cell Ranger 3 file names |
|
|
253
|
-
| `get_markers` / `export_markers_to_csv` `min_score`, `min_frac_exp` | `0.25`, `0.2` | widen or narrow the exported marker list |
|
|
254
|
-
| `make_bulk(aggr_type=, feature_label=, pseudo_reps=)` | `"mean"`, `"index"`, `1` | `"sum"` and `"id"` for count models; never `pseudo_reps` above 1 for inference |
|
|
255
|
-
| `SubsetZarr(reset_cell_filter=)` | `True` (new `I` all true) | `False` to carry `I` over |
|
|
256
|
-
|
|
257
|
-
## Check before moving on
|
|
258
|
-
|
|
259
|
-
- `ds.summary().to_dict()["resources"]` shows the budget actually in effect.
|
|
260
|
-
- At `INFO`, lines such as `execution countsTCellBand: ... fetch=...s` show remote fetch time per
|
|
261
|
-
stage; the run report records stage timing and sampled RSS.
|
|
262
|
-
- After an export: reload, compare shape to `run.cells.fetch("ids").shape` and feature count,
|
|
263
|
-
confirm `obsm["X_umap"]`, and check joined labels have no unexpected missing values.
|
|
264
|
-
- Pseudobulk: integer counts, `design` aligned to `bulk.columns`, empty and tiny columns dropped,
|
|
265
|
-
enough donors per condition in each population you model.
|
|
266
|
-
- A background step ended with `DONE`, and its run report says `completed`.
|
|
267
|
-
|
|
268
|
-
## Pitfalls
|
|
269
|
-
|
|
270
|
-
- Every `to_anndata` call (panel, run, or full) materializes `X`; size it before exporting a
|
|
271
|
-
large atlas. Ordinary `to_h5ad` streams but writes every cell, inactive ones included.
|
|
272
|
-
- Run export rejects `from_assay`, `cell_key`, `feature_names`, and `feature_indexes`.
|
|
273
|
-
`to_h5ad(run=)` also rejects `embeddings_cols`, `skip_recalc_nfeats=False`, and `nthreads`.
|
|
274
|
-
- Run `obs` lacks live columns (author labels, QC) unless captured with `snapshot_columns`.
|
|
275
|
-
- `export_markers_to_csv` writes names only, filtered by `min_score`/`min_frac_exp`; use
|
|
276
|
-
`get_markers(marker=ref)` for statistics. Pass the exact marker ref, never a guess.
|
|
277
|
-
- Remote costs for a few thousand cells on a Hugging Face mount: open 10 to 20 s, a new mount a
|
|
278
|
-
few minutes, the pipeline about a minute (cell cycle, HVG, normalization and markers each
|
|
279
|
-
re-read `countsT`), exports seconds to tens of seconds. A 4-gene panel export still reads every
|
|
280
|
-
cell's count rows.
|
|
281
|
-
- `SubsetZarr` keeps all features, drops artifacts and runs, refuses an existing destination
|
|
282
|
-
unless `overwrite_existing_file=True`, and refuses a destination overlapping the source.
|
|
283
|
-
- `to_mtx(compress=True)` on CELLxGENE stores writes gene biotypes as feature types; see
|
|
284
|
-
`data-access.md` before re-importing.
|
|
285
|
-
|
|
286
|
-
## See also
|
|
287
|
-
|
|
288
|
-
- `data-access.md`: opening stores, mounts, Cytebase, imports.
|
|
289
|
-
- `pipeline-runs-and-artifacts.md`: run reports, `snapshot_columns`, artifact loading.
|
|
290
|
-
- `markers-and-annotation.md`: marker statistics and thresholds.
|
|
291
|
-
- `integration-and-comparisons.md`: donors, two-arm donors and tests behind a pseudobulk design.
|