splisosm.simulation
===================

.. py:module:: splisosm.simulation

.. autoapi-nested-parse::

   Simulation utilities for generating spatial isoform count data.



Functions
---------

.. autoapisummary::

   splisosm.simulation.simulate_isoform_counts
   splisosm.simulation.simulate_isoform_counts_single_gene


Module Contents
---------------

.. py:function:: simulate_isoform_counts(n_genes = 1, grid_size = (30, 30), n_isos = 3, total_counts_expected = 100, var_sp = 0, var_nsp = 1, rho = 0.99, design_mtx = None, beta_true = None, return_params = True)

   Generate isoform-by-spot count matrix for multiple genes.

   Each gene is simulated independently. For simplicity we constrain all genes
   to have the same number of isoforms. (In fact in the current implementation all genes
   have the exact same distribution.)

   :param n_genes: Number of genes to simulate.
   :param grid_size: Shape of the spatial grid.
   :param n_isos: Number of isoforms.
   :param total_counts_expected: Expected total gene counts per spot.
   :param var_sp: Variance explained by spatial structure.
   :param var_nsp: Unstructured variance (white noise).
   :param rho: Spatial autocorrelation parameter.
   :param design_mtx: Shape (n_spots, n_factors). Design matrix for the isoform usage ratio.
   :param beta_true: Shape (n_factors, n_isoforms - 1). Factor coefficients for the design matrix.
   :param return_params: Whether to return simulation parameters.

   :returns: If `return_params` is False, returns `datadict` with ``'counts'``, ``'coords'``, ``'cov_sp'``, ``'design_mtx'``.
             If `return_params` is True, returns (`data_dict`, `params_dict`).
   :rtype: dict or tuple[dict]


.. py:function:: simulate_isoform_counts_single_gene(grid_size = (30, 30), n_isos = 3, total_counts_expected = 100, var_sp = 0, var_nsp = 1, rho = 0.99, design_mtx = None, beta_true = None, return_params = True)

   Generate isoform-by-spot count matrix for a given gene.

   Each gene is simulated independently. For simplicity we constrain all genes
   to have the same number of isoforms. (In fact in the current implementation all genes
   have the exact same distribution.)

   :param grid_size: Shape of the spatial grid.
   :param n_isos: Number of isoforms.
   :param total_counts_expected: Expected total gene counts per spot.
   :param var_sp: Variance explained by spatial structure.
   :param var_nsp: Unstructured variance (white noise).
   :param rho: Spatial autocorrelation parameter.
   :param design_mtx: Shape (n_spots, n_factors). Design matrix for the isoform usage ratio.
   :param beta_true: Shape (n_factors, n_isoforms - 1). Factor coefficients for the design matrix.
   :param return_params: Whether to return simulation parameters.

   :returns: If `return_params` is False, returns `datadict` with ``'counts'``, ``'coords'``, ``'cov_sp'``, ``'design_mtx'``.
             If `return_params` is True, returns (`data_dict`, `params_dict`).
   :rtype: dict or tuple[dict]


