generate_model: Closure function which returns a function generating 'nb_mut'...

Description Usage Arguments Value Examples

View source: R/generate_model.R

Description

Closure function which returns a function generating nb_mut fitnesses of mutant(s) (based on a wild-type of fitness given in the last element of the first row of empirical_fl). The model used for generating the mutant can chosen with model_type. The function returned then take a list of varying length as argument depending on model_type.

Usage

1
generate_model(empirical_fl, model_type, fun_args = list(), ...)

Arguments

empirical_fl

A matrix corresponding to an empirical fitness landscape. The first ncol-1 columns correspond to a genotype table. The rows correspond to different genotypes and the columns to the mutations that are considered for these genotypes. A genotype (at a certain row) has a given mutation when there is a 1 in the corresponding column. The column to of empirical_fl correspond to the fitness of each genotype. Only the fitness of the wt (i.e. the row in the genotype table with only zeros) is used.

model_type

A character corresponding to one of the following implemented models :

"fgmrmut"

random mutation in isotropic FGM. See model_fgmrmut

"fgmsmut"

selected mutation in isotropic FGM. See model_fgmsmut

"fgmcsmut"

coselected mutation in isotropic FGM. See model_fgmcsmut

"fgmrmut2env"

random mutation in isotropic FGM with a refence environment and a environment. See model_fgmrmut_2env

"fgmsmut2env"

selected mutation in isotropic FGM with a refence environment and a environment. See model_fgmsmut_2env

"fgmcsmut2env"

coselected mutation in isotropic FGM with a refence environment and a environment. See model_fgmcsmut_2env

"magellanFix"

Fixed fitness for all genotypes. See model_Fix

"magellanMult"

Additive effect of mutations. The fitnesses of all mutations are independent. See model_Mult

"magellanHoC"

House of Card model. The fitnesses of all genotypes are iid. See model_HoC

"magellanNK"

NK model from Kauffman et al. (1988). Each locus interacts with K other loci, that can be its neighbors or can be chosen randomly. Fitness are drawn in uniform [0,1]. See model_NK

"magellanIsing"

all loci are arranged sequentially, and each locus interacts with its physical neighbors. The last and the first loci will interact only if 'c' is TRUE. For each pair of interacting loci, there is an associated cost if both alleles are not identical (and therefore 'compatible'). See model_Ising

"magellanEggBox"

Each locus is either high or low fitness, with a systematic change between each neighbor. See model_EggBox

"magellanOptimum"

Each mutated locus produces a contribution to the fitness according to a production (p,P or uniform) distribution and compared to an optimum with a (o,O or uniform) distribution. See model_EggBox

fun_args

List of argument for a given model_type. Argument *_ref are mandatory parameters for the environment of reference in models with two environments

nb_mut_rand

optionnal for "fgmsmut", "fgmcsmut", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

fitness_wt_ref

mandatory for "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

n_ref

mandatory for "fgmrmut2env", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

lambda_ref

mandatory for "fgmrmut2env", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

maxfitness_ref

mandatory for "fgmrmut2env", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

alpha_ref

mandatory for ""fgmrmut2env", fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

Q_ref

mandatory for "fgmrmut2env", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

m_ref

mandatory for "fgmrmut2env", "fgmsmut2env" and "fgmcsmut2env". See model_fgmrmut_2env

...

Extra arguments which will be passed to read.table if an empirical fitness landscape is provided as a file in empirical_fl

Value

A function for generating mutants following the model from model_type and the genotype table and the fitness of the wild type given in empirical_fl.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#random mutation in isotropic FGM
empirical_fl <- unname(cbind(as.matrix(expand.grid(rep(list(0:1), 3))), seq(0.1, 0.8, 0.1)))
model <- generate_model(empirical_fl = empirical_fl, model_type = "fgmrmut")
model(3, 0.1, 1, 1/2, 2, 3)
#selected mutation in isotropic FGM
empirical_fl <- unname(cbind(as.matrix(expand.grid(rep(list(0:1), 3))), seq(0.1, 0.8, 0.1)))
model <- generate_model(empirical_fl = empirical_fl, model_type = "fgmsmut",
                        fun_args = list(nb_mut_rand = 10^5))
model(3, 0.1, 1, 1/2, 2, 3)
#coselected mutation in isotropic FGM
empirical_fl <- unname(cbind(as.matrix(expand.grid(rep(list(0:1), 3))), seq(0.1, 0.8, 0.1)))
model <- generate_model(empirical_fl = empirical_fl, model_type = "fgmcsmut",
                        fun_args = list(nb_mut_rand = 10^5))
model(3, 0.1, 1, 1/2, 2, 3)

YoannAnciaux/inferenceFitnessLandscape documentation built on Oct. 31, 2019, 1:19 a.m.