celldancer.simulation.simulate

celldancer.simulation.simulate(kinetic_type, alpha1=None, alpha2=None, beta1=None, beta2=None, gamma1=None, gamma2=None, start_splice1=None, start_splice2=None, start_unsplice1=None, start_unsplice2=None, path1_pct=None, path2_pct=None, path1_cell_number=None, path2_cell_number=None, noise_level=0.2)

Simulate a gene with the kinetic type of mono-kinetic, multi-forward, multi-backward, or transcriptional boost.

Parameters
  • kinetic_type (pandas.DataFrame) – kinetic_type could be selected from [‘mono’, ‘multi_forward’, ‘multi_backward’, ‘tran_boost’]

  • alpha1 (float (default: None)) – The simulated alpha (transcriptional rate) for the first lineage. This parameter is valid when kinetic_type is set to ‘mono’, ‘multi_forward’, or ‘tran_boost’.

  • alpha2 (float (default: None)) – The simulated alpha (transcriptional rate) for the second lineage. This parameter is valid when kinetic_type is set to ‘multi_forward’ or ‘tran_boost’.

  • beta1 (float (default: None)) – The simulated beta (splicing rate) for the first lineage.

  • beta2 (float (default: None)) – The simulated beta (splicing rate) for the second lineage.

  • gamma1 (float (default: None)) – The simulated gamma (degration rate) for the first lineage.

  • gamma2 (float (default: None)) – The simulated gamma (degration rate) for the second lineage.

  • start_splice1 (optional, float (default: None)) – The simulated spliced abundance for the first lineage. Cells start from a region at a point of (start_splice1, start_unsplice1) to decrease. This parameter is valid when kinetic_type is set to ‘multi_backward’.

  • start_splice2 (optional, float (default: None)) – The simulated spliced abundance for the second lineage. Cells start from a region at a point of (start_splice2, start_unsplice2) to decrease. This parameter is valid when kinetic_type is set to ‘multi_backward’.

  • start_unsplice1 (optional, float (default: None)) – The simulated unspliced abundance for the first lineage. Cells start from a region at a point of (start_splice1, start_unsplice1) to decrease. This parameter is valid when kinetic_type is set to ‘multi_backward’.

  • start_unsplice2 (optional, float (default: None)) – The simulated unspliced abundance for the second lineage. Cells start from a region at a point of (start_splice2, start_unsplice2) to decrease. This parameter is valid when kinetic_type is set to ‘multi_backward’.

  • path1_pct (optional, float (default: None)) – To decrease the bias of cell distribution at the steady point in the first lineage. This parameter is valid when kinetic_type is set to ‘mono’, ‘multi_forward’ or ‘tran_boost’.

  • path2_pct (optional, float (default: None)) – To decrease the bias of cell distribution at the steady point in the second lineage. This parameter is valid when kinetic_type is set to ‘mono’, ‘multi_forward’ or ‘tran_boost’.

  • path1_cell_number (float (default: None)) – The number of cells to be generated in the first lineage.

  • path2_cell_number (float (default: None)) – The number of cells to be generated in the second lineage.

  • noise_level (float (default: 0.2)) – The noise level to be set.

Returns

df – The dataframe of one simulated gene.

Return type

pandas.DataFrame

Example usage:

import celldancer.simulation as cdsim
import matplotlib.pyplot as plt

# Mono-kinetic
plt.figure(figsize=(5,5))
gene=cdsim.simulate(kinetic_type='mono',
                    alpha1=1,
                    alpha2=0,
                    beta1=1,
                    beta2=1,
                    gamma1=1,
                    gamma2=1,
                    path1_pct=99,
                    path2_pct=99,
                    path1_cell_number=1000,
                    path2_cell_number=1000)
plt.scatter(gene.splice,gene.unsplice,c='#95D9EF',alpha=0.5)

# Multi-lineage forward branching
plt.figure(figsize=(5,5))
gene=cdsim.simulate(kinetic_type='multi_forward',
                    alpha1=5,
                    alpha2=1,
                    beta1=1,
                    beta2=0.5,
                    gamma1=5,
                    gamma2=0.25,
                    path1_pct=99,
                    path2_pct=99,
                    path1_cell_number=1000,
                    path2_cell_number=1000)
plt.scatter(gene.splice,gene.unsplice,c='#95D9EF',alpha=0.5)

# Multi-lineage backward branching
plt.figure(figsize=(5,5))
gene=cdsim.simulate(kinetic_type='multi_backward',
                    beta1=1,
                    beta2=1,
                    gamma1=1,
                    gamma2=1,
                    start_splice1=1,
                    start_splice2=1.5,
                    start_unsplice1=1,
                    start_unsplice2=0.2,
                    path1_cell_number=1000,
                    path2_cell_number=1000)
plt.scatter(gene.splice,gene.unsplice,c='#95D9EF',alpha=0.5)

# Transcriptional boost
plt.figure(figsize=(5,5))
gene=cdsim.simulate(kinetic_type='tran_boost',
                    alpha1=2,
                    alpha2=5,
                    beta1=2,
                    beta2=2,
                    gamma1=1,
                    gamma2=1,
                    path1_pct=99,
                    path2_pct=80,
                    path1_cell_number=1000,
                    path2_cell_number=1000)
plt.scatter(gene.splice,gene.unsplice,c='#95D9EF',alpha=0.5)
sim