How do I …?
Fifty common tasks, one per line, each with links to the sections of the guide that answer it.
Getting started
- How do I install CRN-craft and check that it works? 1, Install the Python package; Check the installation
- How does CRN-craft compare with GillesPy2 or rebop? How CRN-craft compares
- How do I write a reaction network in Python? 2, Species, parameters and reactions
- How do I write a rate that is not mass action, such as Michaelis–Menten or Hill? 2, Rates as numbers and as strings
- How do I get the rate constant right for
A + A → B? 2, Rates as numbers and as strings; 8, Reproducing a published simulation, step 1 - How do I check a model without running it, and read the error? 2, Checking a model; Diagnostics
Running
- How do I run 1,000 replicates on 8 threads? 3, Many trajectories in one call; Seeds and threads; 5, Threads
- How do I get the same result again? 3, Seeds and threads
- How do I see whether a run finished, and how do I limit its events or its wall time? 3, Check the termination; Budgets; Troubleshooting, Runs that end early
- How do I stop a long run and keep what is done? 3, Stopping a run; 10, Stop a run with a cancel file
Results
- How do I get the mean and the variance of a species over time, as a data frame or a NumPy array? 4, What a result holds; Select by name; Mean, variance and standard error
- How do I get the median or a 95% band? 4, Quantiles and the median
- How do I keep single trajectories and read them? 4, Single trajectories
- How do I export results for plotting, or plot them in Python? 4, Export and plot
- How do I save a run with its model and settings in one file? 4, Save a run in one file
Speed
- How do I run one model for many parameter values? 5, Parameter sweeps
- How do I compile a model to make it faster? 5, Compiled models
- My model has hundreds of reactions. Which selector is fastest? 7, Static Direct and its selectors; Larger models
Events
- How do I stop a replicate when a condition holds, such as extinction or a threshold? 6, Stop conditions
- How do I get the exact time at which a threshold is first reached, the peak of a species, or how often it appears and dies out? 6, Trackers; 11, First passage from saved paths
- How do I record the single events of a run? 6, Event logs
- How do I run my own Python code at every event? 6, Callbacks
Methods
- Which method should I use? 7, Which method for which model
- How do I get the exact distribution instead of samples? 7, Exact distributions with finite state projection
- When can I trust tau leaping? 7, Approximate leaping
Reproducing
- How do I reproduce a simulation from a published paper? 8, Reproducing a published simulation
- The paper gives its seed. Can I get the same trajectories? No: 8, Reproducing a published simulation, step 2
- How do I compare my ensemble with published means and variances, and how many replicates do I need? 8, Reproducing a published simulation, steps 3 and 4; 4, Mean, variance and standard error
- The paper used a fixed time step. How do I match it? 7, Approximate leaping; S1d, Matching an hourly scheme
- What do I report so that others can reproduce my run? 8, What to record for a paper
- Why do I get other numbers with another method, selector, thread count or release? 7, Same law, different random numbers; 8, What does not reproduce bit for bit
More kinds of models, and fitting
- How do I couple a continuous quantity, such as ATP or a drug level, to the reactions? 9, A variable between events
- How do I add a time-dependent forcing, such as a daily rhythm or a decaying dose? 9, Independent variables
- How do I fit parameters to data? O1, Fitting parameters to data; the optimization tutorials
Command line, files and other formats
- How do I run a model from the command line or on a cluster? 10, A request file; Run, archive and verify
- How do I archive a run so that it can be verified later? 10, Run, archive and verify; Replay
- How do I import an SBML or BioNetGen model? 11, Import SBML and BioNetGen
- How do I convert a model file of release 0.6.0? 11, Convert a network model of release 0.6.0; Migrating from earlier releases
- How do I find the conservation laws of a network? 11, Conservation laws and structure
- How do I check a model against another simulator? 11, Export to GillesPy2; 8, Reproducing a published simulation
- How do I load a model from a JSON file, or save one? 12, Save and load a model file
- How do I model molecules that carry a property, such as a clone, a size or an age? 12, Species with attributes in the builder; as a document
- How do I give every new mutant its own identity? 12, Species with attributes in the builder; New identities and random attributes; 12a, Every lineage with the clone model
- How do I count clones, or follow the size of the largest one? 12, Observables
mtDNA models
- How do I simulate mutant takeover in single cells? S1, The model; S1a, A first ensemble; Takeover fraction and time to threshold
- How do I change copy number, half-life, initial heteroplasmy or the threshold? S1a, Variants
- How do I follow mutant classes, and single lineages? S1b, Mutant classes; 12a, Every lineage with the clone model
- How do I re-create the figures of a published simulation study? S2, Case study: re-creating a published study
- How do I count the clones of a cell and the size of the largest one? S2c, Reading the results
- How do I find the parameter that gives a target fraction of cells (sweep and logistic regression)? S2b, A sweep and a logistic regression
- How do I let the population size vary with ATP? S1c, Variable population: ATP
- How do I use the fast path
mtdna_direct, and why is it not faster on my model? S1d, The fast path; 12a, The fast path; Troubleshooting, Methods and models
Other languages and older code
- How do I use CRN-craft from R? 13, Using CRN-craft from R
- My script was written for 0.6.0 (
crn_craft.rules,run_spec,crn-craft ssa). What do I change? Migrating from earlier releases