Basic Telegraph Model

This example demonstrates how to fit a simple two-state telegraph model to RNA count data.

Setup

First, let's set up our project directory and load the package:

using StochasticGene

# Create project directory
rna_setup("telegraph_example")
cd("telegraph_example")

Data Preparation

Place your RNA count data in the data/ directory. The data should be in a format compatible with the package (see Data Types for details).

Model Definition

We'll fit a basic two-state telegraph model with:

  • 2 gene states (G=2)
  • No pre-RNA steps (R=0)
  • Simple transitions between states
# Define model parameters
G = 2  # Number of gene states
R = 0  # Number of pre-RNA steps
transitions = ([1,2], [2,1])  # Gene state transitions

Fitting the Model

Now we can fit the model to our data:

# Fit the model
fits, stats, measures, data, model, options = fit(
    G = G,
    R = R,
    transitions = transitions,
    datatype = "rna",
    datapath = "data/",
    gene = "MYC",
    datacond = "CONTROL"
)

Analyzing Results

Let's examine the fitting results:

# Print basic statistics
println(stats)

# Plot the results
using Plots
plot(fits)

# Save results
save_results(fits, "results/")

Model Interpretation

The fitted model provides:

  • Transition rates between gene states
  • Transcription rates
  • mRNA degradation rates
  • Model likelihood and fit statistics

Next Steps

  • Try fitting more complex models with pre-RNA steps
  • Experiment with different data conditions
  • Compare results across different genes

For more advanced examples, see: