Skip to content

scModels is an R package for distribution fitting of discrete count distributions.

Notifications You must be signed in to change notification settings

fuchslab/scModels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

scModels is an R package accompanying the paper "A mechanistic model for the negative binomial distribution of single-cell mRNA counts" by Lisa Amrhein, Kumar Harsha and Christiane Fuchs for distribution fitting of discrete count distributions. Included are the Poisson, the negative binomial and most importantly a new implementation of the Poisson-beta distribution (density, distribution and quantile function and random number generation) together with a needed new implementation of Kummer's function (also: confluent hypergeometric function of the first kind). Three implemented Gillespie algorithms allow synthetic data simulation via the basic, switching and bursting mRNA generating process, respectively. Finally likelihood functions for one population and two population mixtures - with and without zero-inflations - allow distribution fittings of the Poisson, negative binomial and the Poisson-beta distribution. The package depends on the MPFR libraries which need to be installed separately (see description below).

Installing MPFR

On Linux

On Ubuntu, the mpfr libraries can be installed with the following command:

sudo apt-get install -qy libmpfr-dev

For RPM based distributions, the corresponding package may be found at RPMfind.

On OS X

MPFR libraries can be installed on OS X with the Homebrew package manager.

brew install mpfr

Installing Homebrew is easy. The following command does it.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

On Windows

Installation on Windows requires building MPFR with the recommended toolchain for R.

Pre-compiled libraries have been put together by Prof. Brian Ripley and are available on his webpage. The files are under goodies/multilib directory. This includes a 'local' tree, named as local323.zip at the time this manual was prepared, that contains the headers and static libraries for MPFR amongst others.

The following instructions are valid for Windows 8 and above.

  1. The local323.zip has to be extracted at a convenient place. The C: drive is the location for the screenshots used in this manual.

  2. The location of the library needs to be added to the environment variables of the system. There are two ways to get to the list of environment variables:

    • One of the ways is to select Computer -> System properties in the Explorer. In the next window, select Advanced system settings.
    • Another option is to use the Windows search bar as shown in the picture below:
  3. The location needs to be added against the variable LIB_MPFR.

  4. Rstudio (or the current R session) has to be restarted so that these environment variables can be read.

Running the package test-suite

The package comes with a comprehensive test suite. In order to run the tests, the tarball must be extracted. Once that is done, the following command will run all tests:

devtools::test("/path/to/scModels/")

References:

Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier, and Paul Zimmermann. 2007. MPFR: A multiple-precision binary floating-point library with correct rounding. ACM Trans. Math. Softw. 33, 2 (June 2007), 13–es. DOI:https://doi.org/10.1145/1236463.1236468


About

scModels is an R package for distribution fitting of discrete count distributions.

Resources

Stars

Watchers

Forks

Packages

No packages published