API Reference¶
Assets¶
Alignment asset types for Stargazer.¶
spec: docs/architecture/types.md
Alignment
dataclass
¶
Bases: Asset
BAM/CRAM alignment file asset.
Carries reference_cid and r1_cid for provenance (PROV entity derivation). The format is the file name's extension. Fields are kept to what fits a new public file's 9 metadata keys with the asset type and owner.
Source code in src/stargazer/assets/alignment.py
AlignmentIndex
dataclass
¶
Bases: Asset
BAI/CRAI alignment index file asset.
A companion: companion_of is the CID of the Alignment it indexes.
Source code in src/stargazer/assets/alignment.py
BQSRReport
dataclass
¶
Bases: Asset
BQSR recalibration table produced by GATK BaseRecalibrator.
Carries alignment_cid linking to the Alignment it was produced from.
Source code in src/stargazer/assets/alignment.py
Asset base dataclass for Stargazer.¶
An Asset is a file plus typed metadata. cid is the file's IPFS CID,
computed locally; path is a flyte.io.File naming where the stored bytes
live (the object store, or an IPFS gateway for public data), so an asset
passed between tasks always points somewhere every pod can read.
fetch() makes a local copy, with its companions beside it, and returns
its path. A companion is any asset whose companion_of keyvalue holds
another asset's CID: an index or a sequence dictionary that tools expect
beside the file it names.
spec: docs/architecture/types.md
Asset
dataclass
¶
Base class for all typed file assets in Stargazer.
Attributes:
| Name | Type | Description |
|---|---|---|
cid |
str
|
IPFS CID of the stored file |
path |
File | None
|
The stored file as a |
keyvalues |
dict[str, str]
|
On a bare Asset, all of its metadata, serialized
verbatim (the |
Subclasses declare typed fields as normal dataclass attributes:
@dataclass
class Alignment(Asset):
_asset_key: ClassVar[str] = "alignment"
sample_id: str = ""
duplicates_marked: bool = False
Fields are plain Python attributes. to_keyvalues() serializes them to
dict[str, str] at storage boundaries; from_keyvalues() reconstructs
from storage. str fields pass through directly; all other types use
json.dumps / json.loads. declared_fields() lists a type's
fields. Attributes are strict (assigning an undeclared one raises); extra
keys go in keyvalues instead:
aln.keyvalues["lane"] = "3"
Source code in src/stargazer/assets/asset.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
__init_subclass__(**kwargs)
¶
__setattr__(name, value)
¶
Enforce declared fields on typed subclasses and coerce path to a File.
Source code in src/stargazer/assets/asset.py
declared_fields()
classmethod
¶
Names of the fields this asset type declares, in declaration order.
These are the typed keyvalues it reads and writes: every dataclass
field except the base cid, path and keyvalues. Bare Asset
declares none.
Source code in src/stargazer/assets/asset.py
fetch()
async
¶
Make a local copy of this asset and its companions; return its path.
The asset lands at <STARGAZER_LOCAL>/<cid>/<name>, and its
companions (StorageClient.companions: an index, a sequence
dictionary) land in the same directory, where tools look for them.
Outputs that record it as an input under another key, such as an
Alignment's reference_cid, stay behind. An asset built from a
local file that was never uploaded is returned in place. Copies
already on disk are reused; a companion file left by an earlier fetch
is replaced when a different one of that name is picked now. A
companion named like the asset itself is skipped.
Source code in src/stargazer/assets/asset.py
from_dict(data)
classmethod
¶
Reconstruct from a serialized dict.
Source code in src/stargazer/assets/asset.py
from_keyvalues(kv, cid='', path=None)
classmethod
¶
Reconstruct from a storage keyvalues dict.
str fields are assigned directly; all other types are deserialized
with json.loads (raising json.JSONDecodeError on values that
don't parse — callers that must tolerate malformed records catch it,
see specialize()). On a typed class, every key that isn't
asset or a declared field becomes an extra in keyvalues.
Bare Asset receives the keyvalues verbatim.
Source code in src/stargazer/assets/asset.py
to_dict()
¶
Serialize to a JSON-friendly dict: the file's location and name.
Source code in src/stargazer/assets/asset.py
to_keyvalues()
¶
Serialize to storage format.
str fields pass through as-is; all other types are serialized with
json.dumps. A typed asset's extra keys are written beside its
declared fields. Bare Asset instances return their keyvalues
verbatim. The result is always a copy, so callers (e.g. _owner
stamping at the storage layer) can mutate it without touching the
Asset.
Raises:
| Type | Description |
|---|---|
ValueError
|
when a typed asset's |
Source code in src/stargazer/assets/asset.py
update(path, **kwargs)
async
¶
Store a local file as this asset, setting fields from kwargs first.
Sets cid and path (the stored File) once the file is uploaded and
its index row has committed. Raises if either fails.
Source code in src/stargazer/assets/asset.py
assemble(**filters)
async
¶
Query storage by keyvalue filters and return specialized assets.
Every filter must match exactly. A list value matches any of its entries
(asset=["r1", "r2"]). Searches the user's index and, when a Pinata key
is configured, the public tier; one asset per CID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**filters
|
Any
|
Keyvalue filters; values are strings or lists of strings |
{}
|
Returns:
| Type | Description |
|---|---|
list[Asset]
|
Flat list of specialized Asset subclass instances. |
Examples:
assets = await assemble(build="GRCh38", asset="reference") ref = next(a for a in assets if isinstance(a, Reference))
assets = await assemble(sample_id="NA12878", asset=["r1", "r2"]) r1 = next(a for a in assets if isinstance(a, R1))
Source code in src/stargazer/assets/asset.py
Notebook asset type for Stargazer.¶
spec: docs/architecture/types.md
Notebook
dataclass
¶
Bases: Asset
A marimo notebook published from a user's workspace to the public tier.
A workspace notebook is a plain file until its owner publishes it from
the dashboard, which is the only thing that creates one. title and
description are the notebook's declared main_name and
main_description, and slug is its workspace filename's stem, which
ties the public record to the notebook it came from.
Source code in src/stargazer/assets/notebook.py
Read file asset types for Stargazer.¶
spec: docs/architecture/types.md
R1
dataclass
¶
Bases: Asset
R1 (forward) FASTQ read file asset.
Carries mate_cid pointing to the paired R2 asset's CID (empty for single-end).
Source code in src/stargazer/assets/reads.py
Reference genome asset types for Stargazer.¶
spec: docs/architecture/types.md
AlignerIndex
dataclass
¶
Bases: Asset
Aligner index file asset (one file per index file for multi-file indices).
A companion: companion_of is the CID of the Reference it indexes.
Source code in src/stargazer/assets/reference.py
Reference
dataclass
¶
Bases: Asset
Reference FASTA file asset.
Source code in src/stargazer/assets/reference.py
contigs()
async
¶
Read contig names from the companion .fai index.
Fetches the reference first, which brings the ReferenceIndex companion alongside the local copy, so it works in any pod.
Source code in src/stargazer/assets/reference.py
ReferenceIndex
dataclass
¶
Bases: Asset
FASTA index (.fai) file asset.
A companion: companion_of is the CID of the Reference it indexes.
Source code in src/stargazer/assets/reference.py
scRNA-seq asset types for Stargazer.¶
spec: docs/architecture/types.md
AnnData
dataclass
¶
Bases: Asset
AnnData (.h5ad) file asset for single-cell RNA-seq data.
Tracks pipeline stage, cell/gene counts, and provenance through the scRNA-seq processing steps.
Source code in src/stargazer/assets/scrna.py
Variant call asset types for Stargazer.¶
spec: docs/architecture/types.md
KnownSites
dataclass
¶
Bases: Asset
Known variant sites VCF: BQSR known sites, or a VQSR training resource.
resource_name, known, training, truth and prior are the VQSR
resource arguments ("true"/"false" strings and a numeric prior).
Source code in src/stargazer/assets/variants.py
KnownSitesIndex
dataclass
¶
Bases: Asset
VCF index (.idx) file for a KnownSites asset.
A companion: companion_of is the CID of the KnownSites VCF it indexes.
Source code in src/stargazer/assets/variants.py
VQSRModel
dataclass
¶
Bases: Asset
VQSR recalibration model: the .recal file VariantRecalibrator writes.
ApplyVQSR needs two more files from the same run, stored as its
companions: the recal file's index (VQSRModelIndex) and the tranches
file (VQSRTranches).
Source code in src/stargazer/assets/variants.py
VQSRModelIndex
dataclass
¶
Bases: Asset
VCF index (.idx) for a VQSRModel's recal file.
A companion: companion_of is the CID of the VQSRModel it indexes.
Source code in src/stargazer/assets/variants.py
VQSRTranches
dataclass
¶
Bases: Asset
VQSR tranches file: the VQSLOD cutoff for each truth-sensitivity level.
A companion: companion_of is the CID of the VQSRModel it was built
with.
Source code in src/stargazer/assets/variants.py
Variants
dataclass
¶
Config¶
Centralized configuration for Stargazer.¶
Sets environment variable defaults at import time. Consumers read os.environ directly rather than importing named values from this module.
Also the source of truth for the lean per-task Flyte environments
(scrna_env, gatk_env).
init_flyte() is the one Flyte init for notebooks, the MCP server and the
tests: an in-cluster client in a hosted notebook pod, the config file anywhere
else.
Rules:
- PINATA_JWT: No default — absence means no public tier (Pinata) at all.
- PINATA_GATEWAY: IPFS gateway for public downloads. Defaults to the project's
dedicated Pinata gateway.
- STARGAZER_LOCAL: Scratch space for task outputs and the download cache.
Defaults to ~/.stargazer/local.
- STARGAZER_STORE_ROOT: Where asset bytes are stored — a local directory or a
bucket URI (e.g. s3://stargazerbio-users). Defaults
to ~/.stargazer/store.
- STARGAZER_INDEX_URL: The asset index — a SQLite file path, a
postgresql:// URL (the devbox's), or a dsql:// URL naming a user's
table on Aurora DSQL (Union's). Defaults to ~/.stargazer/index.db.
- STARGAZER_OWNER: The Union subject that owns new assets (their folder in
the store, and _owner). Unset locally.
- STARGAZER_API_KEY_SECRET: The Flyte secret holding the project's API key.
When it's set, every environment declares that secret, as the variable
Flyte's in-cluster client reads its key from, so a pod can call the cluster
as its project. Union needs one; a cluster without a login (the devbox), or
a local run, leaves it unset. Forwarded into every pod.
Where images are pushed is Flyte's own setting, FLYTE_IMAGE_REGISTRY. Flyte
fixes an image's registry when the image is defined, so the environments here
take it at import, not from the config a later init reads.
spec: docs/architecture/configuration.md
init_flyte()
¶
Initialize Flyte wherever Stargazer runs.
A hosted notebook pod (_U_EP_OVERRIDE set) has no config file, but it
carries the endpoint, an API key and the owner's org, project and domain,
which make an in-cluster client for the owner's project. Its runs bundle
code from the directory holding the stargazer package, where the SDK and
the image-baked notebooks' tasks live. Anywhere else the config file
decides, as flyte.init_from_config() does: with none, runs stay in the
caller's own process.
Source code in src/stargazer/config.py
log_execution()
¶
Start a per-execution log sink and return the execution ID.
Derives the workflow name from the calling function, fetches the current git commit hash, and creates a dedicated logfile for this execution. Warns if the git tree has uncommitted changes.
Source code in src/stargazer/config.py
Marshal¶
Output marshaling: typed object → dict (for MCP response serialization).¶
spec: docs/architecture/mcp-server.md
marshal_output(value)
¶
Convert a typed Python object to a JSON-friendly structure for MCP transport.
Source code in src/stargazer/marshal.py
Notebooks¶
Basic template — barebones notebook skeleton.¶
A choose-your-own-adventure scaffold for authoring your own notebook from
scratch: pick the image it runs on, ingest a file, define an asset for it,
process it with a task, and fan that task out in a workflow. Each section is
a TODO-style template — pair with assets.py and tasks.py for the why and
the deeper patterns.
spec: docs/architecture/notebook.md
MyAsset
dataclass
¶
_(dispatch, my_asset, where)
async
¶
Run the workflow on your uploaded asset.
Source code in src/stargazer/notebooks/templates/basic.py
my_task(asset)
async
¶
TODO: do work on the asset's file and return a (new) asset.
Source code in src/stargazer/notebooks/templates/basic.py
my_workflow(assets)
async
¶
TODO: orchestrate. Default = fan my_task out across inputs.
Blank workspace notebook.¶
An empty marimo notebook for authoring from scratch. /workspace/create
copies this seed under your chosen name and declares it as main_name in the
setup block. Edit main_env there to rightsize the pod for your workload.
Stargazer asset and types system tutorial.¶
A guided walkthrough of why typed Asset subclasses exist, the three
layers each Asset has (cid, path, fields), defining a new asset class,
and the round-trip from Python object to storage and back.
SampleSheet is exported for the later tutorials.
spec: docs/architecture/types.md
SampleSheet
dataclass
¶
Bases: Asset
CSV of per-sample metadata for a cohort.
Source code in src/stargazer/notebooks/tutorials/assets.py
_()
¶
Section 8 — recap.
Source code in src/stargazer/notebooks/tutorials/assets.py
Stargazer execution tutorial.¶
Assumes the asset/task/workflow primitives from the earlier tutorials and
spends them on the headline lesson: running a workflow first locally,
then on a remote cluster with no code changes. It imports the very same
audit_cohorts workflow composed in workflows.py and runs it both ways,
charting the result, then hands the choice to the run_location() control.
spec: docs/architecture/workflows.md
_(audit_cohorts, dispatch, mo, sheets, summaries_local, where)
async
¶
Run audit_cohorts wherever the control says.
Source code in src/stargazer/notebooks/tutorials/execution.py
Stargazer tasks tutorial.¶
Imports the SampleSheet asset from the assets tutorial and walks
through defining a single Flyte task that consumes it and where task
environments live. Running the task — locally and remotely — is saved
for the execution tutorial; composing it into a workflow is the one
before that.
CohortSummary, tutorial_env, and summarize_cohort are exported for the
later tutorials.
spec: docs/architecture/tasks.md
CohortSummary
dataclass
¶
Bases: Asset
JSON summary of a cohort: per-organism counts and totals.
Source code in src/stargazer/notebooks/tutorials/tasks.py
_()
¶
Recap.
Source code in src/stargazer/notebooks/tutorials/tasks.py
summarize_cohort(sheet)
async
¶
Count samples and unique organisms in a cohort sample sheet.
Source code in src/stargazer/notebooks/tutorials/tasks.py
Stargazer workflows tutorial.¶
Imports the summarize_cohort task from the tasks tutorial and composes
it into a fan-out workflow. In Flyte v2 a workflow is just a task that
calls other tasks, so fan-out is plain asyncio.gather over task calls.
audit_cohorts is exported for the Execution tutorial.
spec: docs/architecture/workflows.md
_()
¶
Recap and next.
Source code in src/stargazer/notebooks/tutorials/workflows.py
audit_cohorts(sheets)
async
¶
Summarize many cohorts in parallel and return all results.
Source code in src/stargazer/notebooks/tutorials/workflows.py
make_demo_sheets()
async
¶
Build and upload three small cohort SampleSheet assets.
Reusable so the Execution tutorial imports the exact same inputs instead of rebuilding them.
Source code in src/stargazer/notebooks/tutorials/workflows.py
Notebook controls for choosing where a run goes.¶
run_location() is a control a notebook drops into a cell, set to "On this
machine" or "On the cluster", and dispatch() runs a task or workflow wherever
it's set. Reading a control's value in the cell that made it is an error in
marimo, so the control and the dispatch go in separate cells, and changing the
control re-runs the dispatching cell:
where = run_location()
where
summaries = await dispatch(where, audit_cohorts, sheets=sheets)
A cluster run's code bundle comes from where the dispatched task's module was
imported from: the notebook's own directory when the notebook defining it is the
one running, as a workspace notebook in its pod is, or the package root for one
imported by its dotted name. The task has to be importable there, which a task
defined in a regular cell isn't: it goes in an @app.function.
A module of its own rather than part of the package __init__, because it
imports marimo and the dashboard imports stargazer.notebooks without it.
spec: docs/architecture/notebook.md
dispatch(location, task, /, **inputs)
async
¶
Run task with inputs where location says, and return its output.
Waits for the run to finish either way, so the result is the value awaiting
the task directly would give. Handles tasks with one output. "On the
cluster" asks for a remote run outright: flyte.run would quietly run
in-process when no cluster is configured. It bundles the run's code from
task's own root (_bundle_root), and returns the output as the type
task declares.
Source code in src/stargazer/notebooks/ui.py
run_location()
¶
The control for where a notebook's runs go, starting on this machine.
Its value is the Flyte run mode the choice stands for, which is what
dispatch passes on.
Source code in src/stargazer/notebooks/ui.py
Stargazer scRNA-seq.¶
Multi-sample fan-out preprocessing plus interactive clustering, side-by-side UMAPs, and marker-gene tables. The workflow-tier showcase: the same primitives the tutorials teach, applied as a full-fat scRNA-seq pipeline.
spec: docs/architecture/notebook.md
_()
¶
Links to the tutorial sequence.
Source code in src/stargazer/notebooks/workflows/scrna_pipeline.py
cluster_and_annotate(reduced, resolution)
async
¶
Leiden clustering followed by marker gene identification.
Source code in src/stargazer/notebooks/workflows/scrna_pipeline.py
preprocess(raw, max_pct_mt, n_top_genes)
async
¶
QC, normalize, select HVGs, and reduce dimensions for one sample.
Source code in src/stargazer/notebooks/workflows/scrna_pipeline.py
Registry¶
Task registry for auto-discovery of Flyte tasks and workflows.¶
Discovers the tasks exported by stargazer.tasks and the workflows exported
by stargazer.workflows (their __all__), and extracts parameter types,
defaults, and return types for the MCP catalog. A task a package doesn't
export isn't discovered.
spec: docs/architecture/mcp-server.md
TaskInfo
dataclass
¶
Complete metadata about a registered task.
Source code in src/stargazer/registry.py
TaskOutput
dataclass
¶
TaskParam
dataclass
¶
TaskRegistry
dataclass
¶
Discovers and provides access to all Flyte tasks and workflows.
Source code in src/stargazer/registry.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
__post_init__()
¶
Discover all tasks and workflows on initialization.
get(name)
¶
list_tasks(category=None)
¶
List all registered tasks, optionally filtered by category.
Source code in src/stargazer/registry.py
to_catalog(category=None)
¶
Return a JSON-serializable catalog of all tasks.
Source code in src/stargazer/registry.py
Server¶
Stargazer MCP Server.¶
Exposes storage tools and a dynamic task runner via the MCP SDK's
high-level MCPServer.
Tasks and workflows are auto-discovered from the registry and executed
with flyte.run: remotely when init_flyte() finds an endpoint in
.flyte/config.yaml, in-process otherwise.
Usage
stargazer # stdio transport (default) stargazer --http # streamable-http transport
spec: docs/architecture/mcp-server.md
delete_file(cid)
async
¶
download_file(cid)
async
¶
Download a file by CID to local cache. Returns the local path.
A CID that isn't in your index is treated as public and fetched from the IPFS gateway.
Source code in src/stargazer/server.py
fetch_resource_bundle(bundle_name)
async
¶
Download a predefined resource bundle into local storage.
Bundles are curated sets of public files (e.g. reference genomes, demo datasets) defined in the codebase. Each file is downloaded by CID from the public IPFS gateway and recorded in the user's index with the manifest's keyvalues, so assemble() and query_files find it afterwards, with or without a Pinata key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle_name
|
str
|
Name of the bundle (from list_bundles). |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of fetched files with cid, name, keyvalues, local path, and |
list[dict]
|
whether each was already cached. |
Source code in src/stargazer/server.py
list_bundles()
¶
List available resource bundles.
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of bundles with name, description, and file_count. |
list_tasks(category=None)
¶
List available tasks and workflows with their parameter signatures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str | None
|
Filter by "task" or "workflow". Omit for all. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
Catalog of tasks with name, category, description, params, and outputs. |
Source code in src/stargazer/server.py
main()
¶
publish_file(cid)
async
¶
Publish one of your stored files: anyone on the internet can then find and download it. The CID doesn't change, and your own copy stays.
Needs the public tier (a Pinata key). Refused for a CID that isn't in your storage, and for metadata over the public tier's limits (nine fields, 250 characters each), before anything is sent.
When displaying results, always show a table with the CID and all keyvalues.
Source code in src/stargazer/server.py
query_files(keyvalues)
async
¶
Query files by metadata key-value pairs. Returns matching files.
run_task(task_name, filters, inputs=None)
async
¶
Run a single task by name for ad-hoc experimentation.
Use this for testing individual tools in isolation. Asset parameters are assembled from storage using the provided filters — one call to assemble() resolves all required assets, and every filter must match each asset, so assets with different keys (a reference's build, a sample's sample_id) can't be filled from one call. Scalar and Path parameters are passed separately via inputs.
For reproducible pipeline runs, use run_workflow instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Name of the task (from list_tasks with category="task"). |
required |
filters
|
dict
|
Keyvalue filters for assemble() to resolve asset parameters (e.g. {"asset": "reference", "build": "GRCh38"}); a list value matches any of its entries. |
required |
inputs
|
dict | None
|
Optional scalar/Path keyword arguments (str, int, bool, list[str]). |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Serialized task output. Single outputs returned directly, |
dict
|
multi-outputs as {"o0": ..., "o1": ...}. |
Source code in src/stargazer/server.py
run_workflow(workflow_name, inputs)
async
¶
Run a workflow by name for reproducible pipeline execution.
Workflows accept scalar parameters (str, int, bool, list[str]) and handle their own asset assembly internally. Pass inputs exactly as the workflow signature defines them — no automatic resolution is performed.
For ad-hoc experimentation with individual tools, use run_task instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_name
|
str
|
Name of the workflow (from list_tasks with category="workflow"). |
required |
inputs
|
dict
|
Keyword arguments as a JSON dict (scalars only). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Serialized workflow output. Single outputs returned directly, |
dict
|
multi-outputs as {"o0": ..., "o1": ...}. |
Source code in src/stargazer/server.py
show_config()
async
¶
Show current Stargazer configuration and available task counts.
Source code in src/stargazer/server.py
update_file(cid, keyvalues)
async
¶
Update (merge) metadata on an existing file by CID — fix a typo'd or mis-tagged record without re-uploading the bytes (the CID is unchanged).
keyvalues is a patch onto your own index row: the supplied keys are added or overwritten, keys you omit are preserved (there is no key removal). It must include "asset"; the patch validates through the same rules as upload (registered keys check their declared fields' values and accept extra keys as text; reserved underscore keys like _owner are stamped automatically and must not be supplied).
When displaying results, always show a table with the CID and all keyvalues.
Source code in src/stargazer/server.py
upload_file(path, keyvalues)
async
¶
Upload a file with metadata key-value pairs.
keyvalues must include "asset". Registered asset keys (e.g. asset=reference) check their declared fields' values, and keep any other key you supply (e.g. lane=3) as an extra text field on the typed asset, so tasks that take that type can still use the file. Unregistered keys are stored as generic assets with the keyvalues verbatim. Reserved system keys (underscore-prefixed, e.g. _owner) are stamped automatically and must not be supplied.
When displaying results, always show a table with the CID and all keyvalues.
Source code in src/stargazer/server.py
Tasks¶
apply_bqsr task for Stargazer.¶
Applies BQSR recalibration to BAM files using GATK ApplyBQSR.
spec: docs/architecture/tasks.md
apply_bqsr(alignment, ref, bqsr_report)
async
¶
Apply Base Quality Score Recalibration to a BAM file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
Alignment
|
Input BAM asset |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
bqsr_report
|
BQSRReport
|
Recalibration table from base_recalibrator |
required |
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset with recalibrated BAM file; its index is stored as an |
Alignment
|
AlignmentIndex |
Source code in src/stargazer/tasks/gatk/apply_bqsr.py
ApplyVQSR task for Stargazer.¶
Applies VQSR recalibration to a VCF using GATK ApplyVQSR.
spec: docs/architecture/tasks.md
apply_vqsr(vcf, ref, vqsr_model, truth_sensitivity_filter_level=None)
async
¶
Apply VQSR recalibration to a VCF using GATK ApplyVQSR.
The recalibration mode (SNP or INDEL) is read from vqsr_model.mode.
The recal file's index and the tranches file are the model's stored
companions. If truth_sensitivity_filter_level is not provided, defaults
to 99.5 for SNP and 99.0 for INDEL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vcf
|
Variants
|
Raw (or SNP-filtered) VCF Variants asset |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
vqsr_model
|
VQSRModel
|
Recalibration model from variant_recalibrator |
required |
truth_sensitivity_filter_level
|
float | None
|
VQSLOD filter threshold (optional) |
None
|
Returns:
| Type | Description |
|---|---|
Variants
|
Variants asset with VQSR-filtered VCF |
Source code in src/stargazer/tasks/gatk/apply_vqsr.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
base_recalibrator task for Stargazer.¶
Creates BQSR recalibration table using GATK BaseRecalibrator.
spec: docs/architecture/tasks.md
base_recalibrator(alignment, ref, known_sites)
async
¶
Generate a Base Quality Score Recalibration report.
Uses GATK BaseRecalibrator to analyze patterns of covariation in the sequence dataset and produce a recalibration table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
Alignment
|
Input BAM asset (should be sorted and have duplicates marked) |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
known_sites
|
list[KnownSites]
|
List of KnownSites VCF assets (dbSNP, known indels, etc.) |
required |
Returns:
| Type | Description |
|---|---|
BQSRReport
|
BQSRReport asset containing the recalibration table |
Source code in src/stargazer/tasks/gatk/base_recalibrator.py
CombineGVCFs task for Stargazer.¶
Combines multiple per-sample GVCFs into a single multi-sample GVCF for joint genotyping using GATK CombineGVCFs.
spec: docs/architecture/tasks.md
combine_gvcfs(gvcfs, ref, cohort_id='cohort')
async
¶
Combine multiple per-sample GVCFs into a single multi-sample GVCF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gvcfs
|
list[Variants]
|
List of Variants assets, each containing a GVCF from a single sample |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
cohort_id
|
str
|
Identifier for the combined cohort (default: "cohort") |
'cohort'
|
Returns:
| Type | Description |
|---|---|
Variants
|
Variants asset with combined multi-sample GVCF |
Source code in src/stargazer/tasks/gatk/combine_gvcfs.py
GATK CreateSequenceDictionary task for reference genome.¶
spec: docs/architecture/tasks.md
create_sequence_dictionary(ref)
async
¶
Create a sequence dictionary (.dict file) using GATK CreateSequenceDictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
Returns:
| Type | Description |
|---|---|
SequenceDict
|
SequenceDict asset containing the .dict file |
Source code in src/stargazer/tasks/gatk/create_sequence_dictionary.py
haplotype_caller task for Stargazer.¶
Calls germline SNPs and indels via local re-assembly of haplotypes using GATK HaplotypeCaller in GVCF mode.
spec: docs/architecture/tasks.md
haplotype_caller(alignment, ref)
async
¶
Call germline variants in GVCF mode using GATK HaplotypeCaller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
Alignment
|
Sorted, duplicate-marked BAM asset (BQSR-recalibrated recommended) |
required |
ref
|
Reference
|
Reference FASTA asset with sequence dictionary |
required |
Returns:
| Type | Description |
|---|---|
Variants
|
Variants asset containing the per-sample GVCF |
Source code in src/stargazer/tasks/gatk/haplotype_caller.py
GATK IndexFeatureFile task for indexing VCF files.¶
spec: docs/architecture/tasks.md
index_feature_file(known_sites)
async
¶
Index a VCF file using GATK IndexFeatureFile.
Required by tools like BaseRecalibrator that need random-access queries over known sites VCFs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_sites
|
KnownSites
|
KnownSites VCF asset to index |
required |
Returns:
| Type | Description |
|---|---|
KnownSitesIndex
|
KnownSitesIndex asset pointing to the generated .idx file |
Source code in src/stargazer/tasks/gatk/index_feature_file.py
joint_call_gvcfs task for Stargazer.¶
Consolidates per-sample GVCFs into a GenomicsDB datastore and performs joint genotyping in a single task, avoiding the need to persist the GenomicsDB workspace between tasks.
spec: docs/architecture/tasks.md
joint_call_gvcfs(gvcfs, ref, intervals=None, cohort_id='cohort')
async
¶
Consolidate GVCFs into GenomicsDB and joint-genotype in a single task.
Runs GenomicsDBImport followed immediately by GenotypeGVCFs within the same execution context, so the workspace never needs to leave the pod.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gvcfs
|
list[Variants]
|
Per-sample GVCF Variants assets from HaplotypeCaller |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
intervals
|
list[str] | None
|
Genomic intervals to process (GenomicsDBImport needs at least one); defaults to every contig in the reference |
None
|
cohort_id
|
str
|
Sample ID label for the output VCF (default: "cohort") |
'cohort'
|
Returns:
| Type | Description |
|---|---|
Variants
|
Joint-genotyped Variants asset (VCF) |
Source code in src/stargazer/tasks/gatk/joint_call_gvcfs.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
mark_duplicates task for Stargazer.¶
Marks duplicate reads in BAM files using GATK MarkDuplicates.
spec: docs/architecture/tasks.md
mark_duplicates(alignment)
async
¶
Mark duplicate reads in a BAM file.
Uses GATK MarkDuplicates to identify and tag duplicate reads that originated from the same DNA fragment (PCR or optical duplicates). Duplicates are marked with the 0x0400 SAM flag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
Alignment
|
Input BAM asset (should be coordinate sorted) |
required |
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset with duplicates marked |
Source code in src/stargazer/tasks/gatk/mark_duplicates.py
merge_bam_alignment task for Stargazer.¶
Merges aligned BAM with unmapped BAM using GATK MergeBamAlignment.
spec: docs/architecture/tasks.md
merge_bam_alignment(aligned_bam, unmapped_bam, ref)
async
¶
Merge alignment data from aligned BAM with data in unmapped BAM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aligned_bam
|
Alignment
|
Aligned BAM asset from aligner |
required |
unmapped_bam
|
Alignment
|
Original unmapped BAM asset (must be queryname sorted) |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset with merged BAM file |
Source code in src/stargazer/tasks/gatk/merge_bam_alignment.py
sort_sam task for Stargazer.¶
Sorts BAM files using GATK SortSam.
spec: docs/architecture/tasks.md
sort_sam(alignment, sort_order='coordinate')
async
¶
Sort a SAM/BAM file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
Alignment
|
Input BAM asset to sort |
required |
sort_order
|
str
|
Sort order - one of "coordinate", "queryname", "duplicate" |
'coordinate'
|
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset with sorted BAM file |
Source code in src/stargazer/tasks/gatk/sort_sam.py
VariantRecalibrator task for Stargazer.¶
Builds a recalibration model for VQSR using GATK VariantRecalibrator.
spec: docs/architecture/tasks.md
variant_recalibrator(vcf, ref, resources, mode='SNP')
async
¶
Build a VQSR recalibration model using GATK VariantRecalibrator.
Each KnownSites in resources sets these fields:
resource_name: e.g. "hapmap", "omni", "1000G", "dbsnp", "mills"
known: "true" or "false"
training: "true" or "false"
truth: "true" or "false"
prior: numeric string, e.g. "15"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vcf
|
Variants
|
Raw genotyped VCF Variants asset |
required |
ref
|
Reference
|
Reference FASTA asset |
required |
resources
|
list[KnownSites]
|
Training/truth VCF resources for the recalibrator |
required |
mode
|
str
|
Variant type to recalibrate — "SNP" or "INDEL" |
'SNP'
|
Returns:
| Type | Description |
|---|---|
VQSRModel
|
VQSRModel asset (the recal file). Its index and the tranches file |
VQSRModel
|
are stored as its companions, so |
Source code in src/stargazer/tasks/gatk/variant_recalibrator.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
BWA tasks for reference genome indexing and alignment.¶
spec: docs/architecture/tasks.md
bwa_index(ref)
async
¶
Create BWA index files for a reference genome using bwa index.
Creates the following index files: - .amb, .ann, .bwt, .pac, .sa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
Returns:
| Type | Description |
|---|---|
list[AlignerIndex]
|
List of AlignerIndex assets, one per index file |
Source code in src/stargazer/tasks/general/bwa.py
bwa_mem(ref, r1, r2=None, read_group=None)
async
¶
Align FASTQ reads to reference genome using BWA-MEM.
Produces an unsorted BAM file that typically needs to be sorted before downstream processing (e.g., with sort_sam).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
r1
|
R1
|
R1 FASTQ read asset |
required |
r2
|
R2 | None
|
R2 FASTQ read asset (None for single-end) |
None
|
read_group
|
dict[str, str] | None
|
Optional read group override (ID, SM, LB, PL, PU) |
None
|
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset containing the unsorted BAM file |
Source code in src/stargazer/tasks/general/bwa.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
BWA-MEM2 tasks for reference genome indexing and alignment.¶
spec: docs/architecture/tasks.md
bwa_mem2_index(ref)
async
¶
Create BWA-MEM2 index files for a reference genome.
Creates the following index files: - .amb, .ann, .bwt.2bit.64, .pac, .sa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
Returns:
| Type | Description |
|---|---|
list[AlignerIndex]
|
List of AlignerIndex assets, one per index file |
Reference
Source code in src/stargazer/tasks/general/bwa_mem2.py
bwa_mem2_mem(ref, r1, r2=None, read_group=None)
async
¶
Align FASTQ reads to reference genome using BWA-MEM2.
Produces an unsorted BAM file that typically needs to be sorted before downstream processing (e.g., with sort_sam).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
r1
|
R1
|
R1 FASTQ read asset |
required |
r2
|
R2 | None
|
R2 FASTQ read asset (None for single-end) |
None
|
read_group
|
dict[str, str] | None
|
Optional read group override (ID, SM, LB, PL, PU) |
None
|
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset containing the unsorted BAM file |
Reference
Source code in src/stargazer/tasks/general/bwa_mem2.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
Samtools tasks for reference genome indexing.¶
spec: docs/architecture/tasks.md
samtools_faidx(ref)
async
¶
Create a FASTA index (.fai file) using samtools faidx.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
Reference
|
Reference FASTA asset |
required |
Returns:
| Type | Description |
|---|---|
ReferenceIndex
|
ReferenceIndex asset containing the .fai file |
Source code in src/stargazer/tasks/general/samtools.py
Leiden community detection clustering for scRNA-seq data.¶
spec: docs/architecture/tasks.md
cluster(adata, resolution=0.5, key_added='leiden')
async
¶
Assign cells to clusters using the Leiden algorithm.
Requires a precomputed neighbor graph (.uns["neighbors"]). Cluster labels are stored in .obs[key_added].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
AnnData asset with neighbor graph |
required |
resolution
|
float
|
Leiden resolution parameter (higher = more clusters) |
0.5
|
key_added
|
str
|
.obs column name to store cluster labels |
'leiden'
|
Returns:
| Type | Description |
|---|---|
AnnData
|
AnnData asset with cluster labels in .obs |
Source code in src/stargazer/tasks/scrna/cluster.py
Marker gene identification via differential expression for scRNA-seq data.¶
spec: docs/architecture/tasks.md
find_markers(adata, groupby='leiden', method='wilcoxon')
async
¶
Identify marker genes for each cluster using differential expression.
Tests the log-normalized expression in .X, which scanpy's fold changes assume; the raw counts in .layers["counts"] would skew them. Results are stored in .uns["rank_genes_groups"].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Clustered AnnData asset with log-normalized .X |
required |
groupby
|
str
|
.obs column to group cells by (cluster labels) |
'leiden'
|
method
|
str
|
Statistical test method ("wilcoxon", "t-test", etc.) |
'wilcoxon'
|
Returns:
| Type | Description |
|---|---|
AnnData
|
AnnData asset with ranked marker genes in .uns["rank_genes_groups"] |
Source code in src/stargazer/tasks/scrna/find_markers.py
Normalization and log transformation for scRNA-seq data.¶
spec: docs/architecture/tasks.md
normalize(adata)
async
¶
Normalize counts and apply log1p transformation.
Stores raw counts in .layers["counts"] before normalization so they are available for downstream differential expression analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
QC-filtered AnnData asset |
required |
Returns:
| Type | Description |
|---|---|
AnnData
|
Normalized and log-transformed AnnData asset |
Source code in src/stargazer/tasks/scrna/normalize.py
Quality control and cell/gene filtering for scRNA-seq data.¶
spec: docs/architecture/tasks.md
qc_filter(adata, min_genes=100, min_cells=3, max_pct_mt=20.0, batch_key='')
async
¶
Filter low-quality cells and genes from raw scRNA-seq data.
Applies standard QC filters: minimum gene/cell thresholds, mitochondrial
gene percentage, and scrublet doublet detection. The mitochondrial,
ribosomal and hemoglobin genes are picked by the input asset's
organism ("human" or "mouse", any case).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Raw AnnData asset (.h5ad) |
required |
min_genes
|
int
|
Minimum number of genes expressed per cell |
100
|
min_cells
|
int
|
Minimum number of cells a gene must be expressed in |
3
|
max_pct_mt
|
float
|
Maximum mitochondrial gene percentage allowed per cell |
20.0
|
batch_key
|
str
|
Column in .obs to use as batch for scrublet (empty = no batch) |
''
|
Returns:
| Type | Description |
|---|---|
AnnData
|
Filtered AnnData asset with QC metrics in .obs |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the asset's |
Source code in src/stargazer/tasks/scrna/qc_filter.py
PCA, neighbor graph, and UMAP dimensionality reduction for scRNA-seq data.¶
spec: docs/architecture/tasks.md
reduce_dimensions(adata, n_pcs=50, n_neighbors=15)
async
¶
Compute PCA, k-nearest neighbor graph, and UMAP embedding.
Operates on the highly variable gene subset to reduce noise. Embeddings are stored in .obsm for downstream clustering and visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
AnnData asset with HVG annotations in .var |
required |
n_pcs
|
int
|
Number of principal components to compute |
50
|
n_neighbors
|
int
|
Number of neighbors for the kNN graph |
15
|
Returns:
| Type | Description |
|---|---|
AnnData
|
AnnData asset with PCA (.obsm["X_pca"]), neighbors, and UMAP (.obsm["X_umap"]) |
Source code in src/stargazer/tasks/scrna/reduce_dimensions.py
Highly variable gene selection for scRNA-seq data.¶
spec: docs/architecture/tasks.md
select_features(adata, n_top_genes=2000, batch_key='')
async
¶
Select highly variable genes for dimensionality reduction.
Annotates .var with highly_variable flags. Downstream tasks use only the highly variable subset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Normalized AnnData asset |
required |
n_top_genes
|
int
|
Number of top highly variable genes to select |
2000
|
batch_key
|
str
|
Column in .obs to use as batch (empty = no batch correction) |
''
|
Returns:
| Type | Description |
|---|---|
AnnData
|
AnnData asset with HVG annotations in .var |
Source code in src/stargazer/tasks/scrna/select_features.py
Utils¶
IPFS CIDs computed locally.¶
An asset's identity is the CID Pinata would assign it, worked out without
uploading anything. compute_cid() builds the same UnixFS DAG Pinata builds:
CIDv1, raw leaves, 256 KiB chunks, a balanced tree of at most 174 links per
node, sha2-256 throughout. A file that fits in one chunk is its own raw leaf
(bafkrei…); anything larger gets a dag-pb root (bafybei…).
CidBuilder works it out from bytes as they arrive, in pieces of any size,
and compute_cid() is the builder fed a file.
Those parameters are part of every asset's identity. If Pinata changed its defaults, a newly published file's CID would stop matching the one computed here.
spec: docs/architecture/types.md
CidBuilder
¶
Works out a file's CID from its bytes, fed in pieces of any size.
Each full leaf is hashed as soon as its bytes are in, so the state is the
leaves' CIDs and sizes plus at most one partial leaf: a few megabytes for
a 10 GB file. The tree over the leaves is built when cid() is asked.
Source code in src/stargazer/utils/cid.py
__init__()
¶
cid()
¶
The CID of everything fed so far.
Returns:
| Type | Description |
|---|---|
str
|
The CIDv1 in base32 ( |
Source code in src/stargazer/utils/cid.py
update(data)
¶
Take the next piece of the file.
Source code in src/stargazer/utils/cid.py
compute_cid(path)
¶
Return the IPFS CID Pinata assigns path, reading it once in chunks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The file to hash |
required |
Returns:
| Type | Description |
|---|---|
str
|
The CIDv1 in base32 ( |
Source code in src/stargazer/utils/cid.py
The asset index: SQLite, Postgres or Aurora DSQL.¶
The metadata half of asset storage: one row per asset, keyed by its CID, with
where the bytes live (uri), the original filename, and the asset's
keyvalues as a JSON object. query() matches every filter key exactly; a
list value matches any of its entries, in one query. make_index opens the
index a STARGAZER_INDEX_URL names.
Locally, SqliteIndex is the index itself. On the devbox it's a Postgres
server that the dashboard and every pod reach through PostgresIndex. On
Union it's the user's DsqlIndex table, which their dashboard and every pod
in their project reach directly. Beside each index table is a state table
(state_table_name) for the dashboard's own per-user state.
spec: docs/architecture/types.md
DsqlIndex
¶
Bases: PostgresIndex
A user's asset index table on Aurora DSQL, reached as their own login.
The URL names the cluster endpoint, the user's database role, their
table and the IAM role mapped to that database role:
dsql://u_jane@<id>.dsql.us-west-2.on.aws/assets.u_jane?role_arn=<arn>.
The index and state tables, the database role and the IAM role are made
by onboarding; the database role can't create anything, so this never
runs DDL. The cluster's admin needs no role_arn: it signs with the
caller's own AWS credentials (the dsql test tier connects that way).
Each call connects afresh, so DSQL ending a connection after an hour never reaches a caller. The IAM role's credentials and the auth token are cached for the process; the token is signed locally, so the only remote calls per connection are STS when the credentials near expiry and the connection itself.
Usage
index = DsqlIndex(os.environ["STARGAZER_INDEX_URL"]) rows = await index.query({"companion_of": cid})
Source code in src/stargazer/utils/index.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | |
__init__(url)
¶
Read the cluster, login, table and IAM role from url; no connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
A |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
when |
Source code in src/stargazer/utils/index.py
PostgresIndex
¶
Bases: SqlIndex
Asset metadata index in a Postgres database, keyvalues as jsonb.
Each call opens its own connection, so concurrent writers are serialized by Postgres's row locks rather than a lock here. A write refused with a serialization failure is rerun whole, with jittered backoff.
Usage
index = PostgresIndex("postgresql://user:pass@host:5432/db") rows = await index.query({"companion_of": cid})
Source code in src/stargazer/utils/index.py
__init__(url, table='assets')
¶
Connect to url and create the index and state tables if they're missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
A |
required |
table
|
str
|
The table, schema-qualified if it isn't in the search path |
'assets'
|
Source code in src/stargazer/utils/index.py
read(sql, params)
¶
write(work)
¶
Run work in one transaction on a new connection, rerun on conflict.
DSQL refuses a write that conflicts with a concurrent one instead of making it wait, and Postgres does the same under serializable isolation, both with SQLSTATE 40001, at a statement or at commit.
Source code in src/stargazer/utils/index.py
SqlIndex
¶
The index's five calls, written once in SQL that SQLite and Postgres share.
Subclasses give what the engines spell differently: the JSON column type,
one keyvalue's lookup and the merge (each with a ? parameter), and how
statements run, and set table. Statements use ? placeholders
throughout. write and read are public so the dashboard can keep its
own rows in state_table, the table beside table. Writes are
acknowledged only after they commit, so a downstream task always sees its
upstream task's rows, and a merge is one statement, so concurrent merges
each land.
Source code in src/stargazer/utils/index.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
state_table
property
¶
The dashboard's per-user state table, beside the index table.
delete(cid)
async
¶
get(cid)
async
¶
One row by CID, or None.
merge(cid, patch)
async
¶
Merge keyvalues onto a row: supplied keys are set, others kept.
Raises:
| Type | Description |
|---|---|
ValueError
|
when no row exists for |
Source code in src/stargazer/utils/index.py
query(filters)
async
¶
Rows matching every filter, newest first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
dict
|
Keyvalue filters; a list value matches any of its entries |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
Matching rows: |
Source code in src/stargazer/utils/index.py
read(sql, params)
¶
upsert(record)
async
¶
Insert a row, or replace an existing row's uri, name and keyvalues.
A different set of keyvalues for an existing CID logs a WARNING naming
the keys that changed. created_at keeps its first value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
dict
|
|
required |
Returns:
| Type | Description |
|---|---|
dict
|
The stored row |
Source code in src/stargazer/utils/index.py
SqliteIndex
¶
Bases: SqlIndex
Asset metadata index in one SQLite file.
Writes go through one connection behind a threading.Lock, taken inside
the worker thread rather than an asyncio.Lock so one index can serve
callers on different event loops; WAL mode lets reads run alongside a
write.
Usage
index = SqliteIndex(Path("~/.stargazer/index.db").expanduser()) await index.upsert({"cid": cid, "uri": uri, "name": name, "keyvalues": kv}) rows = await index.query({"asset": "alignment", "sample_id": ["S1", "S2"]})
Source code in src/stargazer/utils/index.py
__init__(path)
¶
Open (or create) the index at path, in WAL mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The SQLite file; its parent directory is created if missing |
required |
Source code in src/stargazer/utils/index.py
read(sql, params)
¶
Run a read on its own connection (WAL readers never wait on the writer).
Source code in src/stargazer/utils/index.py
write(work)
¶
Run work on the one writer connection, under the write lock.
Source code in src/stargazer/utils/index.py
make_index(url)
¶
The index named by STARGAZER_INDEX_URL.
A postgresql:// (or postgres://) URL is a Postgres database; a
dsql:// URL is a user's table on Aurora DSQL (see DsqlIndex);
anything else is a SQLite file path (a sqlite:// prefix is accepted and
stripped, ~ is expanded).
Source code in src/stargazer/utils/index.py
postgres_table_sql(table)
¶
CREATE TABLE IF NOT EXISTS for an index table on Postgres or DSQL.
state_table_name(table)
¶
state_table_sql(table)
¶
CREATE TABLE IF NOT EXISTS for the state table beside index table table.
Pinata API v3 client for IPFS file storage.¶
Provides async interface for authenticated Pinata operations: - Uploading files with keyvalue metadata - Querying files by keyvalue pairs - Updating metadata and deleting files - Resumable (TUS) uploads, chunk by chunk, for a caller relaying a file
Stargazer uses Pinata's public network only: shared data lives there,
readable by everyone and attributed by _owner. Every public write needs an
_owner, and reads skip a file without one. Private data lives in each
user's own store (stargazer.utils.storage), never on Pinata's private
network.
spec: docs/architecture/configuration.md
PinataClient
¶
Async client for Pinata API v3, on Pinata's public network (NETWORK).
Uploads (plain or TUS), keyvalue queries, metadata updates and deletes.
A pure remote transport: caching and gateway downloads are the storage
client's job (stargazer.utils.storage).
Usage
client = PinataClient() comp = Asset(keyvalues={"asset": "alignment", "sample_id": "NA12878"}) await client.upload(comp, Path("data.bam")) # sets comp.cid files = await client.query({"asset": "alignment", "sample_id": "NA12878"}) await client.delete(comp)
Source code in src/stargazer/utils/pinata.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
jwt
property
¶
Get JWT token, raising error if not set.
__init__(jwt=None)
¶
Initialize Pinata client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jwt
|
str | None
|
Pinata JWT token (defaults to PINATA_JWT from config) |
None
|
delete(component)
async
¶
Delete a file from Pinata by querying for its internal ID first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Asset
|
Asset with cid set |
required |
Source code in src/stargazer/utils/pinata.py
get(cid)
async
¶
The public network's owned record for cid, or None if it has none.
Returns:
| Type | Description |
|---|---|
dict | None
|
The record (cid, name, keyvalues, network), or None |
Source code in src/stargazer/utils/pinata.py
query(keyvalues)
async
¶
Query the public network's files by keyvalue metadata.
Files with no _owner are left out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keyvalues
|
dict[str, str]
|
Metadata key-value pairs to filter by |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of matching file records with cid, name, keyvalues, and |
list[dict]
|
network |
Source code in src/stargazer/utils/pinata.py
tus_create(filename, keyvalues, length)
async
¶
Start a resumable TUS upload of length bytes on the public network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name the uploaded file will carry |
required |
keyvalues
|
dict[str, str]
|
The file's metadata, |
required |
length
|
int
|
The whole file's size in bytes |
required |
Returns:
| Type | Description |
|---|---|
str
|
The upload's URL, which each chunk is sent to ( |
Raises:
| Type | Description |
|---|---|
ValueError
|
when |
Source code in src/stargazer/utils/pinata.py
tus_patch(location, offset, chunk)
async
¶
Send one chunk of a TUS upload, at most TUS_CHUNK_BYTES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
The upload's URL, from |
required |
offset
|
int
|
Where in the file |
required |
chunk
|
bytes
|
The bytes |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The file's CID once the chunk completing it lands, else None |
Source code in src/stargazer/utils/pinata.py
update_metadata(cid, keyvalues)
async
¶
Merge keyvalues onto an existing file's metadata (Pinata PUT).
Pinata's update is a merge/upsert (verified empirically): the
supplied keys are added or overwritten, keys omitted from the patch
are preserved — there is no key removal. The file bytes and CID are
untouched (the CID is content-addressed; keyvalues live in the
account index, not the file), so existing *_cid provenance edges
pointing at this record stay valid. Pinata keys updates off the
file's id, so the id is looked up by CID first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cid
|
str
|
Content identifier of the file to update |
required |
keyvalues
|
dict[str, str]
|
Metadata patch to merge (partial — only these keys
change), |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The updated record: |
Raises:
| Type | Description |
|---|---|
ValueError
|
when the patch has no |
Source code in src/stargazer/utils/pinata.py
upload(component, path)
async
¶
Upload a local file to IPFS via Pinata as component. Sets component.cid.
Files up to TUS_THRESHOLD_BYTES go via the plain multipart POST;
larger files use the resumable TUS endpoint (chunked, no resume yet).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Asset
|
Asset whose keyvalues describe the file |
required |
path
|
Path
|
The local file to upload |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
when the stamped keyvalues have no |
Source code in src/stargazer/utils/pinata.py
Query generation utilities for Stargazer.¶
Expands list-valued filters into one exact-match query per combination, for backends that can't match a list in one query (Pinata's keyvalue filters).
spec: docs/architecture/types.md
generate_query_combinations(filters)
¶
One exact-match query per combination of the filters' list values.
Scalar filters appear in every query; an empty list matches nothing, so it yields no queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
dict[str, Any]
|
Filter dict with scalar or list values |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of query dicts representing all combinations |
Example
generate_query_combinations({"build": "GRCh38", "tool": ["faidx", "gatk"]}) [{"build": "GRCh38", "tool": "faidx"}, {"build": "GRCh38", "tool": "gatk"}]
Source code in src/stargazer/utils/query.py
Storage client.¶
Where asset bytes and metadata live, and the local cache in front of them.
- Bytes go to an object store through
flyte.storage: a local directory when run locally, the user bucket on Union, reached as the user's own role. Each file is stored once per user at<STARGAZER_STORE_ROOT>/users/<owner>/assets/<cid>/<name>, where the owner isSTARGAZER_OWNER(the Union subject) orlocal. A file uploaded in pieces, whose CID is known only at the end, stays where it was written,users/<owner>/uploads/<upload id>/<name>, and its row points there. - Metadata goes to the asset index (
stargazer.utils.index), one row per CID, written after the bytes so a row never points at a missing file. A write that doesn't land raises; nothing is retried behind the caller's back. - Public data lives on Pinata's public network. When
PINATA_JWTis set,query()merges Pinata's public records in (the user's own row wins on a shared CID), and public files download from the IPFS gateway.companions()decides which public companions join the user's own. - The cache is
<STARGAZER_LOCAL>/<cid>/<name>. Uploads seed it, downloads fill it, andAsset.fetch()hardlinks companions next to their asset. A file named by its own CID never changes; a companion linked into its asset's directory is relinked when a later fetch picks a different file of that name.
get_client() builds a client from the environment; default_client is the
lazily built process-wide instance (_LazyClient).
spec: docs/architecture/configuration.md
StorageClient
¶
Object-store bytes, an asset index, an optional public tier, a local cache.
Usage
client = get_client()
await client.upload(asset, Path("s1.bam")) # sets asset.cid and asset.path
local = await client.download(asset) #
Source code in src/stargazer/utils/storage.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
__init__(local_dir, store_root, index, public=None, gateway=None)
¶
Wire the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_dir
|
Path
|
Scratch space for task outputs and the download cache |
required |
store_root
|
str
|
Object-store root (a local directory or a bucket URI) |
required |
index
|
SqlIndex
|
The asset index |
required |
public
|
PinataClient | None
|
Pinata client for the public tier, or None for none |
None
|
gateway
|
str | None
|
IPFS gateway for public downloads (defaults to PINATA_GATEWAY) |
None
|
Source code in src/stargazer/utils/storage.py
adopt(asset, uri, cid)
async
¶
Index a file already written to the store at uri as asset.
For bytes that reached the store some other way than upload, such as
a resumable upload from the browser, whose CID was worked out as they
passed. When the user already has the CID stored, that copy and its
row stay as they are and uri is deleted. Otherwise the row points at
uri, stamped with _owner like any upload. Sets asset.cid and
asset.path either way.
Source code in src/stargazer/utils/storage.py
companions(cid)
async
¶
Records whose companion_of is cid, from the caller and the publisher.
The user's own rows come first, then public companions the caller
published (_owner is STARGAZER_OWNER), so one published earlier
and no longer in the store is fetched again. Then come public
companions from whoever published cid itself; a file nobody
published has no publisher to follow. Anyone else's are left out, so
two publishers' builds of a popular reference never mix. A name
already taken isn't taken again: of the user's own, the newest stands,
and the publisher's fills in only what the user lacks.
Returns:
| Type | Description |
|---|---|
list[dict]
|
Rows with |
Source code in src/stargazer/utils/storage.py
delete(asset)
async
¶
Remove the asset's index row and, if it's in the store, its file.
A row pointing at the IPFS gateway (a fetched bundle) has no stored file to remove. Idempotent.
Source code in src/stargazer/utils/storage.py
download(asset, directory=None)
async
¶
Make a local copy of asset and return its path.
The copy lives at <local_dir>/<cid>/<name>; with directory it is
also linked into that directory (how companions land beside their
asset), replacing a different file of the same name there. An asset
with no CID is a local file that was never stored: it is returned in
place. An asset with a CID but no file is located through the index,
or failing that the public IPFS gateway, and its path is set to
what was found.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
when the asset has neither a file nor a CID, or no CID and its local file doesn't exist |
Source code in src/stargazer/utils/storage.py
gateway_uri(cid)
¶
publish(cid)
async
¶
Put one of the user's stored assets on the public tier, same CID.
Uploads the stored file to Pinata's public network with its index
row's keyvalues; _owner is restamped from STARGAZER_OWNER, as on
any upload, and files over 100 MB go up in resumable chunks. The
user's row stays, so the asset is in both tiers, and query keeps
the row over the public duplicate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cid
|
str
|
The stored asset to publish |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The public record: |
Raises:
| Type | Description |
|---|---|
ValueError
|
with no public tier, for a CID that isn't in the user's index, for keyvalues over Pinata's limits (before anything is sent), or when Pinata assigns a different CID |
Source code in src/stargazer/utils/storage.py
query(filters)
async
¶
Records matching every filter: the user's rows, then public-only ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
dict
|
Keyvalue filters; a list value matches any of its entries |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
Rows with |
Source code in src/stargazer/utils/storage.py
staging_uri(upload_id, name)
¶
Where a file uploaded in pieces is written, before its CID is known.
update_metadata(cid, keyvalues)
async
¶
Merge a metadata patch onto the user's index row, restamping _owner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cid
|
str
|
The record to update |
required |
keyvalues
|
dict[str, str]
|
Keys to add or overwrite; others are kept |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
when the user has no row for |
Source code in src/stargazer/utils/storage.py
upload(asset, path)
async
¶
Store path as asset: bytes to the store, then the index row.
Sets asset.cid and asset.path (a File at the stored location) and
seeds the local cache. Bytes the CID's row already points at, or
already at the target path, aren't transferred again. Whatever the
store or the index raises propagates: a row that doesn't land fails
the upload.
Source code in src/stargazer/utils/storage.py
get_client()
¶
Build a storage client from the environment.
STARGAZER_STORE_ROOT, STARGAZER_INDEX_URL and STARGAZER_LOCAL pick
the store, the index and the cache; PINATA_JWT turns on the public
tier.
Source code in src/stargazer/utils/storage.py
Workflows¶
GATK Best Practices: Data Pre-processing for Variant Discovery¶
Implements: 1. Reference preparation — FASTA index, sequence dictionary, BWA-MEM2 index 2. Sample preprocessing — align, sort, mark duplicates
spec: docs/architecture/workflows.md
prepare_reference(build)
async
¶
Prepare reference genome for alignment and variant calling.
Assembles the reference FASTA from storage and creates its indices: 1. FASTA index (samtools faidx) 2. Sequence dictionary (GATK CreateSequenceDictionary) 3. BWA-MEM2 index (bwa-mem2 index)
Each is stored as a companion of the reference, so fetching the reference brings them along.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build
|
str
|
Reference genome build identifier (e.g. "GRCh38") |
required |
Returns:
| Type | Description |
|---|---|
Reference
|
Reference asset (FASTA file) |
Source code in src/stargazer/workflows/gatk_data_preprocessing.py
preprocess_sample(build, sample_id)
async
¶
Pre-process a single sample's reads for variant calling.
Assembles reference and reads from storage, then runs: 1. BWA-MEM2 alignment 2. Coordinate sort (GATK SortSam) 3. Mark duplicates (GATK MarkDuplicates)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build
|
str
|
Reference genome build identifier |
required |
sample_id
|
str
|
Sample identifier used to query reads |
required |
Returns:
| Type | Description |
|---|---|
Alignment
|
Alignment asset with the preprocessed BAM file |
Source code in src/stargazer/workflows/gatk_data_preprocessing.py
GATK Best Practices: Germline Short Variant Discovery (SNPs + Indels)¶
End-to-end GATK pipeline from raw reads to joint-genotyped variants
- prepare_reference — FASTA index, sequence dictionary, BWA-MEM2 index
- preprocess_sample — align, sort, mark duplicates (per sample, parallel)
- haplotype_caller — per-sample GVCF (parallel)
- joint_call_gvcfs — GenomicsDBImport + GenotypeGVCFs
spec: docs/architecture/workflows.md
germline_short_variant_discovery(build, sample_ids, cohort_id='cohort')
async
¶
End-to-end germline short variant discovery from raw reads.
Runs the full GATK best-practices pipeline: 1. Reference preparation (indexing) 2. Per-sample preprocessing (align, sort, mark duplicates) in parallel 3. HaplotypeCaller per sample in parallel 4. Joint genotyping (GenomicsDBImport + GenotypeGVCFs)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build
|
str
|
Reference genome build identifier (e.g. "GRCh38") |
required |
sample_ids
|
list[str]
|
List of sample identifiers to process |
required |
cohort_id
|
str
|
Identifier for the cohort output (default: "cohort") |
'cohort'
|
Returns:
| Type | Description |
|---|---|
Variants
|
Joint-genotyped Variants asset |
Source code in src/stargazer/workflows/germline_short_variant_discovery.py
scRNA-seq clustering pipeline: QC → normalization → clustering → marker genes.¶
Implements the scanpy clustering tutorial workflow as Flyte v2 tasks. Assembles a raw AnnData from storage by sample_id, then runs the full preprocessing and clustering stack.
Prerequisites
A raw .h5ad file must be uploaded to storage with asset="anndata", stage="raw" and organism set to "human" or "mouse", which picks the mitochondrial, ribosomal and hemoglobin genes QC filters on.
spec: docs/architecture/workflows.md
scrna_clustering_pipeline(sample_id, n_top_genes=2000, resolution=0.5, max_pct_mt=20.0)
async
¶
End-to-end scRNA-seq clustering pipeline.
Runs QC filtering, normalization, feature selection, dimensionality reduction, Leiden clustering, and marker gene identification in sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_id
|
str
|
Sample identifier used to look up the raw AnnData in storage |
required |
n_top_genes
|
int
|
Number of highly variable genes to select |
2000
|
resolution
|
float
|
Leiden clustering resolution (higher = more clusters) |
0.5
|
max_pct_mt
|
float
|
Maximum mitochondrial gene percentage per cell |
20.0
|
Returns:
| Type | Description |
|---|---|
AnnData
|
Annotated AnnData asset with cluster labels and ranked marker genes |