Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:9023cfe7eac951feac42e3bd4133ce866a0fe0f0
  • Code
  • Branches (1)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • 2837cec
  • /
  • README.md
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
content badge Iframe embedding
swh:1:cnt:3110534d1e0e9ffbdecae169a46c748d60bece8f
directory badge Iframe embedding
swh:1:dir:2837cecedb2ca8992d5afa9ee54102a1e8fa61b6
revision badge
swh:1:rev:f08bd75aabf7213e253baf26d219c374a745c8d4
snapshot badge
swh:1:snp:9023cfe7eac951feac42e3bd4133ce866a0fe0f0
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: f08bd75aabf7213e253baf26d219c374a745c8d4 authored by Christopher McFarland on 04 February 2019, 22:56:03 UTC
refract
Tip revision: f08bd75
README.md
# pdSim
Gillespie simulations of advantageous drivers & deleterious passengers in cancer

## Overview

This simulator is written in C with an emphasis on very-fast simulations of moderately-sized tumors. A forward Gillespie algorithm (the Next Reaction) is used to model cell birth, death, and mutations. This code is written at a low-level and not designed for ease-of-use for the general population. 

## Installation

The simulator is best accessed via a python wrapper. To download the code & build the python wrapper:

```sh
$ git clone https://github.com/cd-mcfarland/pdSim.git # get repository
$ cd pdSim
$ ./setup.py build_ext  # Build the python wrapper that runs the simulator
```
The simulator has a number of precompiler directives that alter the kind of simulation that is run, including: 

1. The Distribution of Fitness Effects (DFEs) that driver & passenger mutations are drawn from,
2. Whether-or-not the entire lineage history of the dividing cells is tracked, 
3. The epistasis effect between multiple mutations, 
4. Whether-or-not Circulating Tumor Cells (CTCs) are generated (to be used to simulate tumor growth at distant stroma),
5. Whether-or-not drivers are drawn from a psuedo-random DFE, or an array of specific genes. 

`load_cells.py` organizes these precompiler options into keyword arguments of a python function that then compiles the code accordingly and then returns a python class `sim` (all at runtime). `sim` then executes a simulation upon instantiation. The various outputs of the simulation are accessed via methods and attributes of the returned object. An example of usage:

```python
from load_cells import cells
sim = cells(passenger_distribution=2, tree=1) # passengers are drawn from a Log-Normal DFE; lineage is tracked
tumor = sim(sd=0.25, N_0=300)                 # simulate tumor growth with non-default values of sd, N_0
passenger_mutations = tumor.fixed_mutations[tumor.fixed_mutations <= 0]  
# fixed_mutations is a numpy.ndarray that records the fitness effects of every mutation that sweeps to fixation
# in temporal order. Passengers are, by definition, neutral or deleterious mutations. 
print('Mean fitness cost of fixated passengers: {:.3f}'.format(passenger_mutations.mean()))
# Mean fitness cost of fixated passengers: -0.001
tumor.plot(figname='population_size_versus_time.pdf')
```

The doc strings of the various methods and attributes should clarify the kinds of output you can retrieve. However, in general the code is not very accessible and was never written for general use. Knowledge of C & cython is needed, if you want to extend the code. 

`simple.py` also provides a useful, well-documented example of how the simulator might be used to model dN/dS statistics.

## Contact

Please contact [Christopher McFarland](mailto:christopherdmcfarland@gmail.com) for all questions. 

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top