muxsim
a python module for generate cell / guide matrices for demultiplex testing.
Installation
pip install muxsim
Usage
Muxsim is expected to be used as a python module. It has reasonable defaults for most use cases, but can be configured to your liking.
Here is a simple example of how to use muxsim:
from muxsim import MuxSim
ms = MuxSim()
matrix = ms.sample()
The sampling scheme can be fully parameterized like so:
from muxsim import MuxSim
ms = MuxSim(
num_cells=10000,
num_guides=100,
n=10.0,
p=0.1,
λ=0.8,
random_state=42,
)
matrix = ms.sample()
Methods
The simulator, muxsim, is based on a Multinomial distribution, where the number of draws $(\mathcal{S})$ of cell $(i)$ is drawn from a Negative Binomial distribution representing the number of observed UMIs of that cell.
$$ \begin{align} \mathbb{U}_i &\sim \text{Multinomial}(\mathbb{S}_i,\ f_i) \ \mathbb{S}_i &\sim \text{NegativeBinomial}(n,\ p) \ \end{align} $$
The frequencies of the multinomial distribution are cell specific and sum to 1:
$$ \sum_{j=1}^{M}{f_{ij}} = 1 $$
The background frequencies are assumed to be equiprobable (where $(\forall u,v \in M)(f_{iu} = f_{iv})$ ), except for signal guides - which would be a scaled by some value $(r)$. The number of signal guides is chosen using a Poisson prior to simulate situations where the expected multiplicity of infection (MOI) can change:
$$ \mathbb{I}_i \sim \text{Poisson}(\lambda) $$
The signal guides are chosen randomly from the guide set where the number of choices is equal to the MOI of that cell:
$$ \mathbb{C}_i \sim \text{Uniform}(M, \mathbb{I}_i) $$
This allows us to then set the the signal guides at a rate $(r)$ above the background with the following expression:
$$ t_{ij} = \begin{cases} r,& \text{if } j \in \mathbb{C}_i \ 1,& \text{if } j \not\in \mathbb{C}_i \end{cases} $$
Which can then be turned into the frequency matrix:
$$ f_i = \frac{t_{i}}{\sum_{j=1}^{M}t_{ij}} $$
Which forces $f_{ij}$ to sum to 1.
Metadata
Release files for muxsim 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| muxsim-0.1.1.tar.gz | 34.9 kB | Without provenance | Details for muxsim-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| muxsim-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for muxsim-0.1.1-py3-none-any.whl |
Total release size: 38.5 kB
Release files / muxsim-0.1.1.tar.gz
| Download URL | muxsim-0.1.1.tar.gz |
|---|---|
| Size | 34.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7b1429577c135d1caf30c43df3c20f31f7359e13f572f30dae6372c1f297485
|
|
BLAKE2b-256 checksum How to use checksums |
8afbb9c4d1632a76bdf04693dd014d64c1a91abe646f05b0402f003ea50b20ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.18
|
Release files / muxsim-0.1.1-py3-none-any.whl
| Download URL | muxsim-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e82c4649f1c6c69d0bc8d3f3227da12f7363aa80d63e37b416d141002a73c6ac
|
|
BLAKE2b-256 checksum How to use checksums |
fccd08563e4605876c7b967b4c06dda5ff0fc57f6404c2d40fa320b1d5506ced
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.18
|
Security for muxsim 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.