Documentation Index
Fetch the complete documentation index at: https://docs.synthesize.bio/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Reference conditioning models generate expression data conditioned on a real reference sample. This allows you to “anchor” to an existing expression profile while applying perturbations or modifications. This is useful when you want to:- Simulate the effect of a perturbation on a specific sample
- Generate expression profiles that preserve the biological and technical characteristics of a reference
- Create synthetic “treated vs. control” pairs
Available Models
gem-1-bulk_reference-conditioning: Bulk RNA-seq reference conditioning modelgem-1-sc_reference-conditioning: Single-cell RNA-seq reference conditioning model
These endpoints may require 1-2 minutes of startup time if they have been scaled down. Plan accordingly for interactive use.
How It Works
Reference conditioning encodes the biological and technical characteristics from a real expression sample, then generates new expression data that:- Preserves the biological/technical latent space of the reference
- Applies any perturbation metadata you specify
- Returns synthetic expression that reflects the perturbation effect on that specific sample
Creating a Query
Reference conditioning queries require different inputs than baseline models:-
inputs: A list where each input contains:counts: The reference expression counts (a numeric vector)metadata: Perturbation-only metadata (see below)num_samples: How many samples to generate
-
conditioning: Which latent spaces to condition on (typically["biological", "technical"]) -
sampling_strategy:"mean estimation"or"sample generation"
Perturbation-Only Metadata
Unlike baseline models, reference conditioning queries only accept perturbation metadata fields:perturbation_ontology_idperturbation_typeperturbation_timeperturbation_dose
Example: Simulating a Drug Treatment
Here’s a complete example simulating a drug treatment effect on a reference sample:Example: CRISPR Knockout Simulation
Simulate the effect of knocking out a specific gene:Query Parameters
conditioning (list, optional)
Controls which latent spaces are conditioned on the reference. Default is["biological", "technical"].
When both are conditioned, the model preserves both biological identity and technical characteristics from the reference sample.
sampling_strategy (character, required)
Controls the type of prediction:- “sample generation”: Generates realistic-looking synthetic data with measurement error. (Bulk only)
- “mean estimation”: Provides stable mean estimates. (Bulk and single-cell)
fixed_total_count (logical, optional)
Controls whether to preserve the reference’s library size:FALSE(default): The output’s total count is taken from the reference expression (sum of its counts). Use this when you want the synthetic sample to preserve the reference’s library size.TRUE: Forces the model to use thetotal_countparameter value (or default) instead of the reference’s library size.
total_count (integer, optional)
Library size used when converting predicted log CPM back to raw counts. Only effective whenfixed_total_count = TRUE.
- Default: 10,000,000 for bulk; 10,000 for single-cell
deterministic_latents (logical, optional)
IfTRUE, the model uses the mean of each latent distribution (p(z|metadata) for perturbation, q(z|x) for conditioned components) instead of sampling. This produces deterministic, reproducible outputs.
- Default:
FALSE
seed (integer, optional)
Random seed for reproducibility.Valid Perturbation Metadata
| Field | Description / Format |
|---|---|
perturbation_ontology_id | Ensembl gene ID (e.g., ENSG00000141510), ChEBI ID, ChEMBL ID, or NCBI Taxonomy ID |
perturbation_type | One of: “coculture”, “compound”, “control”, “crispr”, “genetic”, “infection”, “other”, “overexpression”, “peptide or biologic”, “shrna”, “sirna” |
perturbation_time | Time since perturbation, as a number and unit separated by a space (e.g., “24 hours”, “48 hours”) |
perturbation_dose | Dose of perturbation, as a number and unit separated by a space (e.g., “10 um”, “1 mg/kg”) |
Working with Results
The result structure is similar to baseline models:Differential Expression
When conditioning on both biological and technical latents, you can directly compare the generated expression to your reference to identify perturbation effects:Important Notes
Counts Vector Length
The reference counts vector must match the model’s expected number of genes. If the length doesn’t match, the API will return a validation error. Useget_example_query() to see the expected structure and ensure your counts vector has the correct length.
Gene Order
Ensure your reference counts are in the same gene order expected by the model. The response includes agene_order field that specifies the expected order.