iscc.data.reads.emit_visium_reads ¶
emit_visium_reads(cell_data, grid_side=None, obs_fidelity=0.5, error_rate=0.001, seed=42, cell_subset=None, emit_fastq=False, read_length=90, transcriptome=None, outdir='visium_reads_out', count_model='dm', genome_seed=20240601, **visium_kwargs)
End-to-end mutation-aware Visium reads: spot counts -> alt/ref UMIs.
Visium reads ARE scRNA reads barcoded by SPOT instead of cell, so this reuses the scRNA
read/count seam unchanged on the spot x gene axis (observed_allele_counts / write_scrna_fastq /
SyntheticTranscriptome) — the per-"cell" barcode index simply becomes the SPATIAL barcode.
Runs the Visium assay to get the spot x gene expression count matrix (fixing UMI totals) and
the spot->cell membership it records, computes the NEW spot-level clone-mixture RNA-VAF (the
expression-weighted mixture of member cells' cell_rna_vaf; see spot_clone_mixture_vaf), then
splits each spot-gene's UMIs into alt/ref via observed_allele_counts. The SAME invariants as
scRNA hold: spot UMI totals conserved exactly (alt + ref == count), and per-base sequencing error
is the SINGLE read-error source (the molecular split is error-free, error enters only in the
FASTQ), so the FASTQ's non-reference proportion == error_rate (not doubled).
Reads (emit_fastq=True): a self-contained 10x-style paired FASTQ on a synthetic
transcriptome, R1 = a per-SPOT barcode + UMI, one read per UMI so totals are conserved.
Returns a dict: alt/ref/total/obs_vaf (spots x genes), spot_rna_vaf (true
clone-mixture), clone_frac (dominant-clone fraction per spot), dominant_clone,
n_cells, obs_fidelity, status, fastq paths and n_reads.