Skip to content

a python module for generate cell / guide matrices for demultiplex testing

License

Notifications You must be signed in to change notification settings

noamteyssier/muxsim

Repository files navigation

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 ( S ) of cell ( i ) is drawn from a Negative Binomial distribution representing the number of observed UMIs of that cell.

U i Multinomial ( S i ,   f i ) S i NegativeBinomial ( n ,   p )

The frequencies of the multinomial distribution are cell specific and sum to 1:

j = 1 M f i j = 1

The background frequencies are assumed to be equiprobable (where ( u , v M ) ( f i u = f i v ) ), 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:

I i Poisson ( λ )

The signal guides are chosen randomly from the guide set where the number of choices is equal to the MOI of that cell:

C i Uniform ( M , I i )

This allows us to then set the the signal guides at a rate ( r ) above the background with the following expression:

t i j = { r , if  j C i 1 , if  j C i

Which can then be turned into the frequency matrix:

f i = t i j = 1 M t i j

Which forces f i j to sum to 1.

About

a python module for generate cell / guide matrices for demultiplex testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages