NKlandscape
PyCellChemistry documentation index
source code: src/NKlandscape.py

#---------------------------------------------------------------------------
#
# NKlandscape.py:
#
# a simple implementation of Kauffman's NK model of rugged fitness landscapes
#
# by Lidia Yamamoto, Kraainem, Belgium, November 2013
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Copyright (C) 2015 Lidia A. R. Yamamoto
# Contact: http://www.artificial-chemistries.org/
#
# This file is part of PyCellChemistry.
#
# PyCellChemistry is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3, as published by the Free Software Foundation.
#
# PyCellChemistry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyCellChemistry, see file COPYING. If not, see
# http://www.gnu.org/licenses/
#


Modules
artchem.BinaryStrings
numpy
sys


Classes
NKlandscape


class NKlandscape
Methods defined here:
__init__(self, n, k)
create an NK landscape with given n and k, where:
n is the total number of genes, and
k is the number of epistatic interactions per gene
dist2neighbors(self, genome)
fitness distance between a given genome and all its 1-mutant
neighbors
fitness(self, genome)
compute the fitness value for the given genome: the average of
the individual fitness values of each gene in the genome
gene_fitness(self, pos, genome)
returns the fitness of the gene at position 'pos' in the given
genome; CAUTION!! uses random epistatic matrix, not scalable!!!
gene_fitness_ALT(self, pos, genome)
returns the fitness of the gene at position 'pos' in the given
genome, using alternative pre-built fitness matrix and smaller
matrix of epistatic interactions, different from the original
method by Kauffman; (doesn't work very well, disabled by default)
mk_epistatic(self)
build matrix of epistatic interactions:
influence of K other genes on the fitness of each of the N genes
epi[i,j] = fitness of gene i when the state of K+1 genes
(gene i itself plus the K other genes that interact with it) is j
CAUTION!! needs big matrix of size N * 2^(K+1), not scalable!!
mk_epistatic_ALT(self)
alternative way to build a matrix of epistatic interactions:
epi[i,j,v] = amount of influence of gene i on gene j when the
value of gene i is v (this leads to a smaller matrix, but
doesn't work very well, disabled by default)
mk_fitness_ALT(self)
make a fitness matrix in order to reduce computation load
(goes with the mk_epistatic_ALT attempt, doesn't work very
well, disabled by default)


Functions
sweepNKdistance(n)
run the NK model for given N and varying K


Generated automatically by pydoc, July 10, 2015


Generated automatically by pydoc, July 10, 2015