Skip to content
Nathaniel Seyler edited this page Jan 23, 2024 · 32 revisions

Welcome to the harissa wiki!

Useful links

CI/CD

https://packaging.python.org/en/latest/guides/using-testpypi/ https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives

https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow

Conda forge

https://conda-forge.org/docs/maintainer/adding_pkgs.html

Documentation

Numpy docstring style

Example of numpy style

https://pypi.org/project/sphinx-autodoc-typehints/

https://pypi.org/project/sphinx-pyproject/

Current Architecture

Generated with pyreverse -o png harissa from pylint package.

Classes

classes

Packages

packages

New Architecture

This diagram was made with mermaid. See mermaid diagram doc and/or Github diagram doc for more information.

classDiagram
direction TB
class NetworkParameter {
    + burst_frequency_min: np.ndarray | None   # a[0]
    + burst_frequency_max: np.ndarray | None   # a[1]
    + burst_size: np.ndarray | None            # a[2]
    + creation_rna: np.ndarray | None          # s[0]
    + creation_protein: np.ndarray | None      # s[1]
    + degradation_rna: np.ndarray | None       # d[0]
    + degradation_protein: np.ndarray | None   # d[1]
    + basal: np.ndarray | None
    + interaction: np.ndarray | None           # inter

    + check_all_specified(): bool
}

class NetworkModel {
    + NetworkParameter parameter
    + Inference inference
    + Simulation simulation
    
    + fit(ndarray data) Inference.Result
    + simulate(ndarray timepoints, ndarray | None M0, ndarray | None P0, float | None burn_in) Simulation.Result
}

class Inference {
    <<Interface>>
    + run(ndarray data)* Inference.Result
}

class `Inference.Result` {
    <<DataClass>>
    + NetworkParameter parameter
    # Other attributes 
}

class Hartree {
    + penalization_strength: float
    + tolerance: float
    + max_iteration: int
    + is_verbose: bool
    + use_numba: bool
    + run(ndarray data) Inference.Result
}

class Cardamom {
    + run(ndarray data) Inference.Result
}

class Simulation {
    <<Interface>>
    + run(initial_state: np.ndarray, time_points: np.ndarray, parameter: NetworkParameter)* Simulation.Result
}

class `Simulation.Result` {
    <<DataClass>>
    + time_points : ndarray
    + rna_levels : ndarray
    + protein_levels : ndarray
}

class BurstyPDMP {
    + thin_adapt: bool
    + is_verbose: bool
    + use_numba: bool
    + run(initial_state: np.ndarray, time_points: np.ndarray, parameter: NetworkParameter) Simulation.Result
}

class ApproxODE {
    + is_verbose : bool
    + use_numba: bool
    + run(initial_state: np.ndarray, time_points: np.ndarray, parameter: NetworkParameter) Simulation.Result
}


NetworkParameter --o `Inference.Result`
`Inference.Result` --* Inference : nested


NetworkParameter --o NetworkModel
NetworkModel o-- Inference : Calibration
NetworkModel o-- Simulation : Simulation

Inference <|.. Hartree
Inference <|.. Cardamom

Simulation <|.. BurstyPDMP
Simulation <|.. ApproxODE
`Simulation.Result` --* Simulation : nested 

Loading

Cardamom simulate_data.py

input: data_real (n_cells, n_genes_stim) int

output: { data_sim(n_cells, n_genes_stim) uint, time_points(n_cells,) float }

  1. data_bool = binarized(data_real)
  2. extract cells at t == 0.0 ==> pool of indices of cells
    • data_real[:, 0] = int(time_points[:] != 0.0)
    • data_sim[:, 0] = uint(time_points[:] != 0.0)
    • data_bool[:, 0] = uint(time_points[:] != 0.0)
  3. loop through total number of cells
  • at line i check t if time_points[i] == 0.0 then data_sim[i, 1:] = data_real[i, 1:] else draw uniformly a index i_0 from the pool
  • M0 = data_real[i_0, :] and P0 = data_bool[i_0, :]
  • data_sim[i] = np.random.poisson(simulate(time_points[i], M0, P0).rna_levels[0])
  1. after loop save data_sim