# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.1 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (3,0,0): new_instancemethod = lambda func, inst, cls: _simuPOP_la.SWIG_PyInstanceMethod_New(func) else: from new import instancemethod as new_instancemethod if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_simuPOP_la', [dirname(__file__)]) except ImportError: import _simuPOP_la return _simuPOP_la if fp is not None: try: _mod = imp.load_module('_simuPOP_la', fp, pathname, description) finally: fp.close() return _mod _simuPOP_la = swig_import_helper() del swig_import_helper else: import _simuPOP_la del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 def _swig_setattr_nondynamic_method(set): def set_attr(self,name,value): if (name == "thisown"): return self.this.own(value) if hasattr(self,name) or (name == "this"): set(self,name,value) else: raise AttributeError("You cannot add attributes to %s" % self) return set_attr #redefine __repr__ to make it shorter. def _swig_repr(self): if hasattr(self, 'describe'): return self.describe() else: return "<%s.%s>" % (self.__class__.__module__.split('.')[-1].split('_')[0], self.__class__.__name__) class SwigPyIterator(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") __repr__ = _swig_repr __swig_destroy__ = _simuPOP_la.delete_SwigPyIterator def __iter__(self): return self SwigPyIterator.value = new_instancemethod(_simuPOP_la.SwigPyIterator_value,None,SwigPyIterator) SwigPyIterator.incr = new_instancemethod(_simuPOP_la.SwigPyIterator_incr,None,SwigPyIterator) SwigPyIterator.decr = new_instancemethod(_simuPOP_la.SwigPyIterator_decr,None,SwigPyIterator) SwigPyIterator.distance = new_instancemethod(_simuPOP_la.SwigPyIterator_distance,None,SwigPyIterator) SwigPyIterator.equal = new_instancemethod(_simuPOP_la.SwigPyIterator_equal,None,SwigPyIterator) SwigPyIterator.copy = new_instancemethod(_simuPOP_la.SwigPyIterator_copy,None,SwigPyIterator) SwigPyIterator.next = new_instancemethod(_simuPOP_la.SwigPyIterator_next,None,SwigPyIterator) SwigPyIterator.__next__ = new_instancemethod(_simuPOP_la.SwigPyIterator___next__,None,SwigPyIterator) SwigPyIterator.previous = new_instancemethod(_simuPOP_la.SwigPyIterator_previous,None,SwigPyIterator) SwigPyIterator.advance = new_instancemethod(_simuPOP_la.SwigPyIterator_advance,None,SwigPyIterator) SwigPyIterator.__eq__ = new_instancemethod(_simuPOP_la.SwigPyIterator___eq__,None,SwigPyIterator) SwigPyIterator.__ne__ = new_instancemethod(_simuPOP_la.SwigPyIterator___ne__,None,SwigPyIterator) SwigPyIterator.__iadd__ = new_instancemethod(_simuPOP_la.SwigPyIterator___iadd__,None,SwigPyIterator) SwigPyIterator.__isub__ = new_instancemethod(_simuPOP_la.SwigPyIterator___isub__,None,SwigPyIterator) SwigPyIterator.__add__ = new_instancemethod(_simuPOP_la.SwigPyIterator___add__,None,SwigPyIterator) SwigPyIterator.__sub__ = new_instancemethod(_simuPOP_la.SwigPyIterator___sub__,None,SwigPyIterator) SwigPyIterator_swigregister = _simuPOP_la.SwigPyIterator_swigregister SwigPyIterator_swigregister(SwigPyIterator) HAVE_FLOOR = _simuPOP_la.HAVE_FLOOR HAVE_POW = _simuPOP_la.HAVE_POW HAVE_SQRT = _simuPOP_la.HAVE_SQRT TR1_SUPPORT = _simuPOP_la.TR1_SUPPORT MALE = _simuPOP_la.MALE FEMALE = _simuPOP_la.FEMALE CUSTOMIZED = _simuPOP_la.CUSTOMIZED AUTOSOME = _simuPOP_la.AUTOSOME CHROMOSOME_X = _simuPOP_la.CHROMOSOME_X CHROMOSOME_Y = _simuPOP_la.CHROMOSOME_Y CONSTANT = _simuPOP_la.CONSTANT BINOMIAL_DISTRIBUTION = _simuPOP_la.BINOMIAL_DISTRIBUTION EXPONENTIAL_DISTRIBUTION = _simuPOP_la.EXPONENTIAL_DISTRIBUTION GEOMETRIC_DISTRIBUTION = _simuPOP_la.GEOMETRIC_DISTRIBUTION POISSON_DISTRIBUTION = _simuPOP_la.POISSON_DISTRIBUTION UNIFORM_DISTRIBUTION = _simuPOP_la.UNIFORM_DISTRIBUTION NORMAL_DISTRIBUTION = _simuPOP_la.NORMAL_DISTRIBUTION GAMMA_DISTRIBUTION = _simuPOP_la.GAMMA_DISTRIBUTION NO_SEX = _simuPOP_la.NO_SEX RANDOM_SEX = _simuPOP_la.RANDOM_SEX PROB_OF_MALES = _simuPOP_la.PROB_OF_MALES NUM_OF_MALES = _simuPOP_la.NUM_OF_MALES NUM_OF_FEMALES = _simuPOP_la.NUM_OF_FEMALES SEQUENCE_OF_SEX = _simuPOP_la.SEQUENCE_OF_SEX GLOBAL_SEQUENCE_OF_SEX = _simuPOP_la.GLOBAL_SEQUENCE_OF_SEX NO_CONVERSION = _simuPOP_la.NO_CONVERSION NUM_MARKERS = _simuPOP_la.NUM_MARKERS TRACT_LENGTH = _simuPOP_la.TRACT_LENGTH OFFSPRING = _simuPOP_la.OFFSPRING COMMON_OFFSPRING = _simuPOP_la.COMMON_OFFSPRING SPOUSE = _simuPOP_la.SPOUSE OUTBRED_SPOUSE = _simuPOP_la.OUTBRED_SPOUSE SIBLING = _simuPOP_la.SIBLING FULLSIBLING = _simuPOP_la.FULLSIBLING ANY_SEX = _simuPOP_la.ANY_SEX MALE_ONLY = _simuPOP_la.MALE_ONLY FEMALE_ONLY = _simuPOP_la.FEMALE_ONLY SAME_SEX = _simuPOP_la.SAME_SEX OPPOSITE_SEX = _simuPOP_la.OPPOSITE_SEX UNAFFECTED = _simuPOP_la.UNAFFECTED AFFECTED = _simuPOP_la.AFFECTED ANY_AFFECTION_STATUS = _simuPOP_la.ANY_AFFECTION_STATUS MULTIPLICATIVE = _simuPOP_la.MULTIPLICATIVE ADDITIVE = _simuPOP_la.ADDITIVE HETEROGENEITY = _simuPOP_la.HETEROGENEITY EXPONENTIAL = _simuPOP_la.EXPONENTIAL BY_IND_INFO = _simuPOP_la.BY_IND_INFO BY_PROBABILITY = _simuPOP_la.BY_PROBABILITY BY_PROPORTION = _simuPOP_la.BY_PROPORTION BY_COUNTS = _simuPOP_la.BY_COUNTS PATERNAL = _simuPOP_la.PATERNAL MATERNAL = _simuPOP_la.MATERNAL MEAN = _simuPOP_la.MEAN MAXIMUM = _simuPOP_la.MAXIMUM MINIMUM = _simuPOP_la.MINIMUM SUMMATION = _simuPOP_la.SUMMATION MULTIPLICATION = _simuPOP_la.MULTIPLICATION DBG_WARNING = _simuPOP_la.DBG_WARNING class Exception(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.Exception_swiginit(self,_simuPOP_la.new_Exception(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Exception Exception.message = new_instancemethod(_simuPOP_la.Exception_message,None,Exception) Exception_swigregister = _simuPOP_la.Exception_swigregister Exception_swigregister(Exception) cvar = _simuPOP_la.cvar ModuleMaxAllele = cvar.ModuleMaxAllele MaxRandomNumber = cvar.MaxRandomNumber MaxTraitIndex = cvar.MaxTraitIndex InvalidSubPopID = cvar.InvalidSubPopID MaxSubPopID = cvar.MaxSubPopID MaxIndexSize = cvar.MaxIndexSize class StopIteration(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.StopIteration_swiginit(self,_simuPOP_la.new_StopIteration(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_StopIteration StopIteration_swigregister = _simuPOP_la.StopIteration_swigregister StopIteration_swigregister(StopIteration) class IndexError(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.IndexError_swiginit(self,_simuPOP_la.new_IndexError(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_IndexError IndexError_swigregister = _simuPOP_la.IndexError_swigregister IndexError_swigregister(IndexError) class ValueError(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.ValueError_swiginit(self,_simuPOP_la.new_ValueError(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ValueError ValueError_swigregister = _simuPOP_la.ValueError_swigregister ValueError_swigregister(ValueError) class SystemError(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.SystemError_swiginit(self,_simuPOP_la.new_SystemError(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SystemError SystemError_swigregister = _simuPOP_la.SystemError_swigregister SystemError_swigregister(SystemError) class RuntimeError(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.RuntimeError_swiginit(self,_simuPOP_la.new_RuntimeError(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_RuntimeError RuntimeError_swigregister = _simuPOP_la.RuntimeError_swigregister RuntimeError_swigregister(RuntimeError) class StopEvolution(Exception): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.StopEvolution_swiginit(self,_simuPOP_la.new_StopEvolution(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_StopEvolution StopEvolution_swigregister = _simuPOP_la.StopEvolution_swigregister StopEvolution_swigregister(StopEvolution) UnnamedSubPop = _simuPOP_la.UnnamedSubPop cmp_epsilon = _simuPOP_la.cmp_epsilon def turnOnDebug(*args, **kwargs): """ Usage: turnOnDebug(code="") Details: Set debug code code. More than one code could be specified using a comma separated string. Name of available codes are available from moduleInfo()['debug'].keys(). """ return _simuPOP_la.turnOnDebug(*args, **kwargs) def turnOffDebug(code = "DBG_ALL"): """ Usage: turnOffDebug(code="DBG_ALL") Details: Turn off debug code code. More than one code could be specified using a comma separated string. Default to turn off all debug codes. """ return _simuPOP_la.turnOffDebug(code) def elapsedTime(*args, **kwargs): """ Usage: elapsedTime(name) """ return _simuPOP_la.elapsedTime(*args, **kwargs) def simuPOP_kbhit(): return _simuPOP_la.simuPOP_kbhit() simuPOP_kbhit = _simuPOP_la.simuPOP_kbhit def simuPOP_getch(): return _simuPOP_la.simuPOP_getch() simuPOP_getch = _simuPOP_la.simuPOP_getch def pow3(*args, **kwargs): return _simuPOP_la.pow3(*args, **kwargs) pow3 = _simuPOP_la.pow3 class intList(object): """ Details: A class to specify replicate list. The reason why I cannot simple use vectori() is that users have got used to use a single number to specify a single replicate. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, obj = None): """ Usage: intList(obj=None) """ _simuPOP_la.intList_swiginit(self,_simuPOP_la.new_intList(obj)) __swig_destroy__ = _simuPOP_la.delete_intList intList_swigregister = _simuPOP_la.intList_swigregister intList_swigregister(intList) class uintList(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: uintList(obj=Py_True) """ _simuPOP_la.uintList_swiginit(self,_simuPOP_la.new_uintList(*args, **kwargs)) def unspecified(self): """ Usage: x.unspecified() """ return _simuPOP_la.uintList_unspecified(self) __swig_destroy__ = _simuPOP_la.delete_uintList uintList.unspecified = new_instancemethod(_simuPOP_la.uintList_unspecified,None,uintList) uintList_swigregister = _simuPOP_la.uintList_swigregister uintList_swigregister(uintList) class lociList(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: lociList(obj=Py_True) """ _simuPOP_la.lociList_swiginit(self,_simuPOP_la.new_lociList(*args, **kwargs)) def empty(self): """ Usage: x.empty() """ return _simuPOP_la.lociList_empty(self) def dynamic(self): """ Usage: x.dynamic() """ return _simuPOP_la.lociList_dynamic(self) def locate(self, *args, **kwargs): """ Usage: x.locate(trait) """ return _simuPOP_la.lociList_locate(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_lociList lociList.empty = new_instancemethod(_simuPOP_la.lociList_empty,None,lociList) lociList.dynamic = new_instancemethod(_simuPOP_la.lociList_dynamic,None,lociList) lociList.locate = new_instancemethod(_simuPOP_la.lociList_locate,None,lociList) lociList_swigregister = _simuPOP_la.lociList_swigregister lociList_swigregister(lociList) class floatList(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: floatList(obj=None) """ _simuPOP_la.floatList_swiginit(self,_simuPOP_la.new_floatList(*args)) __swig_destroy__ = _simuPOP_la.delete_floatList floatList_swigregister = _simuPOP_la.floatList_swigregister floatList_swigregister(floatList) class stringList(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: stringList(str=None) """ _simuPOP_la.stringList_swiginit(self,_simuPOP_la.new_stringList(*args)) __swig_destroy__ = _simuPOP_la.delete_stringList stringList.push_back = new_instancemethod(_simuPOP_la.stringList_push_back,None,stringList) stringList_swigregister = _simuPOP_la.stringList_swigregister stringList_swigregister(stringList) class intMatrix(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, obj = None): """ Usage: intMatrix(obj=None) """ _simuPOP_la.intMatrix_swiginit(self,_simuPOP_la.new_intMatrix(obj)) __swig_destroy__ = _simuPOP_la.delete_intMatrix intMatrix_swigregister = _simuPOP_la.intMatrix_swigregister intMatrix_swigregister(intMatrix) class floatMatrix(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, obj = None): """ Usage: floatMatrix(obj=None) """ _simuPOP_la.floatMatrix_swiginit(self,_simuPOP_la.new_floatMatrix(obj)) __swig_destroy__ = _simuPOP_la.delete_floatMatrix floatMatrix_swigregister = _simuPOP_la.floatMatrix_swigregister floatMatrix_swigregister(floatMatrix) class stringMatrix(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, str = None): """ Usage: stringMatrix(str=None) """ _simuPOP_la.stringMatrix_swiginit(self,_simuPOP_la.new_stringMatrix(str)) __swig_destroy__ = _simuPOP_la.delete_stringMatrix stringMatrix_swigregister = _simuPOP_la.stringMatrix_swigregister stringMatrix_swigregister(stringMatrix) class uintString(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: uintString(value) """ _simuPOP_la.uintString_swiginit(self,_simuPOP_la.new_uintString(*args)) __swig_destroy__ = _simuPOP_la.delete_uintString uintString_swigregister = _simuPOP_la.uintString_swigregister uintString_swigregister(uintString) class stringFunc(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: stringFunc(value) """ _simuPOP_la.stringFunc_swiginit(self,_simuPOP_la.new_stringFunc(*args)) __swig_destroy__ = _simuPOP_la.delete_stringFunc stringFunc_swigregister = _simuPOP_la.stringFunc_swigregister stringFunc_swigregister(stringFunc) class uintListFunc(uintList): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: uintListFunc(values=[]) """ _simuPOP_la.uintListFunc_swiginit(self,_simuPOP_la.new_uintListFunc(*args)) __swig_destroy__ = _simuPOP_la.delete_uintListFunc uintListFunc_swigregister = _simuPOP_la.uintListFunc_swigregister uintListFunc_swigregister(uintListFunc) class floatListFunc(floatList): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: floatListFunc(func) """ _simuPOP_la.floatListFunc_swiginit(self,_simuPOP_la.new_floatListFunc(*args)) __swig_destroy__ = _simuPOP_la.delete_floatListFunc floatListFunc_swigregister = _simuPOP_la.floatListFunc_swigregister floatListFunc_swigregister(floatListFunc) def PyObj_As_Bool(*args, **kwargs): return _simuPOP_la.PyObj_As_Bool(*args, **kwargs) PyObj_As_Bool = _simuPOP_la.PyObj_As_Bool def PyObj_As_Int(*args, **kwargs): return _simuPOP_la.PyObj_As_Int(*args, **kwargs) PyObj_As_Int = _simuPOP_la.PyObj_As_Int def PyObj_As_Double(*args, **kwargs): return _simuPOP_la.PyObj_As_Double(*args, **kwargs) PyObj_As_Double = _simuPOP_la.PyObj_As_Double def PyObj_As_String(*args, **kwargs): return _simuPOP_la.PyObj_As_String(*args, **kwargs) PyObj_As_String = _simuPOP_la.PyObj_As_String def PyObj_As_Array(*args, **kwargs): return _simuPOP_la.PyObj_As_Array(*args, **kwargs) PyObj_As_Array = _simuPOP_la.PyObj_As_Array def PyObj_As_IntArray(*args, **kwargs): return _simuPOP_la.PyObj_As_IntArray(*args, **kwargs) PyObj_As_IntArray = _simuPOP_la.PyObj_As_IntArray def Allele_Vec_As_NumArray(*args, **kwargs): return _simuPOP_la.Allele_Vec_As_NumArray(*args, **kwargs) Allele_Vec_As_NumArray = _simuPOP_la.Allele_Vec_As_NumArray def PyObj_AsString(*args, **kwargs): return _simuPOP_la.PyObj_AsString(*args, **kwargs) PyObj_AsString = _simuPOP_la.PyObj_AsString def closeOutput(*args, **kwargs): """ Usage: closeOutput(output="") Details: Output files specified by '>' are closed immediately after they are written. Those specified by '>>' and '>>>' are closed by a simulator after Simulator.evolve(). However, these files will be kept open if the operators are applied directly to a population using the operators' function form. In this case, function closeOutput can be used to close a specific file output, and close all unclosed files if output is unspecified. An exception will be raised if output does not exist or it has already been closed. """ return _simuPOP_la.closeOutput(*args, **kwargs) class RNG_func(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): _simuPOP_la.RNG_func_swiginit(self,_simuPOP_la.new_RNG_func(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_RNG_func RNG_func.__call__ = new_instancemethod(_simuPOP_la.RNG_func___call__,None,RNG_func) RNG_func_swigregister = _simuPOP_la.RNG_func_swigregister RNG_func_swigregister(RNG_func) class RNG(object): """ Details: This random number generator class wraps around a number of random number generators from GNU Scientific Library. You can obtain and change the RNG used by the current simuPOP module through the getRNG() function, or create a separate random number generator and use it in your script. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, name = None, seed = 0): """ Usage: RNG(name=None, seed=0) Details: Create a RNG object using specified name and seed. If rng is not given, environmental variable GSL_RNG_TYPE will be used if it is available. Otherwise, generator mt19937 will be used. If seed is not given, /dev/urandom, /dev/random, or other system random number source will be used to guarantee that random seeds are used even if more than one simuPOP sessions are started simultaneously. Names of supported random number generators are available from moduleInfo()['availableRNGs']. """ _simuPOP_la.RNG_swiginit(self,_simuPOP_la.new_RNG(name, seed)) __swig_destroy__ = _simuPOP_la.delete_RNG def set(self, name = None, seed = 0): """ Usage: x.set(name=None, seed=0) Details: Replace the existing random number generator using RNGname with seed seed. If seed is 0, a random seed will be used. If name is empty, use the existing RNG but reset the seed. """ return _simuPOP_la.RNG_set(self, name, seed) def name(self): """ Usage: x.name() Details: Return the name of the current random number generator. """ return _simuPOP_la.RNG_name(self) def seed(self): """ Usage: x.seed() Details: Return the seed used to initialize the RNG. This can be used to repeat a previous session. """ return _simuPOP_la.RNG_seed(self) def randUniform(self): """ Usage: x.randUniform() Details: Generate a random number following a rng_uniform [0, 1) distribution. """ return _simuPOP_la.RNG_randUniform(self) def randBit(self): """Obsolete or undocumented function.""" return _simuPOP_la.RNG_randBit(self) def randInt(self, *args, **kwargs): """ Usage: x.randInt(n) Details: return a random number in the range of [0, 1, 2, ... n-1] """ return _simuPOP_la.RNG_randInt(self, *args, **kwargs) def randNormal(self, *args, **kwargs): """ Usage: x.randNormal(mu, sigma) Details: Generate a random number following a normal distribution with mean mu and standard deviation sigma. """ return _simuPOP_la.RNG_randNormal(self, *args, **kwargs) def randExponential(self, *args, **kwargs): """ Usage: x.randExponential(mu) Details: Generate a random number following a exponential distribution with parameter mu. """ return _simuPOP_la.RNG_randExponential(self, *args, **kwargs) def randGamma(self, *args, **kwargs): """ Usage: x.randGamma(a, b) Details: Generate a random number following a gamma distribution with a shape parameters a and scale parameter b. """ return _simuPOP_la.RNG_randGamma(self, *args, **kwargs) def randChisq(self, *args, **kwargs): """ Usage: x.randChisq(nu) Details: Generate a random number following a Chi-squared distribution with nu degrees of freedom. """ return _simuPOP_la.RNG_randChisq(self, *args, **kwargs) def randGeometric(self, *args, **kwargs): """ Usage: x.randGeometric(p) Details: Generate a random number following a geometric distribution with parameter p. """ return _simuPOP_la.RNG_randGeometric(self, *args, **kwargs) def randBinomial(self, *args, **kwargs): """ Usage: x.randBinomial(n, p) Details: Generate a random number following a binomial distribution with parameters n and p. """ return _simuPOP_la.RNG_randBinomial(self, *args, **kwargs) def randPoisson(self, *args, **kwargs): """ Usage: x.randPoisson(mu) Details: Generate a random number following a Poisson distribution with parameter mu. """ return _simuPOP_la.RNG_randPoisson(self, *args, **kwargs) def randTruncatedPoisson(self, *args, **kwargs): """ Usage: x.randTruncatedPoisson(mu) Details: Generate a positive random number following a zero-truncated Poisson distribution with parameter mu. """ return _simuPOP_la.RNG_randTruncatedPoisson(self, *args, **kwargs) def randTruncatedBinomial(self, *args, **kwargs): """ Usage: x.randTruncatedBinomial(n, p) Details: Generate a positive random number following a zero-truncated binomial distribution with parameters n and p. """ return _simuPOP_la.RNG_randTruncatedBinomial(self, *args, **kwargs) def randMultinomial(self, *args, **kwargs): """ Usage: x.randMultinomial(N, p) Details: Generate a random number following a multinomial distribution with parameters N and p (a list of probabilities). """ return _simuPOP_la.RNG_randMultinomial(self, *args, **kwargs) RNG.set = new_instancemethod(_simuPOP_la.RNG_set,None,RNG) RNG.name = new_instancemethod(_simuPOP_la.RNG_name,None,RNG) RNG.seed = new_instancemethod(_simuPOP_la.RNG_seed,None,RNG) RNG.randUniform = new_instancemethod(_simuPOP_la.RNG_randUniform,None,RNG) RNG.randBit = new_instancemethod(_simuPOP_la.RNG_randBit,None,RNG) RNG.randInt = new_instancemethod(_simuPOP_la.RNG_randInt,None,RNG) RNG.randNormal = new_instancemethod(_simuPOP_la.RNG_randNormal,None,RNG) RNG.randExponential = new_instancemethod(_simuPOP_la.RNG_randExponential,None,RNG) RNG.randGamma = new_instancemethod(_simuPOP_la.RNG_randGamma,None,RNG) RNG.randChisq = new_instancemethod(_simuPOP_la.RNG_randChisq,None,RNG) RNG.randGeometric = new_instancemethod(_simuPOP_la.RNG_randGeometric,None,RNG) RNG.randBinomial = new_instancemethod(_simuPOP_la.RNG_randBinomial,None,RNG) RNG.randPoisson = new_instancemethod(_simuPOP_la.RNG_randPoisson,None,RNG) RNG.randTruncatedPoisson = new_instancemethod(_simuPOP_la.RNG_randTruncatedPoisson,None,RNG) RNG.randTruncatedBinomial = new_instancemethod(_simuPOP_la.RNG_randTruncatedBinomial,None,RNG) RNG.randMultinomial = new_instancemethod(_simuPOP_la.RNG_randMultinomial,None,RNG) RNG_swigregister = _simuPOP_la.RNG_swigregister RNG_swigregister(RNG) def getRNG(): """ Description: return the currently used random number generator Usage: getRNG() """ return _simuPOP_la.getRNG() class WeightedSampler(object): """ Details: A random number generator that returns 0, 1, ..., k-1 with probabilites that are proportional to their weights. For example, a weighted sampler with weights 4, 3, 2 and 1 will return numbers 0, 1, 2 and 3 with probabilities 0.4, 0.3, 0.2 and 0.1, respectively. If an additional parameter N is specified, the weighted sampler will return exact proportions of numbers if N numbers are returned. The version without additional parameter is similar to the sample(prob, replace=FALSE) function of the R statistical package. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: WeightedSampler(weights=[], N=0) Details: Creates a weighted sampler that returns 0, 1, ... k-1 when a list of k weights are specified (weights). weights do not have to add up to 1. If a non-zero N is specified, exact proportions of numbers will be returned in N returned numbers. """ _simuPOP_la.WeightedSampler_swiginit(self,_simuPOP_la.new_WeightedSampler(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_WeightedSampler def draw(self): """ Usage: x.draw() Details: Returns a random number between 0 and k-1 with probabilities that are proportional to specified weights. """ return _simuPOP_la.WeightedSampler_draw(self) def drawSamples(self, n = 1): """ Usage: x.drawSamples(n=1) Details: Returns a list of n random numbers """ return _simuPOP_la.WeightedSampler_drawSamples(self, n) WeightedSampler.draw = new_instancemethod(_simuPOP_la.WeightedSampler_draw,None,WeightedSampler) WeightedSampler.drawSamples = new_instancemethod(_simuPOP_la.WeightedSampler_drawSamples,None,WeightedSampler) WeightedSampler_swigregister = _simuPOP_la.WeightedSampler_swigregister WeightedSampler_swigregister(WeightedSampler) class Bernullitrials(object): """ Details: this class encapsulate behavior of a sequence of Bernulli trial. the main idea is that when doing a sequence of Bernulli trials of the same probability, we can use much quicker algorithms instead of doing n Bernulli trials For example, when N=10000, p=0.001. The usual way to do N Bin(p) trials is to do N randUnif(0,1)<p comparison. using the new method, we can use geometric distrubution to find the next true event. Also, for the cases of p=0.5, random bits are generated. This class maintain a two dimensional table: a vector of probabilities cross expected number of trials p1 p2 p3 p4 p5 trial 1 trial 2 ... trial N We expect that N is big (usually populaiton size) and p_i are small using fast bernulliTrial method for fix p, we can fill up this table very quickly column by column This class will provide easy access to row (each trial) or column (called each prob) of this table. if this table is accessed row by row (each trial), a internal index is used. if index exceeds N, trials will be generated all again. if trial will be called, e.g., N+2 times all the time, this treatment might not be very efficient. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Bernullitrials(rng, prob, trials) """ _simuPOP_la.Bernullitrials_swiginit(self,_simuPOP_la.new_Bernullitrials(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Bernullitrials def probSize(self): """ Usage: x.probSize() """ return _simuPOP_la.Bernullitrials_probSize(self) def doTrial(self): """ Description: generate the trial table, reset m_cur Usage: x.doTrial() """ return _simuPOP_la.Bernullitrials_doTrial(self) def trial(self): """ Description: if necessary, do trail again. Usage: x.trial() """ return _simuPOP_la.Bernullitrials_trial(self) def trialSucc(self, *args): """ Usage: x.trialSucc(idx) """ return _simuPOP_la.Bernullitrials_trialSucc(self, *args) def probFirstSucc(self): """ Usage: x.probFirstSucc() """ return _simuPOP_la.Bernullitrials_probFirstSucc(self) def probNextSucc(self, *args, **kwargs): """ Usage: x.probNextSucc(pos) """ return _simuPOP_la.Bernullitrials_probNextSucc(self, *args, **kwargs) def trialFirstSucc(self, *args, **kwargs): """ Usage: x.trialFirstSucc(idx) """ return _simuPOP_la.Bernullitrials_trialFirstSucc(self, *args, **kwargs) def trialNextSucc(self, *args, **kwargs): """ Usage: x.trialNextSucc(idx, pos) """ return _simuPOP_la.Bernullitrials_trialNextSucc(self, *args, **kwargs) def setTrialSucc(self, *args, **kwargs): """ Usage: x.setTrialSucc(idx, succ) """ return _simuPOP_la.Bernullitrials_setTrialSucc(self, *args, **kwargs) def trialSuccRate(self, *args, **kwargs): """ Description: return the succ rate for one index, used for verification pruposes Usage: x.trialSuccRate(index) """ return _simuPOP_la.Bernullitrials_trialSuccRate(self, *args, **kwargs) def probSuccRate(self): """ Description: return the succ rate for current trial, used for verification pruposes Usage: x.probSuccRate() """ return _simuPOP_la.Bernullitrials_probSuccRate(self) npos = _simuPOP_la.Bernullitrials_npos Bernullitrials.probSize = new_instancemethod(_simuPOP_la.Bernullitrials_probSize,None,Bernullitrials) Bernullitrials.doTrial = new_instancemethod(_simuPOP_la.Bernullitrials_doTrial,None,Bernullitrials) Bernullitrials.trial = new_instancemethod(_simuPOP_la.Bernullitrials_trial,None,Bernullitrials) Bernullitrials.trialSucc = new_instancemethod(_simuPOP_la.Bernullitrials_trialSucc,None,Bernullitrials) Bernullitrials.probFirstSucc = new_instancemethod(_simuPOP_la.Bernullitrials_probFirstSucc,None,Bernullitrials) Bernullitrials.probNextSucc = new_instancemethod(_simuPOP_la.Bernullitrials_probNextSucc,None,Bernullitrials) Bernullitrials.trialFirstSucc = new_instancemethod(_simuPOP_la.Bernullitrials_trialFirstSucc,None,Bernullitrials) Bernullitrials.trialNextSucc = new_instancemethod(_simuPOP_la.Bernullitrials_trialNextSucc,None,Bernullitrials) Bernullitrials.setTrialSucc = new_instancemethod(_simuPOP_la.Bernullitrials_setTrialSucc,None,Bernullitrials) Bernullitrials.trialSuccRate = new_instancemethod(_simuPOP_la.Bernullitrials_trialSuccRate,None,Bernullitrials) Bernullitrials.probSuccRate = new_instancemethod(_simuPOP_la.Bernullitrials_probSuccRate,None,Bernullitrials) Bernullitrials_swigregister = _simuPOP_la.Bernullitrials_swigregister Bernullitrials_swigregister(Bernullitrials) def moduleInfo(): """ Usage: moduleInfo() Details: Return a dictionary with information regarding the currently loaded simuPOP module. This dictionary has the following keys: * revision: revision number. * version: simuPOP version string. * optimized: Is this module optimized (True or False). * alleleType: Allele type of the module (short, long or binary). * maxAllele: the maximum allowed allele state, which is 1 for binary modules, 255 for short modules and 65535 for long modules. * compiler: the compiler that compiles this module. * date: date on which this module is compiled. * python: version of python. * platform: platform of the module. * maxNumSubPop: maximum number of subpopulations. * maxIndex: maximum index size (limits population size * total number of marker). * debug: A dictionary with debugging codes as keys and the status of each debugging code (True or False) as their values. """ return _simuPOP_la.moduleInfo() class GenoStruTrait(object): """ Details: All individuals in a population share the same genotypic properties such as number of chromosomes, number and position of loci, names of markers, chromosomes, and information fields. These properties are stored in this GenoStruTrait class and are accessible from both Individual and Population classes. Currently, a genotypic structure consists of * Ploidy, namely the number of homologous sets of chromosomes, of a population. Haplodiploid population is also supported. * Number of chromosomes and number of loci on each chromosome. * Positions of loci, which determine the relative distance between loci on the same chromosome. No unit is assumed so these positions can be ordinal (1, 2, 3, ..., the default), in physical distance (bp, kb or mb), or in map distance (e.g. centiMorgan) depending on applications. * Names of alleles, which can either be shared by all loci or be specified for each locus. * Names of loci and chromosomes. * Names of information fields attached to each individual. In addition to basic property access functions, this class provides some utility functions such as locusByName, which looks up a locus by its name. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self): """ Usage: GenoStruTrait() Details: A GenoStruTrait object is created with the construction of a Population object and cannot be initialized directly. """ _simuPOP_la.GenoStruTrait_swiginit(self,_simuPOP_la.new_GenoStruTrait()) def lociDist(self, *args, **kwargs): """ Usage: x.lociDist(locus1, locus2) Details: Return the distance between loci locus1 and locus2 on the same chromosome. A negative value will be returned if locus1 is after locus2. """ return _simuPOP_la.GenoStruTrait_lociDist(self, *args, **kwargs) def lociLeft(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_lociLeft(self, *args, **kwargs) def distLeft(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_distLeft(self, *args, **kwargs) def lociCovered(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_lociCovered(self, *args, **kwargs) def ploidy(self): """ Usage: x.ploidy() Details: return the number of homologous sets of chromosomes, specified by the ploidy parameter of the Population function. Return 2 for a haplodiploid population because two sets of chromosomes are stored for both males and females in such a population. """ return _simuPOP_la.GenoStruTrait_ploidy(self) def ploidyName(self): """ Usage: x.ploidyName() Details: return the ploidy name of this population, can be one of haploid, diploid, haplodiploid, triploid, tetraploid or #-ploid where # is the ploidy number. """ return _simuPOP_la.GenoStruTrait_ploidyName(self) def numLoci(self, *args): """ Usage: x.numLoci() Details: return a list of the number of loci on all chromosomes. """ return _simuPOP_la.GenoStruTrait_numLoci(self, *args) def sexChrom(self): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_sexChrom(self) def isHaplodiploid(self): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_isHaplodiploid(self) def totNumLoci(self): """ Usage: x.totNumLoci() Details: return the total number of loci on all chromosomes. """ return _simuPOP_la.GenoStruTrait_totNumLoci(self) def genoSize(self): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_genoSize(self) def locusPos(self, *args, **kwargs): """ Usage: x.locusPos(locus) Details: return the position of locus locus specified by the lociPos parameter of the Population function. """ return _simuPOP_la.GenoStruTrait_locusPos(self, *args, **kwargs) def lociPos(self): """ Usage: x.lociPos() Details: return the positions of all loci, specified by the lociPos prameter of the Population function. The default positions are 1, 2, 3, 4, ... on each chromosome. """ return _simuPOP_la.GenoStruTrait_lociPos(self) def numChrom(self): """ Usage: x.numChrom() Details: return the number of chromosomes. """ return _simuPOP_la.GenoStruTrait_numChrom(self) def chromBegin(self, *args, **kwargs): """ Usage: x.chromBegin(chrom) Details: return the index of the first locus on chromosome chrom. """ return _simuPOP_la.GenoStruTrait_chromBegin(self, *args, **kwargs) def chromEnd(self, *args, **kwargs): """ Usage: x.chromEnd(chrom) Details: return the index of the last locus on chromosome chrom plus 1. """ return _simuPOP_la.GenoStruTrait_chromEnd(self, *args, **kwargs) def absLocusIndex(self, *args, **kwargs): """ Usage: x.absLocusIndex(chrom, locus) Details: return the absolute index of locus locus on chromosome chrom. c.f. chromLocusPair. """ return _simuPOP_la.GenoStruTrait_absLocusIndex(self, *args, **kwargs) def chromLocusPair(self, *args, **kwargs): """ Usage: x.chromLocusPair(locus) Details: return the chromosome and relative index of a locus using its absolute index locus. c.f. absLocusIndex. """ return _simuPOP_la.GenoStruTrait_chromLocusPair(self, *args, **kwargs) def chromName(self, *args, **kwargs): """ Usage: x.chromName(chrom) Details: return the name of a chromosome chrom. """ return _simuPOP_la.GenoStruTrait_chromName(self, *args, **kwargs) def chromNames(self): """ Usage: x.chromNames() Details: return a list of the names of all chromosomes. """ return _simuPOP_la.GenoStruTrait_chromNames(self) def chromType(self, *args, **kwargs): """ Usage: x.chromType(chrom) Details: return the type of a chromosome chrom (CUSTOMIZED, AUTOSOME, CHROMOSOME_X, or CHROMOSOME_Y). """ return _simuPOP_la.GenoStruTrait_chromType(self, *args, **kwargs) def chromTypes(self): """ Usage: x.chromTypes() Details: return the type of all chromosomes (CUSTOMIZED, AUTOSOME, CHROMOSOME_X or CHROMOSOME_Y). """ return _simuPOP_la.GenoStruTrait_chromTypes(self) def chromByName(self, *args, **kwargs): """ Usage: x.chromByName(name) Details: return the index of a chromosome by its name. """ return _simuPOP_la.GenoStruTrait_chromByName(self, *args, **kwargs) def alleleName(self, *args, **kwargs): """ Usage: x.alleleName(allele, locus=0) Details: return the name of allele allele at lcous specified by the alleleNames parameter of the Population function. locus could be ignored if alleles at all loci share the same names. If the name of an allele is unspecified, its value ('0', '1', '2', etc) is returned. """ return _simuPOP_la.GenoStruTrait_alleleName(self, *args, **kwargs) def alleleNames(self, locus = 0): """ Usage: x.alleleNames(locus=0) Details: return a list of allele names at given by the alleleNames parameter of the Population function. locus could be ignored if alleles at all loci share the same names. This list does not have to cover all possible allele states of a population so alleleNames()[allele] might fail (use alleleNames(allele) instead). """ return _simuPOP_la.GenoStruTrait_alleleNames(self, locus) def locusName(self, *args, **kwargs): """ Usage: x.locusName(locus) Details: return the name of locus locus specified by the lociNames parameter of the Population function. An empty string will be returned if no name has been given to locus locus. """ return _simuPOP_la.GenoStruTrait_locusName(self, *args, **kwargs) def lociNames(self): """ Usage: x.lociNames() Details: return the names of all loci specified by the lociNames parameter of the Population function. An empty list will be returned if lociNames was not specified. """ return _simuPOP_la.GenoStruTrait_lociNames(self) def locusByName(self, *args, **kwargs): """ Usage: x.locusByName(name) Details: return the index of a locus with name name. Raise a ValueError if no locus is found. Note that empty strings are used for loci without name but you cannot lookup such loci using this function. """ return _simuPOP_la.GenoStruTrait_locusByName(self, *args, **kwargs) def lociByNames(self, *args, **kwargs): """ Usage: x.lociByNames(names) Details: return the indexes of loci with names names. Raise a ValueError if any of the loci cannot be found. """ return _simuPOP_la.GenoStruTrait_lociByNames(self, *args, **kwargs) def hasInfoField(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_hasInfoField(self, *args, **kwargs) def infoSize(self): """Obsolete or undocumented function.""" return _simuPOP_la.GenoStruTrait_infoSize(self) def infoFields(self): """ Usage: x.infoFields() Details: return a list of the names of all information fields of the population. """ return _simuPOP_la.GenoStruTrait_infoFields(self) def infoField(self, *args, **kwargs): """ Usage: x.infoField(idx) Details: return the name of information field idx. """ return _simuPOP_la.GenoStruTrait_infoField(self, *args, **kwargs) def infoIdx(self, *args, **kwargs): """ Usage: x.infoIdx(name) Details: return the index of information field name. Raise an IndexError if name is not one of the information fields. """ return _simuPOP_la.GenoStruTrait_infoIdx(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_GenoStruTrait GenoStruTrait.lociDist = new_instancemethod(_simuPOP_la.GenoStruTrait_lociDist,None,GenoStruTrait) GenoStruTrait.lociLeft = new_instancemethod(_simuPOP_la.GenoStruTrait_lociLeft,None,GenoStruTrait) GenoStruTrait.distLeft = new_instancemethod(_simuPOP_la.GenoStruTrait_distLeft,None,GenoStruTrait) GenoStruTrait.lociCovered = new_instancemethod(_simuPOP_la.GenoStruTrait_lociCovered,None,GenoStruTrait) GenoStruTrait.ploidy = new_instancemethod(_simuPOP_la.GenoStruTrait_ploidy,None,GenoStruTrait) GenoStruTrait.ploidyName = new_instancemethod(_simuPOP_la.GenoStruTrait_ploidyName,None,GenoStruTrait) GenoStruTrait.numLoci = new_instancemethod(_simuPOP_la.GenoStruTrait_numLoci,None,GenoStruTrait) GenoStruTrait.sexChrom = new_instancemethod(_simuPOP_la.GenoStruTrait_sexChrom,None,GenoStruTrait) GenoStruTrait.isHaplodiploid = new_instancemethod(_simuPOP_la.GenoStruTrait_isHaplodiploid,None,GenoStruTrait) GenoStruTrait.totNumLoci = new_instancemethod(_simuPOP_la.GenoStruTrait_totNumLoci,None,GenoStruTrait) GenoStruTrait.genoSize = new_instancemethod(_simuPOP_la.GenoStruTrait_genoSize,None,GenoStruTrait) GenoStruTrait.locusPos = new_instancemethod(_simuPOP_la.GenoStruTrait_locusPos,None,GenoStruTrait) GenoStruTrait.lociPos = new_instancemethod(_simuPOP_la.GenoStruTrait_lociPos,None,GenoStruTrait) GenoStruTrait.numChrom = new_instancemethod(_simuPOP_la.GenoStruTrait_numChrom,None,GenoStruTrait) GenoStruTrait.chromBegin = new_instancemethod(_simuPOP_la.GenoStruTrait_chromBegin,None,GenoStruTrait) GenoStruTrait.chromEnd = new_instancemethod(_simuPOP_la.GenoStruTrait_chromEnd,None,GenoStruTrait) GenoStruTrait.absLocusIndex = new_instancemethod(_simuPOP_la.GenoStruTrait_absLocusIndex,None,GenoStruTrait) GenoStruTrait.chromLocusPair = new_instancemethod(_simuPOP_la.GenoStruTrait_chromLocusPair,None,GenoStruTrait) GenoStruTrait.chromName = new_instancemethod(_simuPOP_la.GenoStruTrait_chromName,None,GenoStruTrait) GenoStruTrait.chromNames = new_instancemethod(_simuPOP_la.GenoStruTrait_chromNames,None,GenoStruTrait) GenoStruTrait.chromType = new_instancemethod(_simuPOP_la.GenoStruTrait_chromType,None,GenoStruTrait) GenoStruTrait.chromTypes = new_instancemethod(_simuPOP_la.GenoStruTrait_chromTypes,None,GenoStruTrait) GenoStruTrait.chromByName = new_instancemethod(_simuPOP_la.GenoStruTrait_chromByName,None,GenoStruTrait) GenoStruTrait.alleleName = new_instancemethod(_simuPOP_la.GenoStruTrait_alleleName,None,GenoStruTrait) GenoStruTrait.alleleNames = new_instancemethod(_simuPOP_la.GenoStruTrait_alleleNames,None,GenoStruTrait) GenoStruTrait.locusName = new_instancemethod(_simuPOP_la.GenoStruTrait_locusName,None,GenoStruTrait) GenoStruTrait.lociNames = new_instancemethod(_simuPOP_la.GenoStruTrait_lociNames,None,GenoStruTrait) GenoStruTrait.locusByName = new_instancemethod(_simuPOP_la.GenoStruTrait_locusByName,None,GenoStruTrait) GenoStruTrait.lociByNames = new_instancemethod(_simuPOP_la.GenoStruTrait_lociByNames,None,GenoStruTrait) GenoStruTrait.hasInfoField = new_instancemethod(_simuPOP_la.GenoStruTrait_hasInfoField,None,GenoStruTrait) GenoStruTrait.infoSize = new_instancemethod(_simuPOP_la.GenoStruTrait_infoSize,None,GenoStruTrait) GenoStruTrait.infoFields = new_instancemethod(_simuPOP_la.GenoStruTrait_infoFields,None,GenoStruTrait) GenoStruTrait.infoField = new_instancemethod(_simuPOP_la.GenoStruTrait_infoField,None,GenoStruTrait) GenoStruTrait.infoIdx = new_instancemethod(_simuPOP_la.GenoStruTrait_infoIdx,None,GenoStruTrait) GenoStruTrait_swigregister = _simuPOP_la.GenoStruTrait_swigregister GenoStruTrait_swigregister(GenoStruTrait) class Individual(GenoStruTrait): """ Details: A Population consists of individuals with the same genotypic structure. An Individual object cannot be created independently, but refences to inidividuals can be retrieved using member functions of a Population object. In addition to structural information shared by all individuals in a population (provided by class GenoStruTrait), the Individual class provides member functions to get and set genotype, sex, affection status and information fields of an individual. Genotypes of an individual are stored sequentially and can be accessed locus by locus, or in batch. The alleles are arranged by position, chromosome and ploidy. That is to say, the first allele on the first chromosome of the first homologous set is followed by alleles at other loci on the same chromsome, then markers on the second and later chromosomes, followed by alleles on the second homologous set of the chromosomes for a diploid individual. A consequence of this memory layout is that alleles at the same locus of a non-haploid individual are separated by Individual::totNumLoci() loci. It is worth noting that access to invalid chromosomes, such as the Y chromosomes of female individuals, is not restricted. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self): """ Usage: Individual() Details: An Individual object cannot be created directly. It has to be accessed from a Population object using functions such as Population::Individual(idx). """ _simuPOP_la.Individual_swiginit(self,_simuPOP_la.new_Individual()) __swig_destroy__ = _simuPOP_la.delete_Individual def allele(self, *args, **kwargs): """ Usage: x.allele(idx, ploidy=-1, chrom=-1) Details: return the current allele at a locus, using its absolute index idx. If a ploidy ploidy and/or a chromosome indexes is given, idx is relative to the beginning of specified homologous copy of chromosomes (if chrom=-1) or the beginning of the specified homologous copy of specified chromosome (if chrom >= 0). """ return _simuPOP_la.Individual_allele(self, *args, **kwargs) def alleleChar(self, *args, **kwargs): """ Usage: x.alleleChar(idx, ploidy=-1, chrom=-1) Details: return the name of allele(idx, ploidy, chrom). If idx is invalid (e.g. second homologus copy of chromosome Y), '_' is returned. """ return _simuPOP_la.Individual_alleleChar(self, *args, **kwargs) def setAllele(self, *args, **kwargs): """ Usage: x.setAllele(allele, idx, ploidy=-1, chrom=-1) Details: set allele allele to a locus, using its absolute index idx. If a ploidy ploidy and/or a chromosome indexes are given, idx is relative to the beginning of specified homologous copy of chromosomes (if chrom=-1) or the beginning of the specified homologous copy of specified chromosome (if chrom >= 0). """ return _simuPOP_la.Individual_setAllele(self, *args, **kwargs) def genotype(self, *args, **kwargs): """ Usage: x.genotype(ploidy=ALL_AVAIL, chroms=ALL_AVAIL) Details: return an editable array (a carray object) that represents all alleles of an individual. If ploidy or chroms is given, only alleles on the specified chromosomes and homologous copy of chromosomes will be returned. If multiple chromosomes are specified, there should not be gaps between chromosomes. """ return _simuPOP_la.Individual_genotype(self, *args, **kwargs) def setGenotype(self, *args, **kwargs): """ Usage: x.setGenotype(geno, ploidy=ALL_AVAIL, chroms=ALL_AVAIL) Details: Fill the genotype of an individual using a list of alleles geno. If parameters ploidy and/or chroms are specified, alleles will be copied to only all or specified chromosomes on selected homologous copies of chromosomes. geno will be reused if its length is less than number of alleles to be filled. """ return _simuPOP_la.Individual_setGenotype(self, *args, **kwargs) def sex(self): """ Usage: x.sex() Details: return the sex of an individual, 1 for male and 2 for female. """ return _simuPOP_la.Individual_sex(self) def setSex(self, *args, **kwargs): """ Usage: x.setSex(sex) Details: set individual sex to MALE or FEMALE. """ return _simuPOP_la.Individual_setSex(self, *args, **kwargs) def affected(self): """ Usage: x.affected() Details: Return True if this individual is affected. """ return _simuPOP_la.Individual_affected(self) def setAffected(self, *args, **kwargs): """ Usage: x.setAffected(affected) Details: set affection status to affected (True or False). """ return _simuPOP_la.Individual_setAffected(self, *args, **kwargs) def info(self, *args, **kwargs): """ Usage: x.info(field) Details: Return the value of an information field filed (by index or name). ind.info(name) is equivalent to ind.name although the function form allows the use of indexes of information fieldes. """ return _simuPOP_la.Individual_info(self, *args, **kwargs) def setInfo(self, *args, **kwargs): """ Usage: x.setInfo(value, field) Details: set the value of an information field field (by index or name) to value. ind.setInfo(value, field) is equivalent to ind.field = value although the function form allows the use of indexes of information fieldes. """ return _simuPOP_la.Individual_setInfo(self, *args, **kwargs) Individual.allele = new_instancemethod(_simuPOP_la.Individual_allele,None,Individual) Individual.alleleChar = new_instancemethod(_simuPOP_la.Individual_alleleChar,None,Individual) Individual.setAllele = new_instancemethod(_simuPOP_la.Individual_setAllele,None,Individual) Individual.genotype = new_instancemethod(_simuPOP_la.Individual_genotype,None,Individual) Individual.setGenotype = new_instancemethod(_simuPOP_la.Individual_setGenotype,None,Individual) Individual.sex = new_instancemethod(_simuPOP_la.Individual_sex,None,Individual) Individual.setSex = new_instancemethod(_simuPOP_la.Individual_setSex,None,Individual) Individual.affected = new_instancemethod(_simuPOP_la.Individual_affected,None,Individual) Individual.setAffected = new_instancemethod(_simuPOP_la.Individual_setAffected,None,Individual) Individual.info = new_instancemethod(_simuPOP_la.Individual_info,None,Individual) Individual.setInfo = new_instancemethod(_simuPOP_la.Individual_setInfo,None,Individual) Individual.genoEnd = new_instancemethod(_simuPOP_la.Individual_genoEnd,None,Individual) Individual.__eq__ = new_instancemethod(_simuPOP_la.Individual___eq__,None,Individual) Individual.__ne__ = new_instancemethod(_simuPOP_la.Individual___ne__,None,Individual) Individual.__cmp__ = new_instancemethod(_simuPOP_la.Individual___cmp__,None,Individual) Individual_swigregister = _simuPOP_la.Individual_swigregister Individual_swigregister(Individual) class vspID(object): """ Details: A class to specify virtual subpopulation, which is composed of a subpopulation ID and a virtual subpopulation ID. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: vspID(id) Details: Create a subpopulation id. Accept id as well as names. """ _simuPOP_la.vspID_swiginit(self,_simuPOP_la.new_vspID(*args)) __swig_destroy__ = _simuPOP_la.delete_vspID def resolve(self, *args, **kwargs): """ Usage: x.resolve(pop) """ return _simuPOP_la.vspID_resolve(self, *args, **kwargs) vspID.__eq__ = new_instancemethod(_simuPOP_la.vspID___eq__,None,vspID) vspID.resolve = new_instancemethod(_simuPOP_la.vspID_resolve,None,vspID) vspID_swigregister = _simuPOP_la.vspID_swigregister vspID_swigregister(vspID) def __lshift__(*args, **kwargs): return _simuPOP_la.__lshift__(*args, **kwargs) __lshift__ = _simuPOP_la.__lshift__ class subPopList(object): """ Details: A class to specify (virtual) subpopulation list. Using a dedicated class allows users to specify a single subpopulation, or a list of (virutal) subpoulations easily. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, obj = None): """ Usage: subPopList(obj=None) """ _simuPOP_la.subPopList_swiginit(self,_simuPOP_la.new_subPopList(obj)) def expandFrom(self, *args, **kwargs): """ Description: expand ALL_AVAIL and [(ALL_AVAIL, vsp), ...] according to pop Usage: x.expandFrom(pop) """ return _simuPOP_la.subPopList_expandFrom(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_subPopList subPopList.__len__ = new_instancemethod(_simuPOP_la.subPopList___len__,None,subPopList) subPopList.push_back = new_instancemethod(_simuPOP_la.subPopList_push_back,None,subPopList) subPopList.begin = new_instancemethod(_simuPOP_la.subPopList_begin,None,subPopList) subPopList.end = new_instancemethod(_simuPOP_la.subPopList_end,None,subPopList) subPopList.expandFrom = new_instancemethod(_simuPOP_la.subPopList_expandFrom,None,subPopList) subPopList_swigregister = _simuPOP_la.subPopList_swigregister subPopList_swigregister(subPopList) class BaseVspSplitter(object): """ Details: This class is the base class of all virtual subpopulation (VSP) splitters, which provide ways to define groups of individuals in a subpopulation who share certain properties. A splitter defines a fixed number of named VSPs. They do not have to add up to the whole subpopulation, nor do they have to be distinct. After a splitter is assigned to a population, many functions and operators can be applied to individuals within specified VSPs. Each VSP has a name. A default name is determined by each splitter but you can also assign a name to each VSP. The name of a VSP can be retrieved by function BaseVspSplitter.name() or Population.subPopName(). Only one VSP splitter can be assigned to a population, which defined VSPs for all its subpopulations. If different splitters are needed for different subpopulations, a CombinedSplitter can be used. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") __repr__ = _swig_repr def clone(self): """ Usage: x.clone() Details: All VSP splitter defines a clone() function to create an identical copy of itself. """ return _simuPOP_la.BaseVspSplitter_clone(self) __swig_destroy__ = _simuPOP_la.delete_BaseVspSplitter def numVirtualSubPop(self): """ Usage: x.numVirtualSubPop() Details: Return the number of VSPs defined by this splitter. """ return _simuPOP_la.BaseVspSplitter_numVirtualSubPop(self) def name(self, *args, **kwargs): """ Usage: x.name(vsp) Details: Return the name of VSP vsp (an index between 0 and numVirtualSubPop()). """ return _simuPOP_la.BaseVspSplitter_name(self, *args, **kwargs) def vspByName(self, *args, **kwargs): """ Usage: x.vspByName(name) Details: Return the index of a virtual subpopulation from its name. """ return _simuPOP_la.BaseVspSplitter_vspByName(self, *args, **kwargs) BaseVspSplitter.clone = new_instancemethod(_simuPOP_la.BaseVspSplitter_clone,None,BaseVspSplitter) BaseVspSplitter.numVirtualSubPop = new_instancemethod(_simuPOP_la.BaseVspSplitter_numVirtualSubPop,None,BaseVspSplitter) BaseVspSplitter.name = new_instancemethod(_simuPOP_la.BaseVspSplitter_name,None,BaseVspSplitter) BaseVspSplitter.vspByName = new_instancemethod(_simuPOP_la.BaseVspSplitter_vspByName,None,BaseVspSplitter) BaseVspSplitter_swigregister = _simuPOP_la.BaseVspSplitter_swigregister BaseVspSplitter_swigregister(BaseVspSplitter) class CombinedSplitter(BaseVspSplitter): """ Details: This splitter takes several splitters and stacks their VSPs together. For example, if the first splitter defines 3 VSPs and the second splitter defines 2, the two VSPs from the second splitter become the fourth (index 3) and the fifth (index 4) VSPs of the combined splitter. In addition, a new set of VSPs could be defined as the union of one or more of the original VSPs. This splitter is usually used to define different types of VSPs to a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: CombinedSplitter(splitters=[], vspMap=[], names=[]) Details: Create a combined splitter using a list of splitters. For example, CombinedSplitter([SexSplitter(), AffectionSplitter()]) defines a combined splitter with four VSPs, defined by male (vsp 0), female (vsp 1), unaffected (vsp 2) and affected individuals (vsp 3). Optionally, a new set of VSPs could be defined by parameter vspMap. Each item in this parameter is a list of VSPs that will be combined to a single VSP. For example, vspMap=[(0, 2), (1, 3)] in the previous example will define two VSPs defined by male or unaffected, and female or affected individuals. VSP names are usually determined by splitters, but can also be specified using parameter names. """ _simuPOP_la.CombinedSplitter_swiginit(self,_simuPOP_la.new_CombinedSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_CombinedSplitter CombinedSplitter_swigregister = _simuPOP_la.CombinedSplitter_swigregister CombinedSplitter_swigregister(CombinedSplitter) class ProductSplitter(BaseVspSplitter): """ Details: This splitter takes several splitters and take their intersections as new VSPs. For example, if the first splitter defines 3 VSPs and the second splitter defines 2, 6 VSPs will be defined by splitting 3 VSPs defined by the first splitter each to two VSPs. This splitter is usually used to define finer VSPs from existing VSPs. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ProductSplitter(splitters=[], names=[]) Details: Create a product splitter using a list of splitters. For example, ProductSplitter([SexSplitter(), AffectionSplitter()]) defines four VSPs by male unaffected, male affected, female unaffected, and female affected individuals. VSP names are usually determined by splitters, but can also be specified using parameter names. """ _simuPOP_la.ProductSplitter_swiginit(self,_simuPOP_la.new_ProductSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ProductSplitter ProductSplitter_swigregister = _simuPOP_la.ProductSplitter_swigregister ProductSplitter_swigregister(ProductSplitter) class SexSplitter(BaseVspSplitter): """ Details: This splitter defines two VSPs by individual sex. The first VSP consists of all male individuals and the second VSP consists of all females in a subpopulation. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SexSplitter(names=[]) Details: Create a sex splitter that defines male and female VSPs. These VSPs are named Male and Female unless a new set of names are specified by parameter names. """ _simuPOP_la.SexSplitter_swiginit(self,_simuPOP_la.new_SexSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SexSplitter SexSplitter_swigregister = _simuPOP_la.SexSplitter_swigregister SexSplitter_swigregister(SexSplitter) class AffectionSplitter(BaseVspSplitter): """ Details: This class defines two VSPs according individual affection status. The first VSP consists of unaffected invidiauls and the second VSP consists of affected ones. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: AffectionSplitter(names=[]) Details: Create a splitter that defined two VSPs by affection status.These VSPs are named Unaffected and Affected unless a new set of names are specified by parameter names. """ _simuPOP_la.AffectionSplitter_swiginit(self,_simuPOP_la.new_AffectionSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_AffectionSplitter AffectionSplitter_swigregister = _simuPOP_la.AffectionSplitter_swigregister AffectionSplitter_swigregister(AffectionSplitter) class InfoSplitter(BaseVspSplitter): """ Details: This splitter defines VSPs according to the value of an information field of each indivdiual. A VSP is defined either by a value or a range of values. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InfoSplitter(field, values=[], cutoff=[], ranges=[], names=[]) Details: Create an infomration splitter using information field field. If parameter values is specified, each item in this list defines a VSP in which all individuals have this value at information field field. If a set of cutoff values are defined in parameter cutoff, individuals are grouped by intervals defined by these cutoff values. For example, cutoff=[1,2] defines three VSPs with v < 1, 1 <= v < 2 and v >=2 where v is the value of an individual at information field field. If parameter ranges is specified, each range defines a VSP. For example, ranges=[[1, 3], [2, 5]] defines two VSPs with 1 <= v < 3 and 2 <= 3 < 5. Of course, only one of the parameters values, cutoff and ranges should be defined, and values in cutoff should be distinct, and in an increasing order. A default set of names are given to each VSP unless a new set of names is given by parameter names. """ _simuPOP_la.InfoSplitter_swiginit(self,_simuPOP_la.new_InfoSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InfoSplitter InfoSplitter_swigregister = _simuPOP_la.InfoSplitter_swigregister InfoSplitter_swigregister(InfoSplitter) class ProportionSplitter(BaseVspSplitter): """ Details: This splitter divides subpopulations into several VSPs by proportion. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ProportionSplitter(proportions=[], names=[]) Details: Create a splitter that divides subpopulations by proportions, which should be a list of float numbers (between 0 and 1) that add up to 1. A default set of names are given to each VSP unless a new set of names is given by parameter names. """ _simuPOP_la.ProportionSplitter_swiginit(self,_simuPOP_la.new_ProportionSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ProportionSplitter ProportionSplitter_swigregister = _simuPOP_la.ProportionSplitter_swigregister ProportionSplitter_swigregister(ProportionSplitter) class RangeSplitter(BaseVspSplitter): """ Details: This class defines a splitter that groups individuals in certain ranges into VSPs. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: RangeSplitter(ranges, names=[]) Details: Create a splitter according to a number of individual ranges defined in ranges. For example, RangeSplitter(ranges=[[0, 20], [40, 50]]) defines two VSPs. The first VSP consists of individuals 0, 1, ..., 19, and the sceond VSP consists of individuals 40, 41, ..., 49. Note that a nested list has to be used even if only one range is defined. A default set of names are given to each VSP unless a new set of names is given by parameter names. """ _simuPOP_la.RangeSplitter_swiginit(self,_simuPOP_la.new_RangeSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_RangeSplitter RangeSplitter_swigregister = _simuPOP_la.RangeSplitter_swigregister RangeSplitter_swigregister(RangeSplitter) class GenotypeSplitter(BaseVspSplitter): """ Details: This class defines a VSP splitter that defines VSPs according to individual genotype at specified loci. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: GenotypeSplitter(loci, alleles, phase=False, names=[]) Details: Create a splitter that defines VSPs by individual genotype at loci (can be indexes or names of one or more loci). Each list in a list allele defines a VSP, which is a list of allowed alleles at these loci. If only one VSP is defined, the outer list of the nested list can be ignored. If phase if true, the order of alleles in each list is significant. If more than one set of alleles are given, Individuals having either of them is qualified. For example, in a haploid population, loci=1, alleles=[0, 1] defines a VSP with individuals having allele 0 or 1 at locus 1, alleles=[[0, 1], [2]] defines two VSPs with indivdiuals in the second VSP having allele 2 at locus 1. If multiple loci are involved, alleles at each locus need to be defined. For example, VSP defined by loci=[0, 1], alleles=[0, 1, 1, 1] consists of individuals having alleles [0, 1] or [1, 1] at loci [0, 1]. In a haploid population, loci=1, alleles=[0, 1] defines a VSP with individuals having genotype [0, 1] or [1, 0] at locus 1. alleles[[0, 1], [2, 2]] defines two VSPs with indivdiuals in the second VSP having genotype [2, 2] at locus 1. If phase is set to True, the first VSP will only has individuals with genotype [0, 1]. In the multiple loci case, alleles should be arranged by haplotypes, for example, loci=[0, 1], alleles=[0, 0, 1, 1], phase=True defines a VSP with individuals having genotype -0-0-, -1-1- at loci 0 and 1. If phase=False (default), genotypes -1-1-, -0-0-, -0-1- and -1-0- are all allowed. A default set of names are given to each VSP unless a new set of names is given by parameter names. """ _simuPOP_la.GenotypeSplitter_swiginit(self,_simuPOP_la.new_GenotypeSplitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_GenotypeSplitter GenotypeSplitter_swigregister = _simuPOP_la.GenotypeSplitter_swigregister GenotypeSplitter_swigregister(GenotypeSplitter) class pyIndIterator(object): """ Details: this class implements a Python itertor class that can be used to iterate through individuals in a (sub)population. If allInds are true, visiblility of individuals will not be checked. Otherwise, a functor will be used to check if indiviudals belong to a specified virtual subpopulation. An instance of this class is returned by population::Individuals() and Population::Individuals(subPop) """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: pyIndIterator(begin, end, allInds, func) """ _simuPOP_la.pyIndIterator_swiginit(self,_simuPOP_la.new_pyIndIterator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_pyIndIterator def next(self): """ Usage: x.__next__() """ return _simuPOP_la.pyIndIterator_next(self) pyIndIterator.__iter__ = new_instancemethod(_simuPOP_la.pyIndIterator___iter__,None,pyIndIterator) pyIndIterator.next = new_instancemethod(_simuPOP_la.pyIndIterator_next,None,pyIndIterator) pyIndIterator.__next__ = new_instancemethod(_simuPOP_la.pyIndIterator___next__,None,pyIndIterator) pyIndIterator_swigregister = _simuPOP_la.pyIndIterator_swigregister pyIndIterator_swigregister(pyIndIterator) class Population(GenoStruTrait): """ Details: A simuPOP population consists of individuals of the same genotypic structure, organized by generations, subpopulations and virtual subpopulations. It also contains a Python dictionary that is used to store arbitrary population variables. In addition to genotypic structured related functions provided by the GenoStruTrait class, the population class provides a large number of member functions that can be used to * Create, copy and compare populations. * Manipulate subpopulations. A population can be divided into several subpopulations. Because individuals only mate with individuals within the same subpopulation, exchange of genetic information across subpopulations can only be done through migration. A number of functions are provided to access subpopulation structure information, and to merge and split subpopulations. * Define and access virtual subpopulations. A virtual subpopulation splitter can be assigned to a population, which defines groups of individuals called virtual subpopulations (VSP) within each subpopulation. * Access individuals individually, or through iterators that iterate through individuals in (virtual) subpopulations. * Access genotype and information fields of individuals at the population level. From a population point of view, all genotypes are arranged sequentially individual by individual. Please refer to class Individual for an introduction to genotype arragement of each individual. * Store and access ancestral generations. A population can save arbitrary number of ancestral generations. It is possible to directly access an ancestor, or make an ancestral generation the current generation for more efficient access. * Insert or remove loci, resize (shrink or expand) a population, sample from a population, or merge with other populations. * Manipulate population variables and evaluate expressions in this local namespace. * Save and load a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Population(size=[], ploidy=2, loci=[], chromTypes=[], lociPos=[], ancGen=0, chromNames=[], alleleNames=[], lociNames=[], subPopNames=[], infoFields=[]) Details: The following parameters are used to create a population object: Arguments: size: A list of subpopulation sizes. The length of this list determines the number of subpopulations of this population. If there is no subpopulation, size=[popSize] can be written as size=popSize. ploidy: Number of homologous sets of chromosomes. Default to 2 (diploid). For efficiency considerations, all chromosomes have the same number of homologous sets, even if some customized chromosomes or some individuals (e.g. males in a haplodiploid population) have different numbers of homologous sets. The first case is handled by setting chromTypes of each chromosome. Only the haplodiploid populations are handled for the second case, for which ploidy=HAPLODIPLOID should be used. loci: A list of numbers of loci on each chromosome. The length of this parameter determines the number of chromosomes. If there is only one chromosome, numLoci instead of [numLoci] can be used. chromTypes: A list that specifies the type of each chromosome, which can be AUTOSOME, CHROMOSOME_X, CHROMOSOME_Y, or CUSTOMIZED. All chromosomes are assumed to be autosomes if this parameter is ignored. Sex chromosome can only be specified in a diploid population where the sex of an individual is determined by the existence of these chromosomes using the XX (FEMALE) and XY (MALE) convention. Both sex chromosomes have to be available and be specified only once. Because chromosomes X and Y are treated as two chromosomes, recombination on the pseudo-autosomal regions of the sex chromsomes is not supported. CUSTOMIZED chromosomes are special chromosomes whose inheritance patterns are undefined. They rely on user-defined functions and operators to be passed from parents to offspring. Multiple customized chromosomes have to be arranged consecutively. lociPos: Positions of all loci on all chromosome, as a list of float numbers. Default to 1, 2, ... etc on each chromosome. lociPos should be arranged chromosome by chromosome. If lociPos are not in order within a chromosome, they will be re-arranged along with corresponding lociNames (if specified). ancGen: Number of the most recent ancestral generations to keep during evolution. Default to 0, which means only the current generation will be kept. If it is set to -1, all ancestral generations will be kept in this population (and exhaust your computer RAM quickly). chromNames: A list of chromosome names. Default to '' for all chromosomes. alleleNames: A list or a nested list of allele names. If a list of alleles is given, it will be used for all loci in this population. For example, alleleNames=('A','C','T','G') gives names A, C, T, and G to alleles 0, 1, 2, and 3 respectively. If a nested list of names is given, it should specify alleles names for all loci. lociNames: A list of names for each locus. It can be empty or a list of unique names for each locus. If loci are not specified in order, loci names will be rearranged according to their position on the chromosome. subPopNames: A list of subpopulation names. All subpopulations will have name '' if this parameter is not specified. infoFields: Names of information fields (named float number) that will be attached to each individual. """ _simuPOP_la.Population_swiginit(self,_simuPOP_la.new_Population(*args, **kwargs)) def clone(self): """ Usage: x.clone() Details: Create a cloned copy of a population. Note that Python statement pop1 = pop only creates a reference to an existing population pop. """ return _simuPOP_la.Population_clone(self) def swap(self, *args, **kwargs): """ Usage: x.swap(rhs) Details: Swap the content of two population objects, which can be handy in some particular circumstances. For example, you could swap out a population in a simulator. """ return _simuPOP_la.Population_swap(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_Population def setVirtualSplitter(self, *args, **kwargs): """ Usage: x.setVirtualSplitter(splitter) Details: Set a VSP splitter to the population, which defines the same VSPs for all subpopulations. If different VSPs are needed for different subpopulations, a CombinedSplitter can be used to make these VSPs available to all subpopulations. """ return _simuPOP_la.Population_setVirtualSplitter(self, *args, **kwargs) def numVirtualSubPop(self): """ Usage: x.numVirtualSubPop() Details: Return the number of virtual subpopulations (VSP) defined by a VSP splitter. Return 0 if no VSP is defined. """ return _simuPOP_la.Population_numVirtualSubPop(self) def activateVirtualSubPop(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_activateVirtualSubPop(self, *args, **kwargs) def deactivateVirtualSubPop(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_deactivateVirtualSubPop(self, *args, **kwargs) def fitGenoStru(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_fitGenoStru(self, *args, **kwargs) def setSubPopStru(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_setSubPopStru(self, *args, **kwargs) def numSubPop(self): """ Usage: x.numSubPop() Details: Return the number of subpopulations in a population. Return 1 if there is no subpopulation structure. """ return _simuPOP_la.Population_numSubPop(self) def subPopSize(self, *args, **kwargs): """ Usage: x.subPopSize(subPop=[], ancGen=-1) Details: Return the size of a subpopulation (subPopSize(sp)) or a virtual subpopulation (subPopSize([sp, vsp])) in the current generation (default) or a specified ancestral generation ancGen. If no subpop is given, it is the same as popSize(ancGen). Population and virtual subpopulation names can be used. """ return _simuPOP_la.Population_subPopSize(self, *args, **kwargs) def subPopByName(self, *args, **kwargs): """ Usage: x.subPopByName(name) Details: Return the index of the first subpopulation with name name. An IndexError will be raised if subpopulations are not named, or if no subpopulation with name name is found. Virtual subpopulation name is not supported. """ return _simuPOP_la.Population_subPopByName(self, *args, **kwargs) def subPopName(self, *args, **kwargs): """ Usage: x.subPopName(subPop) Details: Return the "spName - vspName" (virtual named subpopulation), "" (unnamed non-virtual subpopulation), "spName" (named subpopulation) or "vspName" (unnamed virtual subpopulation), depending on whether subpopulation is named or if subPop is virtual. """ return _simuPOP_la.Population_subPopName(self, *args, **kwargs) def subPopNames(self): """ Usage: x.subPopNames() Details: Return the names of all subpopulations (excluding virtual subpopulations). An empty string will be returned for unnamed subpopulations. """ return _simuPOP_la.Population_subPopNames(self) def setSubPopName(self, *args, **kwargs): """ Usage: x.setSubPopName(name, subPop) Details: Assign a name name to subpopulation subPop. Note that subpopulation names do not have to be unique. """ return _simuPOP_la.Population_setSubPopName(self, *args, **kwargs) def subPopSizes(self, *args, **kwargs): """ Usage: x.subPopSizes(ancGen=-1) Details: Return the sizes of all subpopulations at the current generation (default) or specified ancestral generation ancGen. Virtual subpopulations are not considered. """ return _simuPOP_la.Population_subPopSizes(self, *args, **kwargs) def popSize(self, *args, **kwargs): """ Usage: x.popSize(ancGen=-1) Details: Return the total number of individuals in all subpopulations of the current generation (default) or the an ancestral generation ancGen. """ return _simuPOP_la.Population_popSize(self, *args, **kwargs) def absIndIndex(self, *args, **kwargs): """ Usage: x.absIndIndex(idx, subPop) Details: return the absolute index of an individual idx in subpopulation subPop. """ return _simuPOP_la.Population_absIndIndex(self, *args, **kwargs) def subPopIndPair(self, *args, **kwargs): """ Usage: x.subPopIndPair(idx) Details: Return the subpopulation ID and relative index of an individual, given its absolute index idx. """ return _simuPOP_la.Population_subPopIndPair(self, *args, **kwargs) def subPopBegin(self, *args, **kwargs): """ Usage: x.subPopBegin(subPop) Details: Return the index of the first individual in subpopulation subPop. """ return _simuPOP_la.Population_subPopBegin(self, *args, **kwargs) def subPopEnd(self, *args, **kwargs): """ Usage: x.subPopEnd(subPop) Details: Return the index of the last individual in subpopulation subPop plus 1, so that range(subPopBegin(subPop), subPopEnd(subPop) can iterate through the index of all individuals in subpopulation subPop. """ return _simuPOP_la.Population_subPopEnd(self, *args, **kwargs) def individual(self, *args, **kwargs): """ Usage: x.individual(idx, subPop=[]) Details: Return a refernce to individual idx in the population (if subPop=[], default) or a subpopulation (if subPop=sp). Virtual subpopulation is not supported. Note that a float idx is acceptable as long as it rounds closely to an integer. """ return _simuPOP_la.Population_individual(self, *args, **kwargs) def indByID(self, *args, **kwargs): """ Usage: x.indByID(id, ancGens=ALL_AVAIL, idField="ind_id") Details: Return a reference to individual with id stored in information field idField (default to ind_id). This function by default search the present and all ancestral generations (ancGen=ALL_AVAIL), but you can limit the search in specific generations if you know which generations to search (ancGens=[0,1] for present and parental generations) or UNSPECIFIED to search only the current generation. If no individual with id is found, an IndexError will be raised. A float id is acceptable as long as it rounds closely to an integer. Note that this function uses a dynamic searching algorithm which tends to be slow. If you need to look for multiple individuals from a static population, you might want to convert a population object to a pedigree object and use function Pedigree.indByID. """ return _simuPOP_la.Population_indByID(self, *args, **kwargs) def ancestor(self, *args, **kwargs): """ Usage: x.ancestor(idx, gen, subPop=[]) Details: Return a reference to individual idx in ancestral generation gen. The correct individual will be returned even if the current generation is not the present one (see also useAncestralGen). If a valid subPop is specified, index is relative to that subPop. Virtual subpopulation is not supported. Note that a float idx is acceptable as long as it rounds closely to an integer. """ return _simuPOP_la.Population_ancestor(self, *args, **kwargs) def individuals(self, *args, **kwargs): """ Usage: x.individuals(subPop=[]) Details: Return an iterator that can be used to iterate through all individuals in a population (if subPop=[], default), or a (virtual) subpopulation (subPop=spID or (spID, vspID)). If you would like to iterate through multiple subpopulations in multiple ancestral generations, please use function Population.allIndividuals(). """ return _simuPOP_la.Population_individuals(self, *args, **kwargs) def genotype(self, *args, **kwargs): """ Usage: x.genotype(subPop=[]) Details: Return an editable array of the genotype of all individuals in a population (if subPop=[], default), or individuals in a subpopulation subPop. Virtual subpopulation is unsupported. """ return _simuPOP_la.Population_genotype(self, *args, **kwargs) def setGenotype(self, *args, **kwargs): """ Usage: x.setGenotype(geno, subPop=[]) Details: Fill the genotype of all individuals in a population (if subPop=[]) or in a (virtual) subpopulation subPop (if subPop=sp or (sp, vsp)) using a list of alleles geno. geno will be reused if its length is less than subPopSize(subPop)*totNumLoci()*ploidy(). """ return _simuPOP_la.Population_setGenotype(self, *args, **kwargs) def sortIndividuals(self, *args, **kwargs): """ Usage: x.sortIndividuals(infoFields) Details: Sort individuals according to values at specified information fields (infoFields). Individuals will be sorted at an increasing order. """ return _simuPOP_la.Population_sortIndividuals(self, *args, **kwargs) def setSubPopByIndInfo(self, *args, **kwargs): """ Usage: x.setSubPopByIndInfo(field) Details: Rearrange individuals to their new subpopulations according to their integer values at information field field (value returned by Individual::info(field)). individuals with negative values at this field will be removed. Existing subpopulation names are kept. New subpopulations will have empty names. """ return _simuPOP_la.Population_setSubPopByIndInfo(self, *args, **kwargs) def splitSubPop(self, *args, **kwargs): """ Usage: x.splitSubPop(subPop, sizes, names=[]) Details: Split subpopulation subPop into subpopulations of given sizes, which should add up to the size of subpopulation subPop or 1, in which case sizes are treated as proportions. If subPop is not the last subpopulation, indexes of subpopulations after subPop are shifted. If subPop is named, the same name will be given to all new subpopulations unless a new set of names are specified for these subpopulations. This function returns the IDs of split subpopulations. """ return _simuPOP_la.Population_splitSubPop(self, *args, **kwargs) def removeSubPops(self, *args, **kwargs): """ Usage: x.removeSubPops(subPops) Details: Remove (virtual) subpopulation(s) subPops and all their individuals. This function can be used to remove complete subpopulations (with shifted subpopulation indexes) or individuals belonging to virtual subpopulations of a subpopulation. In the latter case, the subpopulations are kept even if all individuals have been removed. This function only handles the present generation. """ return _simuPOP_la.Population_removeSubPops(self, *args, **kwargs) def removeIndividuals(self, *args, **kwargs): """ Usage: x.removeIndividuals(indexes=[], IDs=[], idField="ind_id", filter=None) Details: remove individual(s) by absolute indexes (parameter index) or their IDs (parameter IDs), or using a filter function (paramter filter). If indexes are used, only individuals at the current generation will be removed. If IDs are used, all individuals with one of the IDs at information field idField (default to "ind_id") will be removed. Although "ind_id" usually stores unique IDs of individuals, this function is frequently used to remove groups of individuals with the same value at an information field. An IndexError will be raised if an index is out of bound, but no error will be given if an invalid ID is specified. In the last case, a user-defined function should be provided. This function should accept parameter "ind" or one or more of the information fields. All individuals, including ancestors if there are multiple ancestral generations, will be passed to this function. Individuals that returns True will be removed. This function does not affect subpopulation structure in the sense that a subpopulation will be kept even if all individuals from it are removed. """ return _simuPOP_la.Population_removeIndividuals(self, *args, **kwargs) def mergeSubPops(self, *args, **kwargs): """ Usage: x.mergeSubPops(subPops=ALL_AVAIL, name="") Details: Merge subpopulations subPops. If subPops is ALL_AVAIL (default), all subpopulations will be merged. subPops do not have to be adjacent to each other. They will all be merged to the subpopulation with the smallest subpopulation ID. Indexes of the rest of the subpopulation may be changed. A new name can be assigned to the merged subpopulation through parameter name (an empty name will be ignored). This function returns the ID of the merged subpopulation. """ return _simuPOP_la.Population_mergeSubPops(self, *args, **kwargs) def addIndFrom(self, *args, **kwargs): """ Usage: x.addIndFrom(pop) Details: Add all individuals, including ancestors, in pop to the current population. Two populations should have the same genotypic structures and number of ancestral generations. Subpopulations in population pop are kept. """ return _simuPOP_la.Population_addIndFrom(self, *args, **kwargs) def addChromFrom(self, *args, **kwargs): """ Usage: x.addChromFrom(pop) Details: Add chromosomes in population pop to the current population. population pop should have the same number of individuals as the current population in the current and all ancestral generations. This function merges genotypes on the new chromosomes from population pop individual by individual. """ return _simuPOP_la.Population_addChromFrom(self, *args, **kwargs) def addLociFrom(self, *args, **kwargs): """ Usage: x.addLociFrom(pop) Details: Add loci from population pop, chromosome by chromosome. Added loci will be inserted according to their position. Their position and names should not overlap with any locus in the current population. population pop should have the same number of individuals as the current population in the current and all ancestral generations. """ return _simuPOP_la.Population_addLociFrom(self, *args, **kwargs) def addChrom(self, *args, **kwargs): """ Usage: x.addChrom(lociPos, lociNames=[], chromName="", alleleNames=[], chromType=AUTOSOME) Details: Add chromosome chromName with given type chromType to a population, with loci lociNames inserted at position lociPos. lociPos should be ordered. lociNames and chromName should not exist in the current population. Allele names could be specified for all loci (a list of names) or differently for each locus (a nested list of names), using parameter alleleNames. Empty loci names will be used if lociNames is not specified. """ return _simuPOP_la.Population_addChrom(self, *args, **kwargs) def addLoci(self, *args, **kwargs): """ Usage: x.addLoci(chrom, pos, lociNames=[], alleleNames=[]) Details: Insert loci lociNames at positions pos on chromosome chrom. These parameters should be lists of the same length, although names may be ignored, in which case empty strings will be assumed. Single- value input is allowed for parameter chrom and pos if only one locus is added. Alleles at inserted loci are initialized with zero alleles. Note that loci have to be added to existing chromosomes. If loci on a new chromosome need to be added, function addChrom should be used. Optionally, allele names could be specified either for all loci (a single list) or each loci (a nested list). This function returns indexes of the inserted loci. """ return _simuPOP_la.Population_addLoci(self, *args, **kwargs) def resize(self, *args, **kwargs): """ Usage: x.resize(sizes, propagate=False) Details: Resize population by giving new subpopulation sizes sizes. individuals at the end of some subpopulations will be removed if the new subpopulation size is smaller than the old one. New individuals will be appended to a subpopulation if the new size is larger. Their genotypes will be set to zero (default), or be copied from existing individuals if propagate is set to True. More specifically, if a subpopulation with 3 individuals is expanded to 7, the added individuals will copy genotypes from individual 1, 2, 3, and 1 respectively. Note that this function only resizes the current generation. """ return _simuPOP_la.Population_resize(self, *args, **kwargs) def extractSubPops(self, *args, **kwargs): """ Usage: x.extractSubPops(subPops=ALL_AVAIL, rearrange=False) Details: Extract a list of (virtual) subpopulations from a population and create a new population. If rearrange is False (default), structure and names of extracted subpopulations are kept although extracted subpopulations can have fewer individuals if they are created from extracted virtual subpopulations. (e.g. it is possible to extract all male individuals from a subpopulation using a SexSplitter()). If rearrange is True, each (virtual) subpopulation in subPops becomes a new subpopulation in the extracted population in the order at which they are specified. Because each virtual subpopulation becomes a subpopulation, this function could be used, for example, to separate male and female individuals to two subpopulations ( subPops=[(0,0), (0,1)]). If overlapping (virtual) subpopulations are specified, individuals will be copied multiple times. This function only extract individuals from the present generation. """ return _simuPOP_la.Population_extractSubPops(self, *args, **kwargs) def extractIndividuals(self, *args, **kwargs): """ Usage: x.extractIndividuals(indexes=[], IDs=[], idField="ind_id", filter=None) Details: Extract individuals with given absolute indexes (parameter indexes), IDs (parameter IDs, stored in information field idField, default to ind_id), or a filter function (parameter filter). If a list of absolute indexes are specified, the present generation will be extracted and form a one-generational population. If a list of IDs are specified, this function will look through all ancestral generations and extract individuals with given ID. Individuals with shared IDs are allowed. In the last case, a user- defined Python function should be provided. This function should accept parameter "ind" or one or more of the information fields. All individuals, including ancestors if there are multiple ancestral generations, will be passed to this function. Individuals that returns True will be extracted. Extracted individuals will be in their original ancestral generations and subpopulations, even if some subpopulations or generations are empty. An IndexError will be raised if an index is out of bound but no error will be given if an invalid ID is encountered. """ return _simuPOP_la.Population_extractIndividuals(self, *args, **kwargs) def removeLoci(self, *args, **kwargs): """ Usage: x.removeLoci(loci=UNSPECIFIED, keep=UNSPECIFIED) Details: Remove loci (absolute indexes or names) and genotypes at these loci from the current population. Alternatively, a parameter keep can be used to specify loci that will not be removed. """ return _simuPOP_la.Population_removeLoci(self, *args, **kwargs) def recodeAlleles(self, *args, **kwargs): """ Usage: x.recodeAlleles(alleles, loci=ALL_AVAIL, alleleNames=[]) Details: Recode alleles at loci (can be a list of loci indexes or names, or all loci in a population (ALL_AVAIL)) to other values according to parameter alleles. This parameter can a list of new allele numbers for alleles 0, 1, 2, ... (allele x will be recoded to newAlleles[x], x outside of the range of newAlleles will not be recoded, although a warning will be given if DBG_WARNING is defined) or a Python function, which should accept one or both parameters allele (existing allele) and locus (index of locus). The return value will become the new allele. This function is intended to recode some alleles without listing all alleles in a list. It will be called once for each existing allele so it is not possible to recode an allele to different alleles. A new list of allele names could be specified for these loci. Different sets of names could be specified for each locus if a nested list of names are given. This function recode alleles for all subpopulations in all ancestral generations. """ return _simuPOP_la.Population_recodeAlleles(self, *args, **kwargs) def push(self, *args, **kwargs): """ Usage: x.push(pop) Details: Push population pop into the current population. Both populations should have the same genotypic structure. The current population is discarded if ancestralDepth (maximum number of ancestral generations to hold) is zero so no ancestral generation can be kept. Otherise, the current population will become the parental generation of pop. If ancGen of a population is positive and there are already ancGen ancestral generations (c.f. ancestralGens()), the greatest ancestral generation will be discarded. In any case, Populationpop becomes invalid as all its individuals are absorbed by the current population. """ return _simuPOP_la.Population_push(self, *args, **kwargs) def curAncestralGen(self): """Obsolete or undocumented function.""" return _simuPOP_la.Population_curAncestralGen(self) def ancestralGens(self): """ Usage: x.ancestralGens() Details: Return the actual number of ancestral generations stored in a population, which does not necessarily equal to the number set by setAncestralDepth(). """ return _simuPOP_la.Population_ancestralGens(self) def setIndInfo(self, *args, **kwargs): """ Usage: x.setIndInfo(values, field, subPop=[]) Details: Set information field field (specified by index or name) of all individuals (if subPop=[], default), or individuals in a (virtual) subpopulation (subPop=sp or (sp, vsp)) to values. values will be reused if its length is smaller than the size of the population or (virtual) subpopulation. """ return _simuPOP_la.Population_setIndInfo(self, *args, **kwargs) def indInfo(self, *args, **kwargs): """ Usage: x.indInfo(field, subPop=[]) Details: Return the values (as a list) of information field field (by index or name) of all individuals (if subPop=[], default), or individuals in a (virtual) subpopulation (if subPop=sp or (sp, vsp)). """ return _simuPOP_la.Population_indInfo(self, *args, **kwargs) def addInfoFields(self, *args, **kwargs): """ Usage: x.addInfoFields(fields, init=0) Details: Add a list of information fields fields to a population and initialize their values to init. If an information field alreay exists, it will be re-initialized. """ return _simuPOP_la.Population_addInfoFields(self, *args, **kwargs) def setInfoFields(self, *args, **kwargs): """ Usage: x.setInfoFields(fields, init=0) Details: Set information fields fields to a population and initialize them with value init. All existing information fields will be removed. """ return _simuPOP_la.Population_setInfoFields(self, *args, **kwargs) def removeInfoFields(self, *args, **kwargs): """ Usage: x.removeInfoFields(fields) Details: Remove information fields fields from a population. """ return _simuPOP_la.Population_removeInfoFields(self, *args, **kwargs) def updateInfoFieldsFrom(self, *args, **kwargs): """ Usage: x.updateInfoFieldsFrom(fields, pop, fromFields=[], ancGens=ALL_AVAIL) Details: Update information fields fields from fromFields of another population (or Pedigree) pop. Two populations should have the same number of individuals. If fromFields is not specified, it is assumed to be the same as fields. If ancGens is not ALL_AVAIL, only the specified ancestral generations are updated. """ return _simuPOP_la.Population_updateInfoFieldsFrom(self, *args, **kwargs) def setAncestralDepth(self, *args, **kwargs): """ Usage: x.setAncestralDepth(depth) Details: set the intended ancestral depth of a population to depth, which can be 0 (does not store any ancestral generation), -1 (store all ancestral generations), and a positive number (store depth ancestral generations. If there exists more than depth ancestral generations (if depth > 0), extra ancestral generations are removed. """ return _simuPOP_la.Population_setAncestralDepth(self, *args, **kwargs) def useAncestralGen(self, *args, **kwargs): """ Usage: x.useAncestralGen(idx) Details: Making ancestral generation idx (0 for current generation, 1 for parental generation, 2 for grand-parental generation, etc) the current generation. This is an efficient way to access Population properties of an ancestral generation. useAncestralGen(0) should always be called afterward to restore the correct order of ancestral generations. """ return _simuPOP_la.Population_useAncestralGen(self, *args, **kwargs) def save(self, *args, **kwargs): """ Usage: x.save(filename) Details: Save population to a file filename, which can be loaded by a global function loadPopulation(filename). """ return _simuPOP_la.Population_save(self, *args, **kwargs) def vars(self, *args, **kwargs): """ Usage: x.vars(subPop=[]) Details: return variables of a population as a Python dictionary. If a valid subpopulation subPop is specified, a dictionary vars()["subPop"][subPop] is returned. A ValueError will be raised if key subPop does not exist in vars(), or if key subPop does not exist in vars()["subPop"]. """ return _simuPOP_la.Population_vars(self, *args, **kwargs) def evaluate(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_evaluate(self, *args, **kwargs) def execute(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Population_execute(self, *args, **kwargs) Population.clone = new_instancemethod(_simuPOP_la.Population_clone,None,Population) Population.swap = new_instancemethod(_simuPOP_la.Population_swap,None,Population) Population.setVirtualSplitter = new_instancemethod(_simuPOP_la.Population_setVirtualSplitter,None,Population) Population.numVirtualSubPop = new_instancemethod(_simuPOP_la.Population_numVirtualSubPop,None,Population) Population.activateVirtualSubPop = new_instancemethod(_simuPOP_la.Population_activateVirtualSubPop,None,Population) Population.deactivateVirtualSubPop = new_instancemethod(_simuPOP_la.Population_deactivateVirtualSubPop,None,Population) Population.__cmp__ = new_instancemethod(_simuPOP_la.Population___cmp__,None,Population) Population.fitGenoStru = new_instancemethod(_simuPOP_la.Population_fitGenoStru,None,Population) Population.setSubPopStru = new_instancemethod(_simuPOP_la.Population_setSubPopStru,None,Population) Population.numSubPop = new_instancemethod(_simuPOP_la.Population_numSubPop,None,Population) Population.subPopSize = new_instancemethod(_simuPOP_la.Population_subPopSize,None,Population) Population.subPopByName = new_instancemethod(_simuPOP_la.Population_subPopByName,None,Population) Population.subPopName = new_instancemethod(_simuPOP_la.Population_subPopName,None,Population) Population.subPopNames = new_instancemethod(_simuPOP_la.Population_subPopNames,None,Population) Population.setSubPopName = new_instancemethod(_simuPOP_la.Population_setSubPopName,None,Population) Population.subPopSizes = new_instancemethod(_simuPOP_la.Population_subPopSizes,None,Population) Population.popSize = new_instancemethod(_simuPOP_la.Population_popSize,None,Population) Population.absIndIndex = new_instancemethod(_simuPOP_la.Population_absIndIndex,None,Population) Population.subPopIndPair = new_instancemethod(_simuPOP_la.Population_subPopIndPair,None,Population) Population.subPopBegin = new_instancemethod(_simuPOP_la.Population_subPopBegin,None,Population) Population.subPopEnd = new_instancemethod(_simuPOP_la.Population_subPopEnd,None,Population) Population.individual = new_instancemethod(_simuPOP_la.Population_individual,None,Population) Population.indByID = new_instancemethod(_simuPOP_la.Population_indByID,None,Population) Population.ancestor = new_instancemethod(_simuPOP_la.Population_ancestor,None,Population) Population.individuals = new_instancemethod(_simuPOP_la.Population_individuals,None,Population) Population.indIterator = new_instancemethod(_simuPOP_la.Population_indIterator,None,Population) Population.rawIndBegin = new_instancemethod(_simuPOP_la.Population_rawIndBegin,None,Population) Population.rawIndEnd = new_instancemethod(_simuPOP_la.Population_rawIndEnd,None,Population) Population.indGenoBegin = new_instancemethod(_simuPOP_la.Population_indGenoBegin,None,Population) Population.indGenoEnd = new_instancemethod(_simuPOP_la.Population_indGenoEnd,None,Population) Population.genotype = new_instancemethod(_simuPOP_la.Population_genotype,None,Population) Population.setGenotype = new_instancemethod(_simuPOP_la.Population_setGenotype,None,Population) Population.sortIndividuals = new_instancemethod(_simuPOP_la.Population_sortIndividuals,None,Population) Population.setSubPopByIndInfo = new_instancemethod(_simuPOP_la.Population_setSubPopByIndInfo,None,Population) Population.splitSubPop = new_instancemethod(_simuPOP_la.Population_splitSubPop,None,Population) Population.removeSubPops = new_instancemethod(_simuPOP_la.Population_removeSubPops,None,Population) Population.removeIndividuals = new_instancemethod(_simuPOP_la.Population_removeIndividuals,None,Population) Population.mergeSubPops = new_instancemethod(_simuPOP_la.Population_mergeSubPops,None,Population) Population.addIndFrom = new_instancemethod(_simuPOP_la.Population_addIndFrom,None,Population) Population.addChromFrom = new_instancemethod(_simuPOP_la.Population_addChromFrom,None,Population) Population.addLociFrom = new_instancemethod(_simuPOP_la.Population_addLociFrom,None,Population) Population.addChrom = new_instancemethod(_simuPOP_la.Population_addChrom,None,Population) Population.addLoci = new_instancemethod(_simuPOP_la.Population_addLoci,None,Population) Population.resize = new_instancemethod(_simuPOP_la.Population_resize,None,Population) Population.extractSubPops = new_instancemethod(_simuPOP_la.Population_extractSubPops,None,Population) Population.extractIndividuals = new_instancemethod(_simuPOP_la.Population_extractIndividuals,None,Population) Population.removeLoci = new_instancemethod(_simuPOP_la.Population_removeLoci,None,Population) Population.recodeAlleles = new_instancemethod(_simuPOP_la.Population_recodeAlleles,None,Population) Population.push = new_instancemethod(_simuPOP_la.Population_push,None,Population) Population.curAncestralGen = new_instancemethod(_simuPOP_la.Population_curAncestralGen,None,Population) Population.ancestralGens = new_instancemethod(_simuPOP_la.Population_ancestralGens,None,Population) Population.setIndInfo = new_instancemethod(_simuPOP_la.Population_setIndInfo,None,Population) Population.infoBegin = new_instancemethod(_simuPOP_la.Population_infoBegin,None,Population) Population.infoEnd = new_instancemethod(_simuPOP_la.Population_infoEnd,None,Population) Population.indInfo = new_instancemethod(_simuPOP_la.Population_indInfo,None,Population) Population.addInfoFields = new_instancemethod(_simuPOP_la.Population_addInfoFields,None,Population) Population.setInfoFields = new_instancemethod(_simuPOP_la.Population_setInfoFields,None,Population) Population.removeInfoFields = new_instancemethod(_simuPOP_la.Population_removeInfoFields,None,Population) Population.updateInfoFieldsFrom = new_instancemethod(_simuPOP_la.Population_updateInfoFieldsFrom,None,Population) Population.setAncestralDepth = new_instancemethod(_simuPOP_la.Population_setAncestralDepth,None,Population) Population.useAncestralGen = new_instancemethod(_simuPOP_la.Population_useAncestralGen,None,Population) Population.save = new_instancemethod(_simuPOP_la.Population_save,None,Population) Population.vars = new_instancemethod(_simuPOP_la.Population_vars,None,Population) Population.evaluate = new_instancemethod(_simuPOP_la.Population_evaluate,None,Population) Population.execute = new_instancemethod(_simuPOP_la.Population_execute,None,Population) Population_swigregister = _simuPOP_la.Population_swigregister Population_swigregister(Population) HAPLODIPLOID = _simuPOP_la.HAPLODIPLOID def loadPopulation(*args, **kwargs): """ Usage: loadPopulation(file) Details: load a population from a file saved by Population::save(). """ return _simuPOP_la.loadPopulation(*args, **kwargs) class BaseOperator(object): """ Details: Operators are objects that act on populations. They can be applied to populations directly using their function forms, but they are usually managed and applied by a simulator. In the latter case, operators are passed to the evolve function of a simulator, and are applied repeatedly during the evolution of the simulator. The BaseOperator class is the base class for all operators. It defines a common user interface that specifies at which generations, at which stage of a life cycle, to which populations and subpopulations an operator is applied. These are achieved by a common set of parameters such as begin, end, step, at, stage for all operators. Note that a specific operator does not have to honor all these parameters. For example, a Recombinator can only be applied during mating so it ignores the stage parameter. An operator can be applied to all or part of the generations during the evolution of a simulator. At the beginning of an evolution, a simulator is usually at the beginning of generation 0. If it evolves 10 generations, it evolves generations 0, 1, ,,,., and 9 (10 generations) and stops at the begging of generation 10. A negative generation number a has generation number 10 + a, with -1 referring to the last evolved generation 9. Note that the starting generation number of a simulator can be changed by its setGen() member function. Output from an operator is usually directed to the standard output (sys.stdout). This can be configured using a output specification string, which can be '' for no output, '>' standard terminal output (default), a filename prefixed by one or more '>' characters or a Python expression indicated by a leading exclamation mark ('!expr'). In the case of '>filename' (or equivalently 'filename'), the output from an operator is written to this file. However, if two operators write to the same file filename, or if an operator writes to this file more than once, only the last write operation will succeed. In the case of '>>filename', file filename will be opened at the beginning of the evolution and closed at the end. Outputs from multiple operators are appended. >>>filename works similar to >>filename but filename, if it already exists at the beginning of an evolutionary process, will not be cleared. If the output specification is prefixed by an exclamation mark, the string after the mark is considered as a Python expression. When an operator is applied to a population, this expression will be evaluated within the population's local namespace to obtain a population specific output specification. As an advanced feature, a Python function can be assigned to this parameter. Output strings will be sent to this function for processing. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: BaseOperator(output, begin, end, step, at, reps, subPops, infoFields) Details: The following parameters can be specified by all operators. However, an operator can ignore some parameters and the exact meaning of a parameter can vary. Arguments: output: A string that specifies how output from an operator is written, which can be '' (no output), '>' (standard output), 'filename' prefixed by one or more '>', or an Python expression prefixed by an exclamation mark ('!expr'). Alternatively, a Python function can be given to handle outputs. begin: The starting generation at which an operator will be applied. Default to 0. A negative number is interpreted as a generation counted from the end of an evolution (-1 being the last evolved generation). end: The last generation at which an operator will be applied. Default to -1, namely the last generation. step: The number of generations between applicable generations. Default to 1. at: A list of applicable generations. Parameters begin, end, and step will be ignored if this parameter is specified. A single generation number is also acceptable. reps: A list of applicable replicates. A common default value ALL_AVAIL is interpreted as all replicates in a simulator. Negative indexes such as -1 (last replicate) is acceptable. rep=idx can be used as a shortcut for rep=[idx]. subPops: A list of applicable (virtual) subpopulations, such as subPops=[sp1, sp2, (sp2, vsp1)]. subPops=[sp1] can be simplied as subPops=sp1. Negative indexes are not supported. A common default value (ALL_AVAIL) of this parameter reprents all subpopulations of the population being aplied. Suport for this parameter vary from operator to operator and some operators do not support virtual subpopulations at all. Please refer to the reference manual of individual operators for their support for this parameter. infoFields: A list of information fields that will be used by an operator. You usually do not need to specify this parameter because operators that use information fields usually have default values for this parameter. """ _simuPOP_la.BaseOperator_swiginit(self,_simuPOP_la.new_BaseOperator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_BaseOperator def clone(self): """ Usage: x.clone() Details: Return a cloned copy of an operator. This function is available to all operators. """ return _simuPOP_la.BaseOperator_clone(self) def apply(self, *args, **kwargs): """ Usage: x.apply(pop) Details: Apply an operator to population pop directly, without checking its applicability. """ return _simuPOP_la.BaseOperator_apply(self, *args, **kwargs) def describe(self, format = True): """Obsolete or undocumented function.""" return _simuPOP_la.BaseOperator_describe(self, format) BaseOperator.clone = new_instancemethod(_simuPOP_la.BaseOperator_clone,None,BaseOperator) BaseOperator.apply = new_instancemethod(_simuPOP_la.BaseOperator_apply,None,BaseOperator) BaseOperator.describe = new_instancemethod(_simuPOP_la.BaseOperator_describe,None,BaseOperator) BaseOperator_swigregister = _simuPOP_la.BaseOperator_swigregister BaseOperator_swigregister(BaseOperator) class opList(object): """ """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ Usage: opList(ops=[]) """ _simuPOP_la.opList_swiginit(self,_simuPOP_la.new_opList(*args)) __swig_destroy__ = _simuPOP_la.delete_opList opList_swigregister = _simuPOP_la.opList_swigregister opList_swigregister(opList) class Pause(BaseOperator): """ Details: This operator pauses the evolution of a simulator at given generations or at a key stroke. When a simulator is stopped, you can go to a Python shell to examine the status of an evolutionary process, resume or stop the evolution. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Pause(stopOnKeyStroke=False, prompt=True, output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that pause the evolution of a population when it is applied to this population. If stopOnKeyStroke is False (default), it will always pause a population when it is applied, if this parameter is set to True, the operator will pause a population if *any* key has been pressed. If a specific character is set, the operator will stop when this key has been pressed. This allows, for example, the use of several pause operators to pause different populations. After a population has been paused, a message will be displayed (unless prompt is set to False) and tells you how to proceed. You can press 's' to stop the evolution of this population, 'S' to stop the evolution of all populations, or 'p' to enter a Python shell. The current population will be available in this Python shell as "pop_X_Y" when X is generation number and Y is replicate number. The evolution will continue after you exit this interactive Python shell. Note: Ctrl-C will be intercepted even if a specific character is specified in parameter stopOnKeyStroke. """ _simuPOP_la.Pause_swiginit(self,_simuPOP_la.new_Pause(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Pause Pause_swigregister = _simuPOP_la.Pause_swigregister Pause_swigregister(Pause) class NoneOp(BaseOperator): """ Details: This operator does nothing when it is applied to a population. It is usually used as a placeholder when an operator is needed syntactically. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: NoneOp(output=">", begin=0, end=0, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a NoneOp. """ _simuPOP_la.NoneOp_swiginit(self,_simuPOP_la.new_NoneOp(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_NoneOp NoneOp_swigregister = _simuPOP_la.NoneOp_swigregister NoneOp_swigregister(NoneOp) class IfElse(BaseOperator): """ Details: This operator uses a condition, which can be a fixed condition, an expression or a user-defined function, to determine which operators to be applied when this operator is applied. A list of if-operators will be applied when the condition is True. Otherwise a list of else-operators will be applied. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: IfElse(cond, ifOps=[], elseOps=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a conditional operator that will apply operators ifOps if condition cond is met and elseOps otherwise. If a Python expression (a string) is given to parameter cond, the expression will be evalulated in each population's local namespace when this operator is applied. When a Python function is specified, it accepts parameter pop when it is applied to a population, and one or more parameters pop, off, dad or mom when it is applied during mating. The return value of this function should be True or False. Otherwise, parameter cond will be treated as a fixed condition (converted to True or False) upon which one set of operators is always applied. The applicability of ifOps and elseOps are controlled by parameters begin, end, step, at and rep of both the IfElse operator and individual operators but ifOps and elseOps opeartors does not support negative indexes for replicate and generation numbers. """ _simuPOP_la.IfElse_swiginit(self,_simuPOP_la.new_IfElse(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_IfElse IfElse_swigregister = _simuPOP_la.IfElse_swigregister IfElse_swigregister(IfElse) class TerminateIf(BaseOperator): """ Details: This operator evaluates an expression in a population's local namespace and terminate the evolution of this population, or the whole simulator, if the return value of this expression is True. Termination caused by an operator will stop the execution of all operators after it. The generation at which the population is terminated will be counted in the evolved generations (return value from Simulator::evolve) if termination happens after mating. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: TerminateIf(condition="", stopAll=False, message="", output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a terminator with an expression condition, which will be evalulated in a population's local namespace when the operator is applied to this population. If the return value of condition is True, the evolution of the population will be terminated. If stopAll is set to True, the evolution of all replicates of the simulator will be terminated. If this operator is allowed to write to an output (default to ""), the generation number, proceeded with an optional message. """ _simuPOP_la.TerminateIf_swiginit(self,_simuPOP_la.new_TerminateIf(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_TerminateIf TerminateIf_swigregister = _simuPOP_la.TerminateIf_swigregister TerminateIf_swigregister(TerminateIf) class DiscardIf(BaseOperator): """ Details: This operator discards individuals according to either an expression that evaluates according to individual information field, or a Python function that accepts individual and its information fields. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: DiscardIf(cond, exposeInd="", output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that discard individuals according to an expression or the return value of a Python function (parameter cond). This operator can be applied to a population before or after mating, or to offspring during mating. If an expression is passed to cond, it will be evalulated with each individual's information fields (see operator InfoEval for details). If exposeInd is non-empty, individuals will be available for evaluation in the expression as an variable with name spacied by exposeInd. If the expression is evaluated to be True, individuals (if applied before or after mating) or offspring (if applied during mating) will be removed or discard. If a function is passed to cond, it should accept paramters ind and pop or names of information fields when it is applied to a population (pre or post mating), or parameters off, dad, mom, pop (parental population), or names of information fields if the operator is applied during mating. Individuals will be discarded if this function returns True. A constant expression (e.g. True) is also acceptable). Because this operator supports parameter subPops, only individuals belonging to specified (virtual) subpopulations will be screened. """ _simuPOP_la.DiscardIf_swiginit(self,_simuPOP_la.new_DiscardIf(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_DiscardIf DiscardIf_swigregister = _simuPOP_la.DiscardIf_swigregister DiscardIf_swigregister(DiscardIf) class TicToc(BaseOperator): """ Details: This operator, when called, output the difference between current and the last called clock time. This can be used to estimate execution time of each generation. Similar information can also be obtained from turnOnDebug("DBG_PROFILE"), but this operator has the advantage of measuring the duration between several generations by setting step parameter. As an advanced feature that mainly used for performance testing, this operator accepts a parameter stopAfter (seconds), and will stop the evolution of a population if the overall time exceeds stopAfter. Note that elapsed time is only checked when this operator is applied to a population so it might not be able to stop the evolution process right after stopAfter seconds. This operator can also be applied during mating. Note that to avoid excessive time checking, this operator does not always check system time accurately. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: TicToc(output=">", stopAfter=0, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a TicToc operator that outputs the elapsed since the last time it was applied, and the overall time since the first time this operator is applied. """ _simuPOP_la.TicToc_swiginit(self,_simuPOP_la.new_TicToc(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_TicToc TicToc_swigregister = _simuPOP_la.TicToc_swigregister TicToc_swigregister(TicToc) class PyOperator(BaseOperator): """ Details: An operator that calls a user-defined function when it is applied to a population (pre- or post-mating) or offsprings (during- mating). The function can have have parameters pop when the operator is applied pre- or post-mating, pop, off, dad, mom when the operator is applied during-mating. An optional parameter can be passed if parameter param is given. In the during-mating case, parameters pop, dad and mom can be ignored if offspringOnly is set to True. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyOperator(func, param=None, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a pure-Python operator that calls a user-defined function when it is applied. If this operator is applied before or after mating, your function should have form func(pop) or func(pop, param) where pop is the population to which the operator is applied, param is the value specified in parameter param. param will be ignored if your function only accepts one parameter. Althernatively, the function should have form func(ind) with optional parameters pop and param. In this case, the function will be called for all individuals, or individuals in subpopulations subPops. Individuals for which the function returns False will be removed from the population. This operator can therefore perform similar functions as operator DiscardIf. If this operator is applied during mating, your function should accept parameters pop, off (or ind), dad, mom and param where pop is the parental population, and off or ind, dad, and mom are offspring and their parents for each mating event, and param is an optional parameter. If subPops are provided, only offspring in specified (virtual) subpopulations are acceptable. This operator does not support parameters output, and infoFields. If certain output is needed, it should be handled in the user defined function func. Because the status of files used by other operators through parameter output is undetermined during evolution, they should not be open or closed in this Python operator. """ _simuPOP_la.PyOperator_swiginit(self,_simuPOP_la.new_PyOperator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyOperator PyOperator_swigregister = _simuPOP_la.PyOperator_swigregister PyOperator_swigregister(PyOperator) def applyDuringMatingOperator(*args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.applyDuringMatingOperator(*args, **kwargs) class OffspringGenerator(object): """ Details: An offspring generator generates offspring from parents chosen by a parent chooser. It is responsible for creating a certain number of offspring, determinning their sex, and transmitting genotypes from parents to offspring. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: OffspringGenerator(ops, numOffspring=1, sexMode=RANDOM_SEX) Details: Create a basic offspring generator. This offspring generator uses ops genotype transmitters to transmit genotypes from parents to offspring. A number of during-mating operators (parameter ops) can be used to, among other possible duties such as setting information fields of offspring, transmit genotype from parents to offspring. This general offspring generator does not have any default during-mating operator but all stock mating schemes use an offspring generator with a default operator. For example, a mendelianOffspringGenerator is used by RandomMating to trasmit genotypes. Note that applicability parameters begin, step, end, at and reps could be used in these operators but negative population and generation indexes are unsupported. Parameter numOffspring is used to control the number of offspring per mating event, or in another word the number of offspring in each family. It can be a number, a Python function or generator, or a mode parameter followed by some optional arguments. If a number is given, given number of offspring will be generated at each mating event. If a Python function is given, it will be called each time when a mating event happens. When a generator function is specified, it will be called for each subpopulation to provide number of offspring for all mating events during the populating of this subpopulation. Current generation number will be passed to this function or generator function if parameter "gen" is used in this function. In the last case, a tuple (or a list) in one of the following forms can be given: * (GEOMETRIC_DISTRIBUTION, p) * (POISSON_DISTRIBUTION, p), p > 0 * (BINOMIAL_DISTRIBUTION, p, N), 0 < p <=1, N > 0 * (UNIFORM_DISTRIBUTION, a, b), 0 <= a <= b. In this case, the number of offspring will be determined randomly following the specified statistical distributions. Because families with zero offspring are silently ignored, the distribution of the observed number of offspring per mating event (excluding zero) follows zero-truncated versions of these distributions. Parameter numOffspring specifies the number of offspring per mating event but the actual surviving offspring can be less than specified. More spefically, if any during-mating operator returns False, an offspring will be discarded so the actually number of offspring of a mating event will be reduced. This is essentially how during- mating selector works. Parameter sexMode is used to control the sex of each offspring. Its default value is usually RANDOM_SEX which assign MALE or FEMALE to each individual randomly, with equal probabilities. If NO_SEX is given, offspring sex will not be changed. sexMode can also be one of * (PROB_OF_MALES, p) where p is the probability of male for each offspring, * (NUM_OF_MALES, n) where n is the number of males in a mating event. If n is greater than or equal to the number of offspring in this family, all offspring in this family will be MALE. * (NUM_OF_FEMALES, n) where n is the number of females in a mating event, * (SEQUENCE_OF_SEX, s1, s2 ...) where s1, s2 etc are MALE or FEMALE. The sequence will be used for each mating event. It will be reused if the number of offspring in a mating event is greater than the length of sequence. * (GLOBAL_SEQUENCE_OF_SEX, s1, s2, ...) where s1, s2 etc are MALE or FEMALE. The sequence will be used across mating events. It will be reused if the number of offspring in a subpopulation is greater than the length of sequence. Finally, parameter sexMode accepts a function or a generator function. A function will be called whenever an offspring is produced. A generator will be created at each subpopulation and will be used to produce sex for all offspring in this subpopulation. No parameter is accepted. """ _simuPOP_la.OffspringGenerator_swiginit(self,_simuPOP_la.new_OffspringGenerator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_OffspringGenerator def clone(self): """Obsolete or undocumented function.""" return _simuPOP_la.OffspringGenerator_clone(self) def describe(self, format = True): """Obsolete or undocumented function.""" return _simuPOP_la.OffspringGenerator_describe(self, format) OffspringGenerator.clone = new_instancemethod(_simuPOP_la.OffspringGenerator_clone,None,OffspringGenerator) OffspringGenerator.describe = new_instancemethod(_simuPOP_la.OffspringGenerator_describe,None,OffspringGenerator) OffspringGenerator_swigregister = _simuPOP_la.OffspringGenerator_swigregister OffspringGenerator_swigregister(OffspringGenerator) class ControlledOffspringGenerator(OffspringGenerator): """ Details: This offspring generator populates an offspring population and controls allele frequencies at specified loci. At each generation, expected allele frequencies at these loci are passed from a user defined allele frequency trajectory function. The offspring population is populated in two steps. At the first step, only families with disease alleles are accepted until until the expected number of disease alleles are met. At the second step, only families with wide type alleles are accepted to populate the rest of the offspring generation. This method is described in detail in "Peng et al, (2007) PLoS Genetics". """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ControlledOffspringGenerator(loci, alleles, freqFunc, ops=[], numOffspring=1, sexMode=RANDOM_SEX) Details: Create an offspring generator that selects offspring so that allele frequency at specified loci in the offspring generation reaches specified allele frequency. At the beginning of each generation, expected allele frequency of alleles at loci is returned from a user-defined trajectory function freqFunc. Parameter loci can be a list of loci indexes, names, or ALL_AVAIL. If there is no subpopulation, this function should return a list of frequencies for each locus. If there are multiple subpopulations, freqFunc can return a list of allele frequencies for all subpopulations or combined frequencies that ignore population structure. In the former case, allele frequencies should be arranged by loc0_sp0, loc1_sp0, ... loc0_sp1, loc1_sp1, ..., and so on. In the latter case, overall expected number of alleles are scattered to each subpopulation in proportion to existing number of alleles in each subpopulation, using a multinomial distribution. After the expected alleles are calculated, this offspring generator accept and reject families according to their genotype at loci until allele frequecies reach their expected values. The rest of the offspring generation is then filled with families without only wild type alleles at these loci. This offspring generator is derived from class OffspringGenerator. Please refer to class OffspringGenerator for a detailed description of parameters ops, numOffspring and sexMode. """ _simuPOP_la.ControlledOffspringGenerator_swiginit(self,_simuPOP_la.new_ControlledOffspringGenerator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ControlledOffspringGenerator ControlledOffspringGenerator_swigregister = _simuPOP_la.ControlledOffspringGenerator_swigregister ControlledOffspringGenerator_swigregister(ControlledOffspringGenerator) class ParentChooser(object): """ Details: A parent chooser repeatedly chooses parent(s) from a parental population and pass them to an offspring generator. A parent chooser can select one or two parents, which should be matched by the offspring generator. This class is the base class of all parent choosers, and should not be used directly. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ParentChooser(selectionField="") """ _simuPOP_la.ParentChooser_swiginit(self,_simuPOP_la.new_ParentChooser(*args, **kwargs)) def clone(self): """Obsolete or undocumented function.""" return _simuPOP_la.ParentChooser_clone(self) def describe(self, format = True): """Obsolete or undocumented function.""" return _simuPOP_la.ParentChooser_describe(self, format) __swig_destroy__ = _simuPOP_la.delete_ParentChooser ParentChooser.clone = new_instancemethod(_simuPOP_la.ParentChooser_clone,None,ParentChooser) ParentChooser.describe = new_instancemethod(_simuPOP_la.ParentChooser_describe,None,ParentChooser) ParentChooser_swigregister = _simuPOP_la.ParentChooser_swigregister ParentChooser_swigregister(ParentChooser) class SequentialParentChooser(ParentChooser): """ Details: This parent chooser chooses a parent from a parental (virtual) subpopulation sequentially. Natural selection is not considered. If the last parent is reached, this parent chooser will restart from the beginning of the (virtual) subpopulation. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SequentialParentChooser(sexChoice=ANY_SEX) Details: Create a parent chooser that chooses a parent from a parental (virtual) subpopulation sequentially. Parameter choice can be ANY_SEX (default), MALE_ONLY and FEMALE_ONLY. In the latter two cases, only male or female individuals are selected. A RuntimeError will be raised if there is no male or female individual from the population. """ _simuPOP_la.SequentialParentChooser_swiginit(self,_simuPOP_la.new_SequentialParentChooser(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SequentialParentChooser SequentialParentChooser_swigregister = _simuPOP_la.SequentialParentChooser_swigregister SequentialParentChooser_swigregister(SequentialParentChooser) class RandomParentChooser(ParentChooser): """ Details: This parent chooser chooses a parent randomly from a (virtual) parental subpopulation. Parents are chosen with or without replacement. If parents are chosen with replacement, a parent can be selected multiple times. If individual fitness values are assigned to individuals ( stored in an information field selectionField (default to "fitness"), individuals will be chosen at a probability proportional to his or her fitness value. If parents are chosen without replacement, a parent can be chosen only once. An RuntimeError will be raised if all parents are exhausted. Natural selection is disabled in the without- replacement case. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: RandomParentChooser(replacement=True, selectionField="fitness", sexChoice=ANY_SEX) Details: Create a random parent chooser that choose parents with or without replacement (parameter replacement, default to True). If selection is enabled and information field selectionField exists in the passed population, the probability that a parent is chosen is proportional to his/her fitness value stored in selectionField. This parent chooser by default chooses parent from all individuals (ANY_SEX), but it can be made to select only male (MALE_ONLY) or female (FEMALE_ONLY) individuals by setting parameter sexChoice. """ _simuPOP_la.RandomParentChooser_swiginit(self,_simuPOP_la.new_RandomParentChooser(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_RandomParentChooser RandomParentChooser_swigregister = _simuPOP_la.RandomParentChooser_swigregister RandomParentChooser_swigregister(RandomParentChooser) class RandomParentsChooser(ParentChooser): """ Details: This parent chooser chooses two parents, a male and a female, randomly from a (virtual) parental subpopulation. Parents are chosen with or without replacement from their respective sex group. If parents are chosen with replacement, a parent can be selected multiple times. If individual fitness values are assigned (stored in information field selectionField, default to "fitness", the probability that an individual is chosen is proportional to his/her fitness value among all individuals with the same sex. If parents are chosen without replacement, a parent can be chosen only once. An RuntimeError will be raised if all males or females are exhausted. Natural selection is disabled in the without- replacement case. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, replacement = True, selectionField = "fitness"): """ Usage: RandomParentsChooser(replacement=True, selectionField="fitness") Details: Create a random parents chooser that choose two parents with or without replacement (parameter replacement, default to True). If selection is enabled and information field selectionField exists in the passed population, the probability that a parent is chosen is proportional to his/her fitness value stored in selectionField. """ _simuPOP_la.RandomParentsChooser_swiginit(self,_simuPOP_la.new_RandomParentsChooser(replacement, selectionField)) __swig_destroy__ = _simuPOP_la.delete_RandomParentsChooser RandomParentsChooser_swigregister = _simuPOP_la.RandomParentsChooser_swigregister RandomParentsChooser_swigregister(RandomParentsChooser) class PolyParentsChooser(ParentChooser): """ Details: This parent chooser is similar to random parents chooser but instead of selecting a new pair of parents each time, one of the parents in this parent chooser will mate with several spouses before he/she is replaced. This mimicks multi-spouse mating schemes such as polygyny or polyandry in some populations. Natural selection is supported for both sexes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PolyParentsChooser(polySex=MALE, polyNum=1, selectionField="fitness") Details: Create a multi-spouse parents chooser where each father (if polySex is MALE) or mother (if polySex is FEMALE) has polyNum spouses. The parents are chosen with replacement. If individual fitness values are assigned (stored to information field selectionField, default to "fitness"), the probability that an individual is chosen is proportional to his/her fitness value among all individuals with the same sex. """ _simuPOP_la.PolyParentsChooser_swiginit(self,_simuPOP_la.new_PolyParentsChooser(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PolyParentsChooser PolyParentsChooser_swigregister = _simuPOP_la.PolyParentsChooser_swigregister PolyParentsChooser_swigregister(PolyParentsChooser) class CombinedParentsChooser(ParentChooser): """ Details: This parent chooser accepts two parent choosers. It takes one parent from each parent chooser and return them as father and mother. Because two parent choosers do not have to choose parents from the same virtual subpopulation, this parent chooser allows you to choose parents from different subpopulations. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: CombinedParentsChooser(fatherChooser, motherChooser) Details: Create a Python parent chooser using two parent choosers fatherChooser and motherChooser. It takes one parent from each parent chooser and return them as father and mother. If two valid parents are returned, the first valid parent (father) will be used for fatherChooser, the second valid parent (mother) will be used for motherChooser. Although these two parent choosers are supposed to return a father and a mother respectively, the sex of returned parents are not checked so it is possible to return parents with the same sex using this parents chooser. """ _simuPOP_la.CombinedParentsChooser_swiginit(self,_simuPOP_la.new_CombinedParentsChooser(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_CombinedParentsChooser CombinedParentsChooser_swigregister = _simuPOP_la.CombinedParentsChooser_swigregister CombinedParentsChooser_swigregister(CombinedParentsChooser) class PyParentsChooser(ParentChooser): """ Details: This parent chooser accepts a Python generator function that repeatedly yields one or two parents, which can be references to individual objects or indexes relative to each subpopulation. The parent chooser calls the generator function with parental population and a subpopulation index for each subpopulation and retrieves parents repeatedly using the iterator interface of the generator function. This parent chooser does not support virtual subpopulation directly. However, because virtual subpopulations are defined in the passed parental population, it is easy to return parents from a particular virtual subpopulation using virtual subpopulation related functions. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyParentsChooser(generator) Details: Create a Python parent chooser using a Python generator function parentsGenerator. This function should accept one or both of parameters pop (the parental population) and subPop (index of subpopulation) and return the reference or index (relative to subpopulation) of a parent or a pair of parents repeatedly using the iterator interface of the generator function. """ _simuPOP_la.PyParentsChooser_swiginit(self,_simuPOP_la.new_PyParentsChooser(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyParentsChooser PyParentsChooser_swigregister = _simuPOP_la.PyParentsChooser_swigregister PyParentsChooser_swigregister(PyParentsChooser) class MatingScheme(object): """ Details: This mating scheme is the base class of all mating schemes. It evolves a population generation by generation but does not actually transmit genotype. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MatingScheme(subPopSize=[]) Details: Create a base mating scheme that evolves a population without transmitting genotypes. At each generation, this mating scheme creates an offspring generation according to parameter subPopSize, which can be a list of subpopulation sizes (or a number if there is only one subpopulation) or a Python function which will be called at each generation, just before mating, to determine the subpopulation sizes of the offspring generation. The function should be defined with one or both parameters of gen and pop where gen is the current generation number and pop is the parental population just before mating. The return value of this function should be a list of subpopulation sizes for the offspring generation. A single number can be returned if there is only one subpopulation. The passed parental population is usually used to determine offspring population size from parental population size but you can also modify this population to prepare for mating. A common practice is to split and merge parental populations in this function so that you demographic related information and actions could be implemented in the same function. """ _simuPOP_la.MatingScheme_swiginit(self,_simuPOP_la.new_MatingScheme(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MatingScheme def clone(self): """Obsolete or undocumented function.""" return _simuPOP_la.MatingScheme_clone(self) def describe(self, format = True): """Obsolete or undocumented function.""" return _simuPOP_la.MatingScheme_describe(self, format) MatingScheme.clone = new_instancemethod(_simuPOP_la.MatingScheme_clone,None,MatingScheme) MatingScheme.describe = new_instancemethod(_simuPOP_la.MatingScheme_describe,None,MatingScheme) MatingScheme_swigregister = _simuPOP_la.MatingScheme_swigregister MatingScheme_swigregister(MatingScheme) class HomoMating(MatingScheme): """ Details: A homogeneous mating scheme that uses a parent chooser to choose parents from a prental generation, and an offspring generator to generate offspring from chosen parents. It can be either used directly, or within a heterogeneous mating scheme. In the latter case, it can be applied to a (virtual) subpopulation. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: HomoMating(chooser, generator, subPopSize=[], subPops=ALL_AVAIL, weight=0) Details: Create a homogeneous mating scheme using a parent chooser chooser and an offspring generator generator. If this mating scheme is used directly in a simulator, it will be responsible for creating an offspring population according to parameter subPopSize. This parameter can be a list of subpopulation sizes (or a number if there is only one subpopulation) or a Python function which will be called at each generation to determine the subpopulation sizes of the offspring generation. Please refer to class MatingScheme for details about this parameter. If this mating shcme is used within a heterogeneous mating scheme. Parameters subPops and weight are used to determine which (virtual) subpopulations this mating scheme will be applied to, and how many offspring this mating scheme will produce. Please refer to mating scheme HeteroMating for the use of these two parameters. """ _simuPOP_la.HomoMating_swiginit(self,_simuPOP_la.new_HomoMating(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_HomoMating HomoMating_swigregister = _simuPOP_la.HomoMating_swigregister HomoMating_swigregister(HomoMating) class PedigreeMating(MatingScheme): """ Details: This mating scheme evolves a population following an existing pedigree structure. If the Pedigree object has N ancestral generations and a present generation, it can be used to evolve a population for N generations, starting from the topmost ancestral generation. At the k-th generation, this mating scheme produces an offspring generation according to subpopulation structure of the N-k-1 ancestral generation in the pedigree object (e.g. producing the offspring population of generation 0 according to the N-1 ancestral generation of the pedigree object ). For each offspring, this mating scheme copies individual ID and sex from the corresponing individual in the pedigree object. It then locates the parents of each offspring using their IDs in the pedigree object. A list of during mating operators are then used to transmit parental genotype to the offspring. The population being evolved must have an information field 'ind_id'. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PedigreeMating(ped, ops, idField="ind_id") Details: Creates a pedigree mating scheme that evolves a population according to Pedigree object ped. The evolved population should contain individuals with ID (at information field idField, default to 'ind_id') that match those individual in the topmost ancestral generation who have offspring. After parents of each individuals are determined from their IDs, a list of during-mating operators ops are applied to transmit genotypes. The return value of these operators are not checked. """ _simuPOP_la.PedigreeMating_swiginit(self,_simuPOP_la.new_PedigreeMating(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PedigreeMating PedigreeMating_swigregister = _simuPOP_la.PedigreeMating_swigregister PedigreeMating_swigregister(PedigreeMating) class HeteroMating(MatingScheme): """ Details: A heterogeneous mating scheme that applies a list of homogeneous mating schemes to different (virtual) subpopulations. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: HeteroMating(matingSchemes, subPopSize=[], shuffleOffspring=True) Details: Create a heterogeneous mating scheme that will apply a list of homogeneous mating schemes matingSchemes to different (virtual) subpopulations. The size of the offspring generation is determined by parameter subPopSize, which can be a list of subpopulation sizes or a Python function that returns a list of subpopulation sizes at each generation. Please refer to class MatingScheme for a detailed explanation of this parameter. Each mating scheme defined in matingSchemes can be applied to one or more (virtual) subpopulation. If parameter subPops is not specified, a mating scheme will be applied to all subpopulations. If a list of (virtual) subpopulation is specified, the mating scheme will be applied to specific (virtual) subpopulations. If multiple mating schemes are applied to the same subpopulation, a weight (parameter weight) can be given to each mating scheme to determine how many offspring it will produce. The default for all mating schemes are 0. In this case, the number of offspring each mating scheme produces is proportional to the size of its parental (virtual) subpopulation. If all weights are negative, the numbers of offspring are determined by the multiplication of the absolute values of the weights and their respective parental (virtual) subpopulation sizes. If all weights are positive, the number of offspring produced by each mating scheme is proportional to these weights. Mating schemes with zero weight in this case will produce no offspring. If both negative and positive weights are present, negative weights are processed before positive ones. If multiple mating schemes are applied to the same subpopulation, offspring produced by these mating schemes are shuffled randomly. If this is not desired, you can turn off offspring shuffling by setting parameter shuffleOffspring to False. """ _simuPOP_la.HeteroMating_swiginit(self,_simuPOP_la.new_HeteroMating(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_HeteroMating HeteroMating_swigregister = _simuPOP_la.HeteroMating_swigregister HeteroMating_swigregister(HeteroMating) class pyPopIterator(object): """ Details: This class implements a Python itertor class that can be used to iterate through populations in a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: pyPopIterator(begin, end) """ _simuPOP_la.pyPopIterator_swiginit(self,_simuPOP_la.new_pyPopIterator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_pyPopIterator def next(self): """ Usage: x.__next__() """ return _simuPOP_la.pyPopIterator_next(self) pyPopIterator.__iter__ = new_instancemethod(_simuPOP_la.pyPopIterator___iter__,None,pyPopIterator) pyPopIterator.next = new_instancemethod(_simuPOP_la.pyPopIterator_next,None,pyPopIterator) pyPopIterator.__next__ = new_instancemethod(_simuPOP_la.pyPopIterator___next__,None,pyPopIterator) pyPopIterator_swigregister = _simuPOP_la.pyPopIterator_swigregister pyPopIterator_swigregister(pyPopIterator) class Simulator(object): """ Details: A simuPOP simulator is responsible for evolving one or more populations forward in time, subject to various operators. Populations in a simulator are created from one or more replicates of specified populations. A number of functions are provided to access and manipulate populations, and most importantly, to evolve them. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Simulator(pops, rep=1, stealPops=True) Details: Create a simulator with rep (default to 1) replicates of populations pops, which is a list of populations although a single population object is also acceptable. Contents of passed populations are by default moved to the simulator to avoid duplication of potentially large population objects, leaving empty populations behind. This behavior can be changed by setting stealPops to False, in which case populations are copied to the simulator. """ _simuPOP_la.Simulator_swiginit(self,_simuPOP_la.new_Simulator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Simulator def clone(self): """ Usage: x.clone() Details: Clone a simulator, along with all its populations. Note that Python assign statement simu1 = simu only creates a symbolic link to an existing simulator. """ return _simuPOP_la.Simulator_clone(self) def numRep(self): """ Usage: x.numRep() Details: Return the number of replicates. """ return _simuPOP_la.Simulator_numRep(self) def population(self, *args, **kwargs): """ Usage: x.population(rep) Details: Return a reference to the rep-th population of a simulator. The reference will become invalid once the simulator starts evolving or becomes invalid (removed). If an independent copy of the population is needed, you can use population.clone() to create a cloned copy or simulator.extract() to remove the population from the simulator. """ return _simuPOP_la.Simulator_population(self, *args, **kwargs) def add(self, *args, **kwargs): """ Usage: x.add(pop, stealPop=True) Details: Add a population pop to the end of an existing simulator. This function by default moves pop to the simulator, leaving an empty population for passed population object. If steal is set to False, the population will be copied to the simulator, and thus unchanged. """ return _simuPOP_la.Simulator_add(self, *args, **kwargs) def extract(self, *args, **kwargs): """ Usage: x.extract(rep) Details: Extract the rep-th population from a simulator. This will reduce the number of populations in this simulator by one. """ return _simuPOP_la.Simulator_extract(self, *args, **kwargs) def populations(self): """ Usage: x.populations() Details: Return a Python iterator that can be used to iterate through all populations in a simulator. """ return _simuPOP_la.Simulator_populations(self) def evolve(self, *args, **kwargs): """ Usage: x.evolve(initOps=[], preOps=[], matingScheme=MatingScheme, postOps=[], finalOps=[], gen=-1, dryrun=False) Details: Evolve all populations gen generations, subject to several lists of operators which are applied at different stages of an evolutionary process. Operators initOps are applied to all populations (subject to applicability restrictions of the operators, imposed by the rep parameter of these operators) before evolution. They are used to initialize populations before evolution. Operators finalOps are applied to all populations after the evolution. Operators preOps, and postOps are applied during the life cycle of each generation. These operators can be applied at all or some of the generations, to all or some of the evolving populations, depending the begin, end, step, at and reps parameters of these operators. These operators are applied in the order at which they are specified. populations in a simulator are evolved one by one. At each generation, operators preOps are applied to the parental generations. A mating scheme is then used to populate an offspring generation. For each offspring, his or her sex is determined before during-mating operators of the mating scheme are used to transmit parental genotypes. After an offspring generation is successfully generated and becomes the current generation, operators postOps are applied to the offspring generation. If any of the preOps and postOps fails (return False), the evolution of a population will be stopped. The generation number of a population, which is the variable "gen" in each populations local namespace, is increased by one if an offspring generation has been successfully populated even if a post-mating operator fails. Another variable "rep" will also be set to indicate the index of each population in the simulator. Note that populations in a simulator does not have to have the same generation number. You could reset a population's generation number by changing this variable. Parameter gen can be set to a positive number, which is the number of generations to evolve. If a simulator starts at the beginning of a generation g (for example 0), a simulator will stop at the beginning (instead of the end) of generation g + gen (for example gen). If gen is negative (default), the evolution will continue indefinitely, until all replicates are stopped by operators that return False at some point (these operators are called terminators). At the end of the evolution, the generations that each replicates have evolved are returned. Note that finalOps are applied to all applicable population, including those that have stopped before others. If parameter dryrun is set to True, this function will print a description of the evolutionary process generated by function describeEvolProcess() and exits. """ return _simuPOP_la.Simulator_evolve(self, *args, **kwargs) def vars(self, *args, **kwargs): """ Usage: x.vars(rep, subPop=[]) Details: Return the local namespace of the rep-th population, equivalent to x.Population(rep).vars(subPop). """ return _simuPOP_la.Simulator_vars(self, *args, **kwargs) Simulator.clone = new_instancemethod(_simuPOP_la.Simulator_clone,None,Simulator) Simulator.numRep = new_instancemethod(_simuPOP_la.Simulator_numRep,None,Simulator) Simulator.population = new_instancemethod(_simuPOP_la.Simulator_population,None,Simulator) Simulator.add = new_instancemethod(_simuPOP_la.Simulator_add,None,Simulator) Simulator.extract = new_instancemethod(_simuPOP_la.Simulator_extract,None,Simulator) Simulator.populations = new_instancemethod(_simuPOP_la.Simulator_populations,None,Simulator) Simulator.evolve = new_instancemethod(_simuPOP_la.Simulator_evolve,None,Simulator) Simulator.vars = new_instancemethod(_simuPOP_la.Simulator_vars,None,Simulator) Simulator.__cmp__ = new_instancemethod(_simuPOP_la.Simulator___cmp__,None,Simulator) Simulator_swigregister = _simuPOP_la.Simulator_swigregister Simulator_swigregister(Simulator) def describeEvolProcess(*args, **kwargs): """ Usage: describeEvolProcess(initOps=[], preOps=[], matingScheme=MatingScheme, postOps=[], finalOps=[], gen=-1, numRep=1) Details: This function takes the same parameters as Simulator.evolve and output a description of how an evolutionary process will be executed. It is recommended that you call this function if you have any doubt how your simulation will proceed. """ return _simuPOP_la.describeEvolProcess(*args, **kwargs) class PyEval(BaseOperator): """ Details: A PyEval operator evaluates a Python expression in a population's local namespace when it is applied to this population. The result is written to an output specified by parameter output. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyEval(expr="", stmts="", exposePop="", output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a PyEval operator that evaluates a Python expression expr in a population's local namespace when it is applied to this population. If Python statements stmts is given (a single or multi-line string), the statement will be executed before expr. If exposePop is set to an non-empty string, the current population will be exposed in its own local namespace as a variable with this name. This allows the execution of expressions such as 'pop.individual(0).allele(0)'. The result of expr will be sent to an output stream specified by parameter output. The exposed population variable will be removed after expr is evaluated. Please refer to class BaseOperator for other parameters. Note: Although the statements and expressions are evaluated in a population's local namespace, they have access to a global namespace which is the module global namespace. It is therefore possible to refer to any module variable in these expressions. Such mixed use of local and global variables is, however, strongly discouraged. """ _simuPOP_la.PyEval_swiginit(self,_simuPOP_la.new_PyEval(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyEval def evaluate(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.PyEval_evaluate(self, *args, **kwargs) PyEval.evaluate = new_instancemethod(_simuPOP_la.PyEval_evaluate,None,PyEval) PyEval_swigregister = _simuPOP_la.PyEval_swigregister PyEval_swigregister(PyEval) class PyExec(PyEval): """ Details: This operator executes given Python statements in a population's local namespace when it is applied to this population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyExec(stmts="", exposePop="", output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a PyExec operator that executes statements stmts in a population's local namespace when it is applied to this population. If exposePop is given, current population will be exposed in its local namespace as a variable named by exposePop. Although multiple statements can be executed, it is recommended that you use this operator to execute short statements and use PyOperator for more complex once. Note that exposed population variables will be removed after the statements are executed. """ _simuPOP_la.PyExec_swiginit(self,_simuPOP_la.new_PyExec(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyExec PyExec_swigregister = _simuPOP_la.PyExec_swigregister PyExec_swigregister(PyExec) class InfoEval(BaseOperator): """ Details: Unlike operator PyEval and PyExec that work at the population level, in a population's local namespace, operator InfoEval works at the individual level, working with individual information fields. When this operator is applied to a population, information fields of eligible individuals are put into the local namespace of the population. A Python expression is then evaluated for each individual. The result is written to an output. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InfoEval(expr="", stmts="", usePopVars=False, exposeInd="", output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that evaluate a Python expression expr using individual information fields and population variables as variables. If exposeInd is not empty, the individual itself will be exposed in the population's local namespace as a variable with name specified by exposeInd. A Python expression (expr) is evaluated for each individual. The results are converted to strings and are written to an output specified by parameter output. Optionally, a statement (or several statements separated by newline) can be executed before expr is evaluated. The evaluation of this statement may change the value of information fields. This operator is by default applied post-mating. If it stage is set to DuringMating, it will be applied to all offspring, regardless of subPops settings. Parameter usePopVars is obsolete because population variables are always usable in such expressions. """ _simuPOP_la.InfoEval_swiginit(self,_simuPOP_la.new_InfoEval(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InfoEval InfoEval_swigregister = _simuPOP_la.InfoEval_swigregister InfoEval_swigregister(InfoEval) class InfoExec(InfoEval): """ Details: Operator InfoExec is similar to InfoEval in that it works at the individual level, using individual information fields as variables. This is usually used to change the value of information fields. For example, "b=a*2" will set the value of information field b to a*a for all individuals. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InfoExec(stmts="", usePopVars=False, exposeInd="", output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that executes Python statements stmts using individual information fields and population variables as variables. If exposeInd is not empty, the individual itself will be exposed in the population's local namespace as a variable with name specified by exposeInd. One or more python statements (stmts) are executed for each individual. Information fields of these individuals are then updated from the corresponding variables. For example, a=1 will set information field a of all individuals to 1, a=b will set information field a of all individuals to information field b or a population variable b if b is not an information field but a population variable, and a=ind.sex() will set information field a of all individuals to its sex (needs exposeInd='ind'. This operator is by default applied post-mating. If it stage is set to DuringMating, it will be applied to all offspring, regardless of subPops settings. Parameter usePopVars is obsolete because population variables will always be usable. """ _simuPOP_la.InfoExec_swiginit(self,_simuPOP_la.new_InfoExec(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InfoExec InfoExec_swigregister = _simuPOP_la.InfoExec_swigregister InfoExec_swigregister(InfoExec) class Stat(BaseOperator): """ Details: Operator Stat calculates various statistics of the population being applied and sets variables in its local namespace. Other operators or functions can retrieve results from or evalulate expressions in this local namespace after Stat is applied. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Stat(popSize=False, numOfMales=False, numOfAffected=False, alleleFreq=[], heteroFreq=[], homoFreq=[], genoFreq=[], haploFreq=[], sumOfInfo=[], meanOfInfo=[], varOfInfo=[], maxOfInfo=[], minOfInfo=[], LD=[], association=[], neutrality=[], structure=[], HWE=[], vars=ALL_AVAIL, suffix="", output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Stat operator that calculates specified statistics of a population when it is applied to this population. This operator is by default applied after mating (parameter stage) and can be applied to specified replicates (parameter rep) at specified generations (parameter begin, end, step, and at). This operator does not produce any output (ignore parameter output) after statistics are calculated. Instead, it stores results in the local namespace of the population being applied. Other operators can retrieve these variables or evalulate expression directly in this local namespace. Please refer to operator BaseOperator for a detailed explanation of these common operator parameters. Stat supports parameter subPops. It usually calculate the same set of statistics for all subpopulations (subPops=subPopList()). If a list of (virtual) subpopulations are specified, statistics for only specified subpopulations will be calculated. However, different statistics treat this parameter differently and it is very important to check its reference before you use subPops for any statistics. Calculated statistics are saved as variables in a population's local namespace. These variables can be numbers, lists or dictionaries and can be retrieved using functions Population.vars() or Population.dvars(). A special default dictionary (defdict) is used for dictionaries whose keys are determined dynamically. Accessing elements of such a dictionary with an invalid key will yield value 0 instead of a KeyError. If the same variables are calculated for one or more (virtual) subpopulation, the variables are stored in vars()['subPop'][sp]['var'] where sp is a subpopulation ID (sp) or a tuple of virtual subpopulation ID ((sp, vsp)). Population.vars(sp) and Population.dvars(sp) provide shortcuts to these variables. Operator Stat outputs a number of most useful variables for each type of statistic. For example, alleleFreq calculates both allele counts and allele frequencies and it by default sets variable alleleFreq (dvars().alleleFreq) for all or specified subpopulations. If this does not fit your need, you can use parameter vars to output additional parameters, or limit the output of existing parameters. More specifically, for this particular statistic, the available variables are 'alleleFreq', 'alleleNum', 'alleleFreq_sp' ('alleleFreq' in each subpopulation), and 'alleleNum_sp' ('alleleNum' in each subpopulation). You can set vars=['alleleNum_sp'] to output only subpopulation specific allele count. An optional suffix (parameter suffix) can be used to append a suffix to default parameter names. This parameter can be used, for example, to calculate and store the same statistics for different subpopulations (e.g. pairwise Fst). Operator Stat supports the following statistics: popSize: If popSize=True, number of individuals in all or specified subpopulations (parameter subPops) will be set to the following variables: * popSize (default): Number of individuals in all or specified subpopulations. Because subPops does not have to cover all individuals, it may not be the actual population size. * popSize_sp: Size of (virtual) subpopulation sp. * subPopSize (default): A list of (virtual) subpopulation sizes. This variable is easier to use than accessing popSize from each (virtual) subpopulation.numOfMales: If numOfMales=True, number of male individuals in all or specified (virtual) subpopulations will be set to the following variables: * numOfMales (default): Total number of male individuals in all or specified (virtual) subpopulations. * numOfFemales (default): Total number of female individuals in all or specified (virtual) subpopulations. * propOfMales: Proportion of male individuals. * propOfFemales: Proportion of female individuals. * numOfMales_sp: Number of male individuals in each (virtual) subpopulation. * numOfFemales_sp: Number of female individuals in each (virtual) subpopulation. * propOfMales_sp: Proportion of male individuals in each (virtual) subpopulation. * propOfFemales_sp: Proportion of female individuals in each (virtual) subpopulation.numOfAffected: If numOfAffected=True, number of affected individuals in all or specified (virtual) subpopulations will be set to the following variables: * numOfAffected (default): Total number of affected individuals in all or specified (virtual) subpopulations. * numOfUnaffected (default): Total number of unaffected individuals in all or specified (virtual) subpopulations. * propOfAffected: Proportion of affected individuals. * propOfUnaffected: Proportion of unaffected individuals. * numOfAffected_sp: Number of affected individuals in each (virtual) subpopulation. * numOfUnaffected_sp: Number of unaffected individuals in each (virtual) subpopulation. * propOfAffected_sp: Proportion of affected individuals in each (virtual) subpopulation. * propOfUnaffected_sp: Proportion of unaffected individuals in each (virtual) subpopulation.alleleFreq: This parameter accepts a list of loci (loci indexes, names, or ALL_AVAIL), at which allele frequencies will be calculated. This statistic outputs the following variables, all of which are dictionary (with loci indexes as keys) of default dictionaries (with alleles as keys). For example, alleleFreq[loc][a] returns 0 if allele a does not exist. * alleleFreq (default): alleleFreq[loc][a] is the frequency of allele a at locus for all or specified (virtual) subpopulations. * alleleNum (default): alleleNum[loc][a] is the number of allele a at locus for all or specified (virtual) subpopulations. * alleleFreq_sp: Allele frequency in each (virtual) subpopulation. * alleleNum_sp: Allele count in each (virtual) subpopulation.heteroFreq and homoFreq: These parameters accept a list of loci (by indexes or names), at which the number and frequency of homozygotes and/or heterozygotes will be calculated. These statistics are only available for diploid populations. The following variables will be outputted: * heteroFreq (default for parameter heteroFreq): A dictionary of proportion of heterozygotes in all or specified (virtual) subpopulations, with loci indexes as dictionary keys. * homoFreq (default for parameter homoFreq): A dictionary of proportion of homozygotes in all or specified (virtual) subpopulations. * heteroNum: A dictionary of number of heterozygotes in all or specified (virtual) subpopulations. * homoNum: A dictionary of number of homozygotes in all or specified (virtual) subpopulations. * heteroFreq_sp: A dictionary of proportion of heterozygotes in each (virtual) subpopulation. * homoFreq_sp: A dictionary of proportion of homozygotes in each (virtual) subpopulation. * heteroNum_sp: A dictionary of number of heterozygotes in each (virtual) subpopulation. * homoNum_sp: A dictionary of number of homozygotes in each (virtual) subpopulation.genoFreq: This parameter accept a list of loci (by indexes or names) at which number and frequency of all genotypes are outputed as a dictionary (indexed by loci indexes) of default dictionaries (indexed by tuples of possible indexes). This statistic is available for all population types with genotype defined as ordered alleles at a locus. The length of genotype equals the number of homologous copies of chromosomes (ploidy) of a population. Genotypes for males or females on sex chromosomes or in haplodiploid populations will have different length. Because genotypes are ordered, (1, 0) and (0, 1) (two possible genotypes in a diploid population) are considered as different genotypes. This statistic outputs the following variables: * genoFreq (default): A dictionary (by loci indexes) of default dictionaries (by genotype) of genotype frequencies. For example, genoFreq[1][(1, 0)] is the frequency of genotype (1, 0) at locus 1. * genoNum (default): A dictionary of default dictionaries of genotype counts of all or specified (virtual) subpopulations. * genoFreq_sp: genotype frequency in each specified (virtual) subpopulation. * genoFreq_sp: genotype count in each specified (virtual) subpopulation.haploFreq: This parameter accepts one or more lists of loci (by index) at which number and frequency of haplotypes are outputted as default dictionaries. [(1,2)] can be abbreviated to (1,2). For example, using parameter haploFreq=(1,2,4), all haplotypes at loci 1, 2 and 4 are counted. This statistic saves results to dictionary (with loci index as keys) of default dictionaries (with haplotypes as keys) such as haploFreq[(1,2,4)][(1,1,0)] (frequency of haplotype (1,1,0) at loci (1,2,3)). This statistic works for all population types. Number of haplotypes for each individual equals to his/her ploidy number. Haplodiploid populations are supported in the sense that the second homologous copy of the haplotype is not counted for male individuals. This statistic outputs the following variables: * haploFreq (default): A dictionary (with tuples of loci indexes as keys) of default dictionaries of haplotype frequencies. For example, haploFreq[(0, 1)][(1,1)] records the frequency of haplotype (1,1) at loci (0, 1) in all or specified (virtual) subpopulations. * haploNum (default): A dictionary of default dictionaries of haplotype counts in all or specified (virtual) subpopulations. * haploFreq_sp: Halptype frequencies in each (virtual) subpopulation. * haploNum_sp: Halptype count in each (virtual) subpopulation.sumOfinfo, meanOfInfo, varOfInfo, maxOfInfo and minOfInfo: Each of these five parameters accepts a list of information fields. For each information field, the sum, mean, variance, maximum or minimal (depending on the specified parameter(s)) of this information field at iddividuals in all or specified (virtual) subpopulations will be calculated. The results will be put into the following population variables: * sumOfInfo (default for sumOfInfo): A dictionary of the sum of specified information fields of individuals in all or specified (virtual) subpopulations. This dictionary is indexed by names of information fields. * meanOfInfo (default for meanOfInfo): A dictionary of the mean of information fields of all individuals. * varOfInfo (default for varOfInfo): A dictionary of the sample variance of information fields of all individuals. * maxOfInfo (default for maxOfInfo): A dictionary of the maximum value of information fields of all individuals. * minOfInfo (default for minOfInfo): A dictionary of the minimal value of information fields of all individuals. * sumOfInfo_sp: A dictionary of the sum of information fields of individuals in each subpopulation. * meanOfInfo_sp: A dictionary of the mean of information fields of individuals in each subpopulation. * varOfInfo_sp: A dictionary of the sample variance of information fields of individuals in each subpopulation. * maxOfInfo_sp: A dictionary of the maximum value of information fields of individuals in each subpopulation. * minOfInfo_sp: A dictionary of the minimal value of information fields of individuals in each subpopulation.LD: Parameter LD accepts one or a list of loci pairs (e.g. LD=[[0,1], [2,3]]) with optional primary alleles at both loci (e.g. LD=[0,1,0,0]). For each pair of loci, this operator calculates linkage disequilibrium and optional association statistics between two loci. When primary alleles are specified, signed linkage disequilibrium values are calculated with non-primary alleles are combined. Otherwise, absolute values of diallelic measures are combined to yield positive measure of LD. Association measures are calculated from a m by n contigency of haplotype counts (m=n=2 if primary alleles are specified). Please refer to the simuPOP user's guide for detailed information. This statistic sets the following variables: * LD (default) Basic LD measure for haplotypes in all or specified (virtual) subpopulations. Signed if primary alleles are specified. * LD_prime (default) Lewontin's D' measure for haplotypes in all or specified (virtual) subpopulations. Signed if primary alleles are specified. * R2 (default) Correlation LD measure for haplotypes in all or specified (virtual) subpopulations. * LD_ChiSq ChiSq statistics for a contigency table with frequencies of haplotypes in all or specified (virtual) subpopulations. * LD_ChiSq_p Single side p-value for the ChiSq statistic. Degrees of freedom is determined by number of alleles at both loci and the specification of primary alleles. * CramerV Normalized ChiSq statistics. * LD_sp Basic LD measure for haplotypes in each (virtual) subpopulation. * LD_prime_sp Lewontin's D' measure for haplotypes in each (virtual) subpopulation. * R2_sp R2 measure for haplotypes in each (virtual) subpopulation. * LD_ChiSq_sp ChiSq statistics for each (virtual) subpopulation. * LD_ChiSq_p_sp p value for the ChiSq statistics for each (virtual) subpopulation. * CramerV_sp Cramer V statistics for each (virtual) subpopulation.association: Parameter association accepts a list of loci, which can be a list of indexes, names, or ALL_AVAIL. At each locus, one or more statistical tests will be performed to test association between this locus and individual affection status. Currently, simuPOP provides the following tests: * An allele-based Chi-square test using alleles counts. This test can be applied to loci with more than two alleles, and to haploid populations. * A genotype-based Chi-square test using genotype counts. This test can be applied to loci with more than two alleles (more than 3 genotypes) in diploid populations. aA and Aa are considered to be the same genotype. * A genotype-based Cochran-Armitage trend test. This test can only be applied to diallelic loci in diploid populations. A codominant model is assumed. This statistic sets the following variables: * Allele_ChiSq A dictionary of allele-based Chi-Square statistics for each locus, using cases and controls in all or specified (virtual) subpopulations. * Allele_ChiSq_p (default) A dictionary of p-values of the corresponding Chi-square statistics. * Geno_ChiSq A dictionary of genotype-based Chi-Square statistics for each locus, using cases and controls in all or specified (virtual) subpopulations. * Geno_ChiSq_p A dictionary of p-values of the corresponding genotype-based Chi-square test. * Armitage_p A dictionary of p-values of the Cochran-Armitage tests, using cases and controls in all or specified (virtual) subpopulations. * Allele_ChiSq_sp A dictionary of allele-based Chi-Square statistics for each locus, using cases and controls from each subpopulation. * Allele_ChiSq_p_sp A dictionary of p-values of allele-based Chi-square tests, using cases and controls from each (virtual) subpopulation. * Geno_ChiSq_sp A dictionary of genotype-based Chi-Square tests for each locus, using cases and controls from each subpopulation. * Geno_ChiSq_p_sp A dictionary of p-values of genotype-based Chi-Square tests, using cases and controls from each subpopulation. * Armitage_p_sp A dictionary of p-values of the Cochran- Armitage tests, using cases and controls from each subpopulation.neutrality: This parameter performs neutrality tests (detection of natural selection) on specified loci, which can be a list of loci indexes, names or ALL_AVAIL. It currently only outputs Pi, which is the average number of pairwise difference between loci. This statistic outputs the following variables: * Pi Mean pairwise difference between all sequences from all or specified (virtual) subpopulations. * Pi_sp Mean paiewise difference between all sequences in each (virtual) subpopulation.structure: Parameter structure accepts a list of loci at which statistics that measure population structure are calculated. structure accepts a list of loci indexes, names or ALL_AVAIL. This parameter currently supports the following statistics: * Weir and Cockerham's Fst (1984). This is the most widely used estimator of Wright's fixation index and can be used to measure Population differentiation. However, this method is designed to estimate Fst from samples of larger populations and might not be appropriate for the calculation of Fst of large populations. * Nei's Gst (1973). The Gst estimator is another estimator for Wright's fixation index but it is extended for multi-allele (more than two alleles) and multi-loci cases. This statistics should be used if you would like to obtain a true Fst value of a large Population. * F_st (default) The WC84 Fst statistic estimated for all specified loci. * F_is The WC84 Fis statistic estimated for all specified loci. * F_it The WC84 Fit statistic estimated for all specified loci. * f_st A dictionary of locus level WC84 Fst values. * f_is A dictionary of locus level WC84 Fis values. * f_it A dictionary of locus level WC84 Fit values. * G_st Nei's Gst statistic estimated for all specified loci. * g_st A dictionary of Nei's Gst statistic estimated for each locus.HWE: Parameter HWE accepts a list of loci at which exact two-side tests for Hardy-Weinberg equilibrium will be performed. This statistic is only available for diallelic loci in diploid populations. HWE can be a list of loci indexes, names or ALL_AVAIL. This statistic outputs the following variables: * HWE (default) A dictionary of p-values of HWE tests using genotypes in all or specified (virtual) subpopulations. * HWE_sp A dictionary of p-values of HWS tests using genotypes in each (virtual) subpopulation. """ _simuPOP_la.Stat_swiginit(self,_simuPOP_la.new_Stat(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Stat Stat_swigregister = _simuPOP_la.Stat_swigregister Stat_swigregister(Stat) class PyOutput(BaseOperator): """ Details: This operator outputs a given string when it is applied to a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyOutput(msg="", output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Creates a PyOutput operator that outputs a string msg to output (default to standard terminal output) when it is applied to a population. Please refer to class BaseOperator for a detailed description of common operator parameters such as stage, begin and output. """ _simuPOP_la.PyOutput_swiginit(self,_simuPOP_la.new_PyOutput(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyOutput PyOutput_swigregister = _simuPOP_la.PyOutput_swigregister PyOutput_swigregister(PyOutput) class Dumper(BaseOperator): """ Details: This operator dumps the content of a population in a human readable format. Because this output format is not structured and can not be imported back to simuPOP, this operator is usually used to dump a small population to a terminal for demonstration and debugging purposes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Dumper(genotype=True, structure=True, ancGens=UNSPECIFIED, width=1, max=100, loci=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a operator that dumps the genotype structure (if structure is True) and genotype (if genotype is True) to an output ( default to standard terminal output). Because a population can be large, this operator will only output the first 100 (parameter max) individuals of the present generation (parameter ancGens). All loci will be outputed unless parameter loci are used to specify a subset of loci. If a list of (virtual) subpopulations are specified, this operator will only output individuals in these outputs. Please refer to class BaseOperator for a detailed explanation for common parameters such as output and stage. """ _simuPOP_la.Dumper_swiginit(self,_simuPOP_la.new_Dumper(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Dumper Dumper_swigregister = _simuPOP_la.Dumper_swigregister Dumper_swigregister(Dumper) class SavePopulation(BaseOperator): """ Details: An operator that save populations to specified files. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SavePopulation(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that saves a population to output when it is applied to the population. This operator supports all output specifications ('', 'filename', 'filename' prefixed by one or more '>' characters, and '!expr') but output from different operators will always replace existing files (effectively ignore '>' specification). Parameter subPops is ignored. Please refer to class BaseOperator for a detailed description about common operator parameters such as stage and begin. """ _simuPOP_la.SavePopulation_swiginit(self,_simuPOP_la.new_SavePopulation(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SavePopulation SavePopulation_swigregister = _simuPOP_la.SavePopulation_swigregister SavePopulation_swigregister(SavePopulation) class InitSex(BaseOperator): """ Details: This operator initializes sex of individuals, either randomly or use a list of sexes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InitSex(maleFreq=0.5, maleProp=-1, sex=[], begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that initializes individual sex to MALE or FEMALE. By default, it assigns sex to individuals randomly, with equal probability of having a male or a female. This probabability can be adjusted through parameter maleFreq or be made to exact proportions by specifying parameter maleProp. Alternatively, a fixed sequence of sexes can be assigned. For example, if sex=[MALE, FEMALE], individuals will be assigned MALE and FEMALE successively. Parameter maleFreq or maleProp are ignored if sex is given. If a list of (virtual) subpopulation is specified in parameter subPop, only individuals in these subpopulations will be initialized. Note that the sex sequence, if used, is assigned repeatedly regardless of (virtual) subpopulation boundaries so that you can assign sex to all individuals in a population. """ _simuPOP_la.InitSex_swiginit(self,_simuPOP_la.new_InitSex(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InitSex InitSex_swigregister = _simuPOP_la.InitSex_swigregister InitSex_swigregister(InitSex) class InitInfo(BaseOperator): """ Details: This operator initializes given information fields with a sequence of values, or a user-provided function such as random.random. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InitInfo(values, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator that initialize individual information fields infoFields using a sequence of values or a user-defined function. If a list of values are given, it will be used sequentially for all individuals. The values will be reused if its length is less than the number of individuals. The values will be assigned repeatedly regardless of subpopulation boundaries. If a Python function is given, it will be called, without any argument, whenever a value is needed. If a list of (virtual) subpopulation is specified in parameter subPop, only individuals in these subpopulations will be initialized. """ _simuPOP_la.InitInfo_swiginit(self,_simuPOP_la.new_InitInfo(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InitInfo InitInfo_swigregister = _simuPOP_la.InitInfo_swigregister InitInfo_swigregister(InitInfo) class InitGenotype(BaseOperator): """ Details: This operator assigns alleles at all or part of loci with given allele frequencies, proportions or values. This operator initializes all chromosomes, including unused genotype locations and customized chromosomes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InitGenotype(freq=[], genotype=[], prop=[], haplotypes=[], loci=ALL_AVAIL, ploidy=ALL_AVAIL, begin=0, end=1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: This function creates an initializer that initializes individual genotypes with random alleles or haplotypes with specified frequencies (parameter freq) or proportions (parameter prop). If parameter haplotypes is not specified, freq specifies the allele frequencies of alleles 0, 1, ... respectively. Alternatively, you can use parameter prop to specified the exact proportions of alleles 0, 1, ..., although alleles with small proportions might not be assigned at all. Values of parameter prob or prop should add up to 1. If parameter haplotypes is specified, it should contain a list of haplotypes and parameter prob or prop specifies frequencies or proportions of each haplotype. If loci, ploidy and/or subPop are specified, only specified loci, ploidy, and individuals in these (virtual) subpopulations will be initialized. Parameter loci can be a list of loci indexes, names or ALL_AVAIL. If the length of a haplotype is not enough to fill all loci, the haplotype will be reused. If a list (or a single) haplotypes are specified without freq or prop, they are used with equal probability. In the last case, if a sequence of genotype is specified, it will be uesd repeatedly to initialize all alleles sequentially. This works similar to function Population.setGenotype() except that you can limit the initialization to certain loci and ploidy. """ _simuPOP_la.InitGenotype_swiginit(self,_simuPOP_la.new_InitGenotype(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InitGenotype InitGenotype_swigregister = _simuPOP_la.InitGenotype_swigregister InitGenotype_swigregister(InitGenotype) class IdTagger(BaseOperator): """ Details: An IdTagger gives a unique ID for each individual it is applies to. These ID can be used to uniquely identify an individual in a multi-generational population and be used to reliably reconstruct a Pedigree. To ensure uniqueness across populations, a single source of ID is used for this operator. individual IDs are assigned consecutively starting from 1. Value 1 instead of 0 is used because most software applications use 0 as missing values for parentship. If you would like to reset the sequence or start from a different number, you can call the reset(startID) function of any IdTagger. An IdTagger is usually used during-mating to assign ID to each offspring. However, if it is applied directly to a population, it will assign unique IDs to all individuals in this population. This property is usually used in the preOps parameter of function Simulator.evolve to assign initial ID to a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: IdTagger(begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, output="", infoFields="ind_id") Details: Create an IdTagger that assign an unique ID for each individual it is applied to. The IDs are created sequentially and are stored in an information field specified in parameter infoFields (default to ind_id). This operator is considered a during-mating operator but it can be used to set ID for all individuals of a population when it is directly applied to the population. """ _simuPOP_la.IdTagger_swiginit(self,_simuPOP_la.new_IdTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_IdTagger def reset(self, startID = 1): """ Usage: x.reset(startID=1) Details: Reset the global individual ID number so that IdTaggers will start from id (default to 1) again. """ return _simuPOP_la.IdTagger_reset(self, startID) IdTagger.reset = new_instancemethod(_simuPOP_la.IdTagger_reset,None,IdTagger) IdTagger_swigregister = _simuPOP_la.IdTagger_swigregister IdTagger_swigregister(IdTagger) class InheritTagger(BaseOperator): """ Details: An inheritance tagger passes values of parental information field(s) to the corresponding fields of offspring. If there are two parental values from parents of a sexual mating event, a parameter mode is used to specify how to assign offspring information fields. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: InheritTagger(mode=PATERNAL, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, output="", infoFields=[]) Details: Creates an inheritance tagger that passes values of parental information fields (parameter infoFields) to the corresponding fields of offspring. If there is only one parent, values at the specified information fields are copied directly. If there are two parents, parameter mode specifies how to pass them to an offspring. More specifically, * mode=MATERNAL Passing the value from mother. * mode=PATERNAL Passing the value from father. * mode=MEAN Passing the average of two values. * mode=MAXIMUM Passing the maximum value of two values. * mode=MINIMUM Passing the minimum value of two values. * mode=SUMMATION Passing the summation of two values. * mode=MULTIPLICATION Passing the multiplication of two values. An RuntimeError will be raised if any of the parents does not exist. This operator does not support parameter subPops and does not output any information. """ _simuPOP_la.InheritTagger_swiginit(self,_simuPOP_la.new_InheritTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_InheritTagger InheritTagger_swigregister = _simuPOP_la.InheritTagger_swigregister InheritTagger_swigregister(InheritTagger) class SummaryTagger(BaseOperator): """ Details: A summary tagger summarize values of one or more parental information field to another information field of an offspring. If mating is sexual, two sets of parental values will be involved. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SummaryTagger(mode=MEAN, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, output="", infoFields=[]) Details: Creates a summary tagger that summarize values of one or more parental information field (infoFields[:-1]) to an offspring information field (infoFields[-1]). A parameter mode specifies how to pass summarize parental values. More specifically, * mode=MEAN Passing the average of values. * mode=MAXIMUM Passing the maximum value of values. * mode=Minumum Passing the minimum value of values. * mode=SUMMATION Passing the sum of values. * mode=MULTIPLICATION Passing the multiplication of values. This operator does not support parameter subPops and does not output any information. """ _simuPOP_la.SummaryTagger_swiginit(self,_simuPOP_la.new_SummaryTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SummaryTagger SummaryTagger_swigregister = _simuPOP_la.SummaryTagger_swigregister SummaryTagger_swigregister(SummaryTagger) class ParentsTagger(BaseOperator): """ Details: This tagging operator records the indexes of parents (relative to the parental generation) of each offspring in specified information fields ( default to father_idx and mother_idx). Only one information field should be specified if an asexsual mating scheme is used so there is one parent for each offspring. Information recorded by this operator is intended to be used to look up parents of each individual in multi-generational Population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ParentsTagger(begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, output="", infoFields=["father_idx", "mother_idx"]) Details: Create a parents tagger that records the indexes of parents of each offspring when it is applied to an offspring during-mating. If two information fields are specified (parameter infoFields, with default value ['father_idx', 'mother_idx']), they are used to record the indexes of each individual's father and mother. Value -1 will be assigned if any of the parent is missing. If only one information field is given, it will be used to record the index of the first valid parent (father if both parents are valid). This operator ignores parameters stage, output, and subPops. """ _simuPOP_la.ParentsTagger_swiginit(self,_simuPOP_la.new_ParentsTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ParentsTagger ParentsTagger_swigregister = _simuPOP_la.ParentsTagger_swigregister ParentsTagger_swigregister(ParentsTagger) class PedigreeTagger(BaseOperator): """ Details: This tagging operator records the ID of parents of each offspring in specified information fields (default to father_id and mother_id). Only one information field should be specified if an asexsual mating scheme is used so there is one parent for each offspring. Information recorded by this operator is intended to be used to record full pedigree information of an evolutionary process. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PedigreeTagger(idField="ind_id", output="", outputFields=[], outputLoci=[], begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=["father_id", "mother_id"]) Details: Create a pedigree tagger that records the ID of parents of each offspring when it is applied to an offspring during-mating. If two information fields are specified (parameter infoFields, with default value ['father_id', 'mother_id']), they are used to record the ID of each individual's father and mother stored in the idField (default to ind_id) field of the parents. Value -1 will be assigned if any of the parent is missing. If only one information field is given, it will be used to record the ID of the first valid parent (father if both pedigree are valid). This operator by default does not send any output. If a valid output stream is given (should be in the form of '>>filename' so that output will be concatenated), this operator will output the ID of offspring, IDs of his or her parent(s), sex and affection status of offspring, and values at specified information fields (outputFields) and loci (outputLoci) in the format of off_id father_id mother_id M/F A/U fields genotype. father_id or mother_id will be ignored if only one parent is involved. This file format can be loaded using function loadPedigree. Because only offspring will be outputed, individuals in the top-most ancestral generation will not be outputed. This is usually not a problem because individuals who have offspring in the next generation will be constructed by function loadPedigree, although their information fields and genotype will be missing. If you would like to create a file with complete pedigree information, you can apply this operator before evolution in the initOps parameter of functions Population.evolve or Simulator.evolve. This will output all individuals in the initial population (the top- most ancestral population after evolution) in the same format. Note that sex, affection status and genotype can be changed by other operators so this operator should usually be applied after all other operators are applied. """ _simuPOP_la.PedigreeTagger_swiginit(self,_simuPOP_la.new_PedigreeTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PedigreeTagger PedigreeTagger_swigregister = _simuPOP_la.PedigreeTagger_swigregister PedigreeTagger_swigregister(PedigreeTagger) class PyTagger(BaseOperator): """ Details: A Python tagger takes some information fields from both parents, pass them to a user provided Python function and set the offspring individual fields with the return values. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyTagger(func=None, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, output="", infoFields=[]) Details: Create a hybrid tagger that provides an user provided function func with values of specified information fields (determined by parameter names of this function) of parents and assign corresponding information fields of offspring with its return value. If more than one parent are available, maternal values are passed after paternal values. For example, if a function func(A, B) is passed, this operator will send two tuples with parental values of information fields 'A' and 'B' to this function and assign its return values to fields 'A' and 'B' of each offspring. The return value of this function should be a list, although a single value will be accepted if only one information field is specified. This operator ignores parameters stage, output and subPops. """ _simuPOP_la.PyTagger_swiginit(self,_simuPOP_la.new_PyTagger(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyTagger PyTagger_swigregister = _simuPOP_la.PyTagger_swigregister PyTagger_swigregister(PyTagger) class Migrator(BaseOperator): """ Details: This operator migrates individuals from (virtual) subpopulations to other subpopulations, according to either pre-specified destination subpopulation stored in an information field, or randomly according to a migration matrix. In the former case, values in a specified information field (default to migrate_to) are considered as destination subpopulation for each individual. If subPops is given, only individuals in specified (virtual) subpopulations will be migrated where others will stay in their original subpopulation. Negative values are not allowed in this information field because they do not represent a valid destination subpopulation ID. In the latter case, a migration matrix is used to randomly assign destination subpoulations to each individual. The elements in this matrix can be probabilities to migrate, proportions of individuals to migrate, or exact number of individuals to migrate. By default, the migration matrix should have m by m elements if there are m subpopulations. Element (i, j) in this matrix represents migration probability, rate or count from subpopulation i to j. If subPops (length m) and/or toSubPops (length n) are given, the matrix should have m by n elements, corresponding to specified source and destination subpopulations. Subpopulations in subPops can be virtual subpopulations, which makes it possible to migrate, for example, males and females at different rates from a subpopulation. If a subpopulation in toSubPops does not exist, it will be created. In case that all individuals from a subpopulation are migrated, the empty subpopulation will be kept. If migration is applied by probability, the row of the migration matrix corresponding to a source subpopulation is intepreted as probabilities to migrate to each destination subpopulation. Each individual's detination subpopulation is assigned randomly according to these probabilities. Note that the probability of staying at the present subpopulation is automatically calculated so the corresponding matrix elements are ignored. If migration is applied by proportion, the row of the migration matrix corresponding to a source subpopulation is intepreted as proportions to migrate to each destination subpopulation. The number of migrants to each destination subpopulation is determined before random indidividuals are chosen to migrate. If migration is applied by counts, the row of the migration matrix corresponding to a source subpopulation is intepreted as number of individuals to migrate to each detination subpopulation. The migrants are chosen randomly. This operator goes through all source (virtual) subpopulations and assign detination subpopulation of each individual to an information field. Unexpected results may happen if individuals migrate from overlapping virtual subpopulations. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Migrator(rate=[], mode=BY_PROBABILITY, toSubPops=ALL_AVAIL, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields="migrate_to") Details: Create a Migrator that moves individuals from source (virtual) subpopulations subPops (default to migrate from all subpopulations) to destination subpopulations toSubPops (default to all subpopulations), according to existing values in an information field infoFields[0], or randomly according to a migration matrix rate. In the latter case, the size of the matrix should match the number of source and destination subpopulations. Depending on the value of parameter mode, elements in the migration matrix (rate) are interpreted as either the probabilities to migrate from source to destination subpopulations (mode = BY_PROBABILITY), proportions of individuals in the source (virtual) subpopulations to the destination subpopulations (mode = BY_PROPORTION), numbers of migrants in the source (virtual) subpopulations (mode = BY_COUNTS), or ignored completely (mode = BY_IND_INFO). In the last case, parameter subPops is respected (only individuals in specified (virtual) subpopulations will migrate) but toSubPops is ignored. This operator is by default applied pre-mating (parameter stage). Please refer to operator BaseOperator for a detailed explanation for all parameters. """ _simuPOP_la.Migrator_swiginit(self,_simuPOP_la.new_Migrator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Migrator Migrator_swigregister = _simuPOP_la.Migrator_swigregister Migrator_swigregister(Migrator) class SplitSubPops(BaseOperator): """ Details: Split a given list of subpopulations according to either sizes of the resulting subpopulations, proportion of individuals, or an information field. The resulting subpopulations will have the same name as the original subpopulation. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SplitSubPops(subPops=ALL_AVAIL, sizes=[], proportions=[], names=[], randomize=True, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, infoFields=[]) Details: Split a list of subpopulations subPops into finer subpopulations. A single subpopulation is acceptable but virtual subpopulations are not allowed. All subpopulations will be split if subPops is not specified. The subpopulations can be split in three ways: * If parameter sizes is given, each subpopulation will be split into subpopulations with given size. The sizes should add up to the size of all orignal subpopulations. * If parameter proportions is given, each subpopulation will be split into subpopulations with corresponding proportion of individuals. proportions should add up to 1. * If an information field is given (parameter infoFields), individuals having the same value at this information field will be grouped into a subpopulation. The number of resulting subpopulations is determined by the number of distinct values at this information field. If parameter randomize is True (default), individuals will be randomized before a subpopulation is split. This is designed to remove artificial order of individuals introduced by, for example, some non- random mating schemes. Note that, however, the original individual order is not guaranteed even if this parameter is set to False. Unless the last subpopulation is split, the indexes of existing subpopulations will be changed. If a subpopulation has a name, this name will become the name for all subpopulations separated from this subpopulation. Optionally, you can assign names to the new subpopulations using a list of names specified in parameter names. Because the same set of names will be used for all subpopulations, this parameter is not recommended when multiple subpopulations are split. This operator is by default applied pre-mating (parameter stage). Please refer to operator BaseOperator for a detailed explanation for all parameters. Note: Unlike operator Migrator, this operator does not require an information field such as migrate_to. """ _simuPOP_la.SplitSubPops_swiginit(self,_simuPOP_la.new_SplitSubPops(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SplitSubPops SplitSubPops_swigregister = _simuPOP_la.SplitSubPops_swigregister SplitSubPops_swigregister(SplitSubPops) class MergeSubPops(BaseOperator): """ Details: This operator merges subpopulations subPops to a single subpopulation. If subPops is ignored, all subpopulations will be merged. Virtual subpopulations are not allowed in subPops. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MergeSubPops(subPops=ALL_AVAIL, name="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, infoFields=[]) Details: Create an operator that merges subpopulations subPops to a single subpopulation. If subPops is not given, all subpopulations will be merged. The merged subpopulation will take the name of the first subpopulation being merged unless a new name is given. This operator is by default applied pre-mating (parameter stage). Please refer to operator BaseOperator for a detailed explanation for all parameters. """ _simuPOP_la.MergeSubPops_swiginit(self,_simuPOP_la.new_MergeSubPops(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MergeSubPops MergeSubPops_swigregister = _simuPOP_la.MergeSubPops_swigregister MergeSubPops_swigregister(MergeSubPops) class ResizeSubPops(BaseOperator): """ Details: This operator resizes subpopulations to specified sizes. individuals are added or removed depending on the new subpopulation sizes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ResizeSubPops(subPops=ALL_AVAIL, sizes=[], proportions=[], propagate=True, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, infoFields=[]) Details: Resize given subpopulations subPops to new sizes size, or sizes proportional to original sizes (parameter proportions). All subpopulations will be resized if subPops is not specified. If the new size of a subpopulation is smaller than its original size, extra individuals will be removed. If the new size is larger, new individuals with empty genotype will be inserted, unless parameter propagate is set to True (default). In this case, existing individuals will be copied sequentially, and repeatedly if needed. This operator is by default applied pre-mating (parameter stage). Please refer to operator BaseOperator for a detailed explanation for all parameters. """ _simuPOP_la.ResizeSubPops_swiginit(self,_simuPOP_la.new_ResizeSubPops(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ResizeSubPops ResizeSubPops_swigregister = _simuPOP_la.ResizeSubPops_swigregister ResizeSubPops_swigregister(ResizeSubPops) class BaseMutator(BaseOperator): """ Details: Class mutator is the base class of all mutators. It handles all the work of picking an allele at specified loci from certain (virtual) subpopulation with certain probability, and calling a derived mutator to mutate the allele. Alleles can be changed before and after mutation if existing allele numbers do not match those of a mutation model. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: BaseMutator(rates=[], loci=ALL_AVAIL, mapIn=[], mapOut=[], context=0, output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: A mutator mutates alleles from one state to another with given probability. This base mutator does not perform any mutation but it defines common behaviors of all mutators. By default, a mutator mutates all alleles in all populations of a simulator at all generations. A number of parameters can be used to restrict mutations to certain generations (parameters begin, end, step and at), replicate populations (parameter rep), (virtual) subpopulations (parameter subPops) and loci (parameter loci). Parameter loci can be a list of loci indexes, names or ALL_AVAIL. Please refer to class BaseOperator for a detailed explanation of these parameters. Parameter rate or its equivalence specifies the probability that a a mutation event happens. The exact form and meaning of rate is mutator-specific. If a single rate is specified, it will be applied to all loci. If a list of mutation rates are given, they will be applied to each locus specified in parameter loci. Note that not all mutators allow specification of multiple mutation rate, especially when the mutation rate itself is a list or matrix. Alleles at a locus are non-negative numbers 0, 1, ... up to the maximum allowed allele for the loaded module (1 for binary, 255 for short and 65535 for long modules). Whereas some general mutation models treat alleles as numbers, other models assume specific interpretation of alleles. For example, an AcgtMutator assumes alleles 0, 1, 2 and 3 as nucleotides A, C, G and T. Using a mutator that is incompatible with your simulation will certainly yield erroneous results. If your simulation assumes different alleles with a mutation model, you can map an allele to the allele used in the model and map the mutated allele back. This is achieved using a mapIn list with its i-th item being the corresponding allele of real allele i, and a mapOut list with its i-th item being the real allele of allele i assumed in the model. For example mapIn=[0, 0, 1] and mapOut=[1, 2] would allow the use of a SNPMutator to mutate between alleles 1 and 2, instead of 0 and 1. Parameters mapIn and mapOut also accept a user-defined Python function that returns a corresponding allele for a given allele. This allows easier mapping between a large number of alleles and advanced models such as random emission of alleles. Some mutation models are context dependent. Namely, how an allele mutates will depend on its adjecent alleles. Whereas most simuPOP mutators are context independent, some of them accept a parameter context which is the number of alleles to the left and right of the mutated allele. For example context=1 will make the alleles to the immediate left and right to a mutated allele available to a mutator. These alleles will be mapped in if parameter mapIn is defined. How exactly a mutator makes use of these information is mutator dependent. """ _simuPOP_la.BaseMutator_swiginit(self,_simuPOP_la.new_BaseMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_BaseMutator BaseMutator_swigregister = _simuPOP_la.BaseMutator_swigregister BaseMutator_swigregister(BaseMutator) class MatrixMutator(BaseMutator): """ Details: A matrix mutator mutates alleles 0, 1, ..., n-1 using a n by n matrix, which specifies the probability at which each allele mutates to another. Conceptually speaking, this mutator goes through all mutable allele and mutate it to another state according to probabilities in the corresponding row of the rate matrix. Only one mutation rate matrix can be specified which will be used for all specified loci. # """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MatrixMutator(rate, loci=ALL_AVAIL, mapIn=[], mapOut=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a mutator that mutates alleles 0, 1, ..., n-1 using a n by n matrix rate. Item (i,j) of this matrix specifies the probability at which allele i mutates to allele j. Diagnal items (i, i) are ignored because they are automatically determined by other probabilities. Only one mutation rate matrix can be specified which will be used for all loci in the applied population, or loci specified by parameter loci. If alleles other than 0, 1, ..., n-1 exist in the population, they will not be mutated although a warning message will be given if debugging code DBG_WARNING is turned on. Please refer to classes mutator and BaseOperator for detailed explanation of other parameters. """ _simuPOP_la.MatrixMutator_swiginit(self,_simuPOP_la.new_MatrixMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MatrixMutator MatrixMutator_swigregister = _simuPOP_la.MatrixMutator_swigregister MatrixMutator_swigregister(MatrixMutator) class KAlleleMutator(BaseMutator): """ Details: This mutator implements a k-allele mutation model that assumes k allelic states (alleles 0, 1, 2, ..., k-1) at each locus. When a mutation event happens, it mutates an allele to any other states with equal probability. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: KAlleleMutator(k, rates=[], loci=ALL_AVAIL, mapIn=[], mapOut=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a k-allele mutator that mutates alleles to one of the other k-1 alleles with equal probability. This mutator by default applies to all loci unless parameter loci is specified. A single mutation rate will be used for all loci if a single value of parameter rates is given. Otherwise, a list of mutation rates can be specified for each locus in parameter loci. If the mutated allele is larger than or equal to k, it will not be mutated. A warning message will be displayed if debugging code DBG_WARNING is turned on. Please refer to classes mutator and BaseOperator for descriptions of other parameters. """ _simuPOP_la.KAlleleMutator_swiginit(self,_simuPOP_la.new_KAlleleMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_KAlleleMutator KAlleleMutator_swigregister = _simuPOP_la.KAlleleMutator_swigregister KAlleleMutator_swigregister(KAlleleMutator) class StepwiseMutator(BaseMutator): """ Details: A stepwise mutation model treats alleles at a locus as the number of tandem repeats of microsatellite or minisatellite markers. When a mutation event happens, the number of repeats (allele) either increase or decrease. A standard stepwise mutation model increases of decreases an allele by 1 with equal probability. More complex models (generalized stepwise mutation model) are also allowed. Note that an allele cannot be mutated beyond boundaries (0 and maximum allowed allele). """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: StepwiseMutator(rates=[], loci=ALL_AVAIL, incProb=0.5, maxAllele=0, mutStep=[], mapIn=[], mapOut=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a stepwise mutation mutator that mutates an allele by increasing or decreasing it. This mutator by default applies to all loci unless parameter loci is specified. A single mutation rate will be used for all loci if a single value of parameter rates is given. Otherwise, a list of mutation rates can be specified for each locus in parameter loci. When a mutation event happens, this operator increases or decreases an allele by mutStep steps. Acceptable input of parameter mutStep include * A number: This is the default mode with default value 1. * (GEOMETRIC_DISTRIBUTION, p): The number of steps follows a a geometric distribution with parameter p. * A Python function: This user defined function accepts the allele being mutated and return the steps to mutate. The mutation process is usually neutral in the sense that mutating up and down is equally likely. You can adjust parameter incProb to change this behavior. If you need to use other generalized stepwise mutation models, you can implement them using a PyMutator. If performance becomes a concern, I may add them to this operator if provided with a reliable reference. """ _simuPOP_la.StepwiseMutator_swiginit(self,_simuPOP_la.new_StepwiseMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_StepwiseMutator StepwiseMutator_swigregister = _simuPOP_la.StepwiseMutator_swigregister StepwiseMutator_swigregister(StepwiseMutator) class PyMutator(BaseMutator): """ Details: This hybrid mutator accepts a Python function that determines how to mutate an allele when an mutation event happens. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyMutator(rates=[], loci=ALL_AVAIL, func=None, context=0, mapIn=[], mapOut=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a hybrid mutator that uses a user-provided function to mutate an allele when a mutation event happens. This function (parameter func) accepts the allele to be mutated as parameter allele and optional array of alleles as parameter context, which are context alleles the left and right of the mutated allele. Invalid context alleles (e.g. left allele to the first locus of a chromosome) will be marked by -1. The return value of this function will be used to mutate the passed allele. The passed, returned and context alleles might be altered if parameter mapIn and mapOut are used. This mutator by default applies to all loci unless parameter loci is specified. A single mutation rate will be used for all loci if a single value of parameter rates is given. Otherwise, a list of mutation rates can be specified for each locus in parameter loci. Please refer to classes mutator and BaseOperator for descriptions of other parameters. """ _simuPOP_la.PyMutator_swiginit(self,_simuPOP_la.new_PyMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyMutator PyMutator_swigregister = _simuPOP_la.PyMutator_swigregister PyMutator_swigregister(PyMutator) class MixedMutator(BaseMutator): """ Details: This mixed mutator accepts a list of mutators and use one of them to mutate an allele when an mutation event happens. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MixedMutator(rates=[], loci=ALL_AVAIL, mutators=[], prob=[], mapIn=[], mapOut=[], context=0, output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a mutator that randomly chooses one of the specified mutators to mutate an allele when a mutation event happens. The mutators are choosen according to a list of probabilities ( prob) that should add up to 1. The passed and returned alleles might be changed if parameters mapIn and mapOut are used. Most parameters, including loci, mapIn, mapOut, rep, and subPops of mutators specified in parameter mutators are ignored. This mutator by default applies to all loci unless parameter loci is specified. Please refer to classes mutator and BaseOperator for descriptions of other parameters. """ _simuPOP_la.MixedMutator_swiginit(self,_simuPOP_la.new_MixedMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MixedMutator MixedMutator_swigregister = _simuPOP_la.MixedMutator_swigregister MixedMutator_swigregister(MixedMutator) class ContextMutator(BaseMutator): """ Details: This context-dependent mutator accepts a list of mutators and use one of them to mutate an allele depending on the context of the mutated allele. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: ContextMutator(rates=[], loci=ALL_AVAIL, mutators=[], contexts=[], mapIn=[], mapOut=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a mutator that choose one of the specified mutators to mutate an allele when a mutation event happens. The mutators are choosen according to the context of the mutated allele, which is specified as a list of alleles to the left and right of an allele ( contexts). For example, contexts=[(0,0), (0,1), (1,1)] indicates which mutators should be used to mutate allele X in the context of 0X0, 0X1, and 1X1. A context can include more than one alleles at both left and right sides of a mutated allele but all contexts should have the same (even) number of alleles. If an allele does not have full context (e.g. when a locus is the first locus on a chromosome), unavailable alleles will be marked as -1. There should be a mutator for each context but an additional mutator can be specified as the default mutator for unmatched contexts. If parameters mapIn is specified, both mutated allele and its context alleles will be mapped. Most parameters, including loci, mapIn, mapOut, rep, and subPops of mutators specified in parameter mutators are ignored. This mutator by default applies to all loci unless parameter loci is specified. Please refer to classes mutator and BaseOperator for descriptions of other parameters. """ _simuPOP_la.ContextMutator_swiginit(self,_simuPOP_la.new_ContextMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_ContextMutator ContextMutator_swigregister = _simuPOP_la.ContextMutator_swigregister ContextMutator_swigregister(ContextMutator) class PointMutator(BaseOperator): """ Details: A point mutator is different from all other mutators because mutations in this mutator do not happen randomly. Instead, it happens to specific loci and mutate an allele to a specific state, regardless of its original state. This mutator is usually used to introduce a mutant to a population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PointMutator(loci, allele, ploidy=0, inds=[], output=">", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=0, infoFields=[]) Details: Create a point mutator that mutates alleles at specified loci to a given allele of individuals inds. If there are multiple alleles at a locus (e.g. individuals in a diploid population), only the first allele is mutated unless indexes of alleles are listed in parameter ploidy. This operator is by default applied to individuals in the first subpopulation but you can apply it to a different or more than one (virtual) subpopulations using parameter *subPops* (``AllAvail`` is also accepted). Please refer to class BaseOperator for detailed descriptions of other parameters. """ _simuPOP_la.PointMutator_swiginit(self,_simuPOP_la.new_PointMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PointMutator PointMutator_swigregister = _simuPOP_la.PointMutator_swigregister PointMutator_swigregister(PointMutator) class GenoTransmitter(BaseOperator): """ Details: This during mating operator is the base class of all genotype transmitters. It is made available to users because it provides a few member functions that can be used by derived transmitters, and by customized Python during mating operators. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: GenoTransmitter(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a base genotype transmitter. """ _simuPOP_la.GenoTransmitter_swiginit(self,_simuPOP_la.new_GenoTransmitter(*args, **kwargs)) def clearChromosome(self, *args, **kwargs): """ Usage: x.clearChromosome(ind, ploidy, chrom) Details: Clear (set alleles to zero) chromosome chrom on the ploidy-th homologous set of chromosomes of individual ind. It is equivalent to ind.setGenotype([0], ploidy, chrom). """ return _simuPOP_la.GenoTransmitter_clearChromosome(self, *args, **kwargs) def copyChromosome(self, *args, **kwargs): """ Usage: x.copyChromosome(parent, parPloidy, offspring, ploidy, chrom) Details: Transmit chromosome chrom on the parPloidy set of homologous chromosomes from parent to the ploidy set of homologous chromosomes of offspring. It is equivalent to offspring.setGenotype(parent.genotype(parPloidy, chrom), polidy, chrom). """ return _simuPOP_la.GenoTransmitter_copyChromosome(self, *args, **kwargs) def copyChromosomes(self, *args, **kwargs): """ Usage: x.copyChromosomes(parent, parPloidy, offspring, ploidy) Details: Transmit the parPloidy set of homologous chromosomes from parent to the ploidy set of homologous chromosomes of offspring. Customized chromosomes are not copied. It is equivalent to offspring.setGenotype(parent.genotype(parPloidy), ploidy). """ return _simuPOP_la.GenoTransmitter_copyChromosomes(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_GenoTransmitter GenoTransmitter.clearChromosome = new_instancemethod(_simuPOP_la.GenoTransmitter_clearChromosome,None,GenoTransmitter) GenoTransmitter.copyChromosome = new_instancemethod(_simuPOP_la.GenoTransmitter_copyChromosome,None,GenoTransmitter) GenoTransmitter.copyChromosomes = new_instancemethod(_simuPOP_la.GenoTransmitter_copyChromosomes,None,GenoTransmitter) GenoTransmitter_swigregister = _simuPOP_la.GenoTransmitter_swigregister GenoTransmitter_swigregister(GenoTransmitter) class CloneGenoTransmitter(GenoTransmitter): """ Details: This during mating operator copies parental genotype directly to offspring. This operator works for all mating schemes when one or two parents are involved. If both parents are passed, maternal genotype are copied. In addition to genotypes on all non- customized or specified chromosomes, sex and information fields are by default also coped copied from parent to offspring. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: CloneGenoTransmitter(output="", chroms=ALL_AVAIL, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a clone genotype transmitter (a during-mating operator) that copies genotypes from parents to offspring. If two parents are specified, genotypes are copied maternally. After genotype transmission, offspring sex is copied from parental sex even if sex has been determined by an offspring generator. All or specified information fields (parameter infoFields, default to ALL_AVAIL) will also be copied from parent to offspring. Parameters subPops is ignored. This operator by default copies genotypes on all autosome and sex chromosomes (excluding customized chromosomes), unless a parameter chroms is used to specify which chromosomes to copy. """ _simuPOP_la.CloneGenoTransmitter_swiginit(self,_simuPOP_la.new_CloneGenoTransmitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_CloneGenoTransmitter CloneGenoTransmitter_swigregister = _simuPOP_la.CloneGenoTransmitter_swigregister CloneGenoTransmitter_swigregister(CloneGenoTransmitter) class MendelianGenoTransmitter(GenoTransmitter): """ Details: This Mendelian offspring generator accepts two parents and pass their genotypes to an offspring following Mendel's laws. Sex chromosomes are handled according to the sex of the offspring, which is usually determined in advance by an offspring generator. Customized chromosomes are not handled. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MendelianGenoTransmitter(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Mendelian genotype transmitter (a during-mating operator) that transmits genotypes from parents to offspring following Mendel's laws. Autosomes and sex chromosomes are handled but customized chromosomes are ignored. Parameters subPops and infoFields are ignored. """ _simuPOP_la.MendelianGenoTransmitter_swiginit(self,_simuPOP_la.new_MendelianGenoTransmitter(*args, **kwargs)) def transmitGenotype(self, *args, **kwargs): """ Usage: x.transmitGenotype(parent, offspring, ploidy) Details: Transmit genotype from parent to offspring, and fill the ploidy homologous set of chromosomes. This function does not set genotypes of customized chromosomes and handles sex chromosomes properly, according to offspring sex and ploidy. """ return _simuPOP_la.MendelianGenoTransmitter_transmitGenotype(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_MendelianGenoTransmitter MendelianGenoTransmitter.transmitGenotype = new_instancemethod(_simuPOP_la.MendelianGenoTransmitter_transmitGenotype,None,MendelianGenoTransmitter) MendelianGenoTransmitter_swigregister = _simuPOP_la.MendelianGenoTransmitter_swigregister MendelianGenoTransmitter_swigregister(MendelianGenoTransmitter) class SelfingGenoTransmitter(MendelianGenoTransmitter): """ Details: A genotype transmitter (during-mating operator) that transmits parental genotype of a parent through self-fertilization. That is to say, the offspring genotype is formed according to Mendel's laws, only that a parent serves as both maternal and paternal parents. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: SelfingGenoTransmitter(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a self-fertilization genotype transmitter that transmits genotypes of a parent to an offspring through self-fertilization. Cutsomized chromosomes are not handled. Parameters subPops and infoFields are ignored. """ _simuPOP_la.SelfingGenoTransmitter_swiginit(self,_simuPOP_la.new_SelfingGenoTransmitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_SelfingGenoTransmitter SelfingGenoTransmitter_swigregister = _simuPOP_la.SelfingGenoTransmitter_swigregister SelfingGenoTransmitter_swigregister(SelfingGenoTransmitter) class HaplodiploidGenoTransmitter(MendelianGenoTransmitter): """ Details: A genotype transmitter (during-mating operator) for haplodiploid populations. The female parent is considered as diploid and the male parent is considered as haploid (only the first homologous copy is valid). If the offspring is FEMALE, she will get a random copy of two homologous chromosomes of her mother, and get the only paternal copy from her father. If the offspring is MALE, he will only get a set of chromosomes from his mother. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: HaplodiploidGenoTransmitter(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a haplodiploid genotype transmitter (during-mating operator) that transmit parental genotypes from parents to offspring in a haplodiploid population. Parameters subPops and infoFields are ignored. """ _simuPOP_la.HaplodiploidGenoTransmitter_swiginit(self,_simuPOP_la.new_HaplodiploidGenoTransmitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_HaplodiploidGenoTransmitter HaplodiploidGenoTransmitter_swigregister = _simuPOP_la.HaplodiploidGenoTransmitter_swigregister HaplodiploidGenoTransmitter_swigregister(HaplodiploidGenoTransmitter) class MitochondrialGenoTransmitter(GenoTransmitter): """ Details: This geno transmitter assumes that the first homologous copy of several (or all) Customized chromosomes are copies of mitochondrial chromosomes. It transmits these chromosomes randomly from the female parent to offspring. If this transmitter is applied to populations with more than one homologous copies of chromosomes, it transmits the first homologous copy of chromosomes and clears alleles (set to zero) on other homologous copies. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MitochondrialGenoTransmitter(output="", chroms=ALL_AVAIL, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Createa a mitochondrial genotype transmitter that treats all Customized chromosomes, or a list of chromosomes specified by chroms, as human mitochondrial chromosomes. These chromosomes should have the same length and the same number of loci. This operator transmits these chromosomes randomly from the female parent to offspring of both sexes. """ _simuPOP_la.MitochondrialGenoTransmitter_swiginit(self,_simuPOP_la.new_MitochondrialGenoTransmitter(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MitochondrialGenoTransmitter MitochondrialGenoTransmitter_swigregister = _simuPOP_la.MitochondrialGenoTransmitter_swigregister MitochondrialGenoTransmitter_swigregister(MitochondrialGenoTransmitter) class Recombinator(GenoTransmitter): """ Details: A genotype transmitter (during-mating operator) that transmits parental chromosomes to offspring, subject to recombination and gene conversion. This can be used to replace MendelianGenoTransmitter and SelfingGenoTransmitter. It does not work in haplodiploid populations, although a customized genotype transmitter that makes uses this operator could be defined. Please refer to the simuPOP user's guide or online cookbook for details. Recombination could be applied to all adjacent markers or after specified loci. Recombination rate between two adjacent markers could be specified directly, or calculated using physical distance between them. In the latter case, a recombination intensity is multiplied by physical distance between markers. Gene conversion is interpreted as double-recombination events. That is to say, if a recombination event happens, it has a certain probability (can be 1) to become a conversion event, namely triggering another recombination event down the chromosome. The length of the converted chromosome can be controlled in a number of ways. Note: simuPOP does not assume any unit to loci positions so recombination intensity could be explained differntly (e.g. cM/Mb, Morgan/Mb) depending on your intepretation of loci positions. For example, if basepair is used for loci position, intensity=10^-8 indicates 10^-8 per basepair, which is equivalent to 10^-2 per Mb or 1 cM/Mb. If Mb is used for physical positions, the same recombination intensity could be achieved by intensity=0.01. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Recombinator(rates=[], intensity=-1, loci=ALL_AVAIL, convMode=NO_CONVERSION, output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Recombinator (a mendelian genotype transmitter with recombination and gene conversion) that passes genotypes from parents (or a parent in case of self-fertilization) to offspring. Recombination happens by default between all adjacent markers but can be limited to a given set of loci, which can be a list of loci indexes, names or ALL_AVAIL. Each locus in this list specifies a recombination point between the locus and the locus immediately before it. Loci that are the first locus on each chromosome are ignored. If a single recombination rate (parameter rates) is specified, it will used for all loci (all loci or loci specified by parameter loci), regardless of physical distances between adjacent loci. If a list of recombination rates are specified in rates, a parameter loci with the same length should also be specified. Different recombination rates can then be used after these loci (between specified loci and their immediate neighbor to the right). A recombination intensity (intensity) can be used to specify recombination rates that are proportional to physical distances between adjacent markers. If the physical distance between two markers is d, the recombination rate between them will be intensity * d. No unit is assume for loci position and recombination intensity. Gene conversion is controlled using parameter convMode, which can be * NoConversion: no gene conversion (default). * (NUM_MARKERS, prob, n): With probability prob, convert a fixed number (n) of markers if a recombination event happens. * (GEOMETRIC_DISTRIBUTION, prob, p): With probability prob, convert a random number of markers if a recombination event happens. The number of markes converted follows a geometric distribution with probability p. * (TRACT_LENGTH, prob, n): With probability prob, convert a region of fixed tract length (n) if a recombination event happens. The actual number of markers converted depends on loci positions of surrounding loci. The starting position of this tract is the middle of two adjacent markers. For example, if four loci are located at 0, 1, 2, 3 respectively, a conversion event happens between 0 and 1, with a tract length 2 will start at 0.5 and end at 2.5, covering the second and third loci. * (EXPONENTIAL_DISTRIBUTION, prob, p): With probability prob, convert a region of random tract length if a recombination event happens. The distribution of tract length follows a exponential distribution with probability p. The actual number of markers converted depends on loci positions of surrounding loci. simuPOP uses this probabilistic model of gene conversion because when a recombination event happens, it may become a recombination event if the if the Holliday junction is resolved/repaired successfully, or a conversion event if the junction is not resolved/repaired. The probability, however, is more commonly denoted by the ratio of conversion to recombination events in the literature. This ratio varies greatly from study to study, ranging from 0.1 to 15 (Chen et al, Nature Review Genetics, 2007). This translate to 0.1/0.9~0.1 to 15/16~0.94 of the gene conversion probability. A Recombinator usually does not send any output. However, if an information field is given (parameter infoFields), this operator will treat this information field as an unique ID of parents and offspring and output all recombination events in the format of offspring_id parent_id starting_ploidy loc1 loc2 ... where starting_ploidy indicates which homologous copy genotype replication starts from (0 or 1), loc1, loc2 etc are loci after which recombination events happens. If there are multiple chromosomes on the genome, you will see a lot of (fake) recombination events because of independent segregation of chromosomes. Such a record will be generated for each set of homologous chromosomes so an diploid offspring will have two lines of output. Note that individual IDs need to be set (using a IdTagger operator) before this Recombinator is applied. Note: conversion tract length is usually short, and is estimated to be between 337 and 456 bp, with overall range between maybe 50 - 2500 bp. This is usually not enough to convert, for example, two adjacent markers from the HapMap dataset.There is no recombination between sex chromosomes (Chromosomes X and Y), although recombination is possible between pesudoautosomal regions on these chromosomes. If such a feature is required, you will have to simulate the pesudoautosomal regions as separate chromosomes. """ _simuPOP_la.Recombinator_swiginit(self,_simuPOP_la.new_Recombinator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_Recombinator def transmitGenotype(self, *args, **kwargs): """ Usage: x.transmitGenotype(parent, offspring, ploidy) Details: This function transmits genotypes from a parent to the ploidy-th homologous set of chromosomes of an offspring. It can be used, for example, by a customized genotype transmitter to use sex-specific recombination rates to transmit parental genotypes to offspring. """ return _simuPOP_la.Recombinator_transmitGenotype(self, *args, **kwargs) Recombinator.transmitGenotype = new_instancemethod(_simuPOP_la.Recombinator_transmitGenotype,None,Recombinator) Recombinator_swigregister = _simuPOP_la.Recombinator_swigregister Recombinator_swigregister(Recombinator) class BaseSelector(BaseOperator): """ Details: This class is the base class to all selectors, namely operators that perform natural selection. It defines a common interface for all selectors. A selector can be applied before mating or during mating. If a selector is applied to one or more (virtual) subpopulations of a parental population before mating, it sets individual fitness values to all involved parents to an information field (default to fitness). When a mating scheme that supports natural selection is applied to the parental population, it will select parents with probabilities that are proportional to individual fitness stored in an information field (default to fitness). Individual fitness is considered relative fitness and can be any non-negative number. This simple process has some implications that can lead to advanced usages of natural selection in simuPOP: * It is up to the mating scheme how to handle individual fitness. Some mating schemes do not support natural selection at all. * A mating scheme performs natural selection according to fitness values stored in an information field. It does not care how these values are set. For example, fitness values can be inherited from a parent using a tagging operator, or set directly using a Python operator. * A mating scheme can treat any information field as fitness field. If an specified information field does not exist, or if all individuals have the same fitness values (e.g. 0), the mating scheme selects parents randomly. * Multiple selectors can be applied to the same parental generation. individual fitness is determined by the last fitness value it is assigned. * A selection operator can be applied to virtual subpopulations and set fitness values only to part of the individuals. * individuals with zero fitness in a subpopulation with anyone having a positive fitness value will not be selected to produce offspring. This can sometimes lead to unexpected behaviors. For example, if you only assign fitness value to part of the individuals in a subpopulation, the rest of them will be effectively discarded. If you migrate individuals with valid fitness values to a subpopulation with all individuals having zero fitness, the migrants will be the only mating parents. * It is possible to assign multiple fitness values to different information fields so that different homogeneous mating schemes can react to different fitness schemes when they are used in a heterogeneous mating scheme. * You can apply a selector to the offspring generation using the postOps parameter of Simulator.evolve, these fitness values will be used when the offspring generation becomes parental generation in the next generation. Alternatively, a selector can be used as a during mating operator. In this case, it caculates fitness value for each offspring which will be treated as absolute fitness, namely the probability for each offspring to survive. This process uses the fact that an individual will be discarded when any of the during mating operators returns False. It is important to remember that: * individual fitness needs to be between 0 and 1 in this case. * This method applies natural selection to offspring instead of parents. These two implementation can be identical or different depending on the mating scheme used. * Seleting offspring is less efficient than the selecting parents, especially when fitness values are low. * Parameter subPops are applied to the offspring population and is used to judge if an operator should be applied. It thus does not make sense to apply a selector to a virtual subpopulation with affected individuals. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: BaseSelector(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a base selector object. This operator should not be created directly. """ _simuPOP_la.BaseSelector_swiginit(self,_simuPOP_la.new_BaseSelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_BaseSelector BaseSelector_swigregister = _simuPOP_la.BaseSelector_swigregister BaseSelector_swigregister(BaseSelector) class MapSelector(BaseSelector): """ Details: This selector assigns individual fitness values using a user- specified dictionary. This operator can be applied to populations with arbitrary number of homologous chromosomes. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MapSelector(loci, fitness, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a selector that assigns individual fitness values using a dictionary fitness with genotype at loci as keys, and fitness as values. Parameter loci can be a list of indexes, loci names or ALL_AVAIL. For each individual (parents if this operator is applied before mating, and offspring if this operator is applied during mating), genotypes at loci are collected one by one (e.g. p0_loc0, p1_loc0, p0_loc1, p1_loc1... for a diploid individual) and are looked up in the dictionary. If a genotype cannot be found, it will be looked up again without phase information (e.g. (1,0) will match key (0,1)). If the genotype still can not be found, a ValueError will be raised. This operator supports sex chromosomes and haplodiploid populations. In these cases, only valid genotypes should be used to generator the dictionary keys. """ _simuPOP_la.MapSelector_swiginit(self,_simuPOP_la.new_MapSelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MapSelector MapSelector_swigregister = _simuPOP_la.MapSelector_swigregister MapSelector_swigregister(MapSelector) class MaSelector(BaseSelector): """ Details: This operator is called a 'multi-allele' selector because it groups multiple alleles into two groups: wildtype and non-wildtype alleles. Alleles in each allele group are assumed to have the same effect on individual fitness. If we denote all wildtype alleles as A, and all non-wildtype alleles a, this operator assign individual fitness according to genotype AA, Aa, aa in the diploid case, and A and a in the haploid case. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MaSelector(loci, fitness, wildtype=0, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Creates a multi-allele selector that groups multiple alleles into a wildtype group (with alleles wildtype, default to [0]), and a non-wildtype group. A list of fitness values is specified through parameter fitness, for genotypes at one or more loci. Parameter loci can be a list of indexes, loci names or ALL_AVAIL. If we denote wildtype alleles using capital letters A, B ... and non- wildtype alleles using small letters a, b ..., the fitness values should be for * genotypes A and a for the haploid single-locus case, * genotypes AB, Ab, aB and bb for haploid two=locus cases, * genotypes AA, Aa and aa for diploid single-locus cases, * genotypes AABB, AABb, AAbb, AaBB, AaBb, Aabb, aaBB, aaBb, and aabb for diploid two-locus cases, * and in general 2**n for diploid and 3**n for haploid cases if there are n loci. This operator does not support haplodiploid populations and sex chromosomes. """ _simuPOP_la.MaSelector_swiginit(self,_simuPOP_la.new_MaSelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MaSelector MaSelector_swigregister = _simuPOP_la.MaSelector_swigregister MaSelector_swigregister(MaSelector) class MlSelector(BaseSelector): """ Details: This selector is created by a list of selectors. When it is applied to an individual, it applies these selectors to the individual, obtain a list of fitness values, and compute a combined fitness value from them. ADDITIVE, multiplicative, and a heterogeneour multi-locus model are supported. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MlSelector(ops, mode=MULTIPLICATIVE, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a multiple-locus selector from a list selection operator selectors. When this operator is applied to an individual (parents when used before mating and offspring when used during mating), it applies these operators to the individual and obtain a list of (usually single-locus) fitness values. These fitness values are combined to a single fitness value using * Prod(f_i), namely the product of individual fitness if mode = MULTIPLICATIVE, * 1-sum(1 - f_i) if mode = ADDITIVE, * 1-Prod(1 - f_i) if mode = HETEROGENEITY, and * exp(- sum(1 - f_i)) if mode = EXPONENTIAL, zero will be returned if the combined fitness value is less than zero. """ _simuPOP_la.MlSelector_swiginit(self,_simuPOP_la.new_MlSelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MlSelector MlSelector_swigregister = _simuPOP_la.MlSelector_swigregister MlSelector_swigregister(MlSelector) class PySelector(BaseSelector): """ Details: This selector assigns fitness values by calling a user provided function. It accepts a list of loci (parameter loci) and a Python function func which should be defined with one or more of parameters geno, gen, ind, pop or names of information fields. Parameter loci can be a list of loci indexes, names or ALL_AVAIL. When this operator is applied to a population, it passes genotypes at specified loci, generation number, a reference to an individual, a reference to the current population (usually used to retrieve population variable), and values at specified information fields to respective parameters of this function. The returned value will be used to determine the fitness of each individual. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PySelector(func, loci=[], begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a Python hybrid selector that passes genotype at specified loci, values at specified information fields (if requested) and a generation number to a user-defined function func. The return value will be treated as individual fitness. """ _simuPOP_la.PySelector_swiginit(self,_simuPOP_la.new_PySelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PySelector PySelector_swigregister = _simuPOP_la.PySelector_swigregister PySelector_swigregister(PySelector) class BaseQuanTrait(BaseOperator): """ Details: A quantitative trait in simuPOP is simply an information field. A quantitative trait model simply assigns values to one or more information fields (called trait fields) of each individual according to its genetic (genotype) and environmental (information field) factors. It can be applied at any stage of an evolutionary cycle. If a quantitative trait operator is applied before or after mating, it will set the trait fields of all parents and offspring. If it is applied during mating, it will set the trait fields of each offspring. When a quantitative trait operator is applied to a population, it is only applied to the current generation. You can, however, use parameter ancGen=-1 to set the trait field of all ancestral generations, or a generation index to apply to only ancestral generation younger than ancGen. Note that this parameter is ignored if the operator is applied during mating. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: BaseQuanTrait(ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a base quantitative trait operator. This operator assigns one or more quantitative traits to trait fields in the present generation (default). If ALL_AVAIL or a list of ancestral generations are specified, this operator will be applied to individuals in these generations as well. A quantitative trait operator can be applied to specified (virtual) subpopulations (parameter subPops) and replicates (parameter reps). """ _simuPOP_la.BaseQuanTrait_swiginit(self,_simuPOP_la.new_BaseQuanTrait(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_BaseQuanTrait BaseQuanTrait_swigregister = _simuPOP_la.BaseQuanTrait_swigregister BaseQuanTrait_swigregister(BaseQuanTrait) class PyQuanTrait(BaseQuanTrait): """ Details: This quantitative trait operator assigns a trait field by calling a user provided function. It accepts a list of loci (parameter loci), and a Python function func which should be defined with one or more of parameters geno, gen, ind, or names of information fields. When this operator is applied to a population, it passes genotypes at specified loci, generation number, a reference to an individual, and values at specified information fields to respective parameters of this function. The return values will be assigned to specified trait fields. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyQuanTrait(func, loci=[], ancGens=ALL_AVAIL, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Python hybrid quantitative trait operator that passes genotype at specified loci, optional values at specified information fields (if requested), and an optional generation number to a user-defined function func. Parameter loci can be a list of loci indexes, names, or ALL_AVAIL. The return value will be assigned to specified trait fields (infoField). If only one trait field is specified, a number or a sequence of one element is acceptable. Otherwise, a sequence of values will be accepted and be assigned to each trait field. """ _simuPOP_la.PyQuanTrait_swiginit(self,_simuPOP_la.new_PyQuanTrait(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyQuanTrait PyQuanTrait_swigregister = _simuPOP_la.PyQuanTrait_swigregister PyQuanTrait_swigregister(PyQuanTrait) class BasePenetrance(BaseOperator): """ Details: A penetrance model models the probability that an individual has a certain disease provided that he or she has certain genetic (genotype) and environmental (information field) riske factors. A penetrance operator calculates this probability according to provided information and set his or her affection status randomly. For example, an individual will have probability 0.8 to be affected if the penetrance is 0.8. This class is the base class to all penetrance operators and defines a common interface for all penetrance operators. A penetrance operator can be applied at any stage of an evolutionary cycle. If it is applied before or after mating, it will set affection status of all parents and offspring, respectively. If it is applied during mating, it will set the affection status of each offspring. You can also apply a penetrance operator to an individual using its applyToIndividual member function. By default, a penetrance operator assigns affection status of individuals but does not save the actual penetrance value. However, if an information field is specified, penetrance values will be saved to this field for future analysis. When a penetrance operator is applied to a population, it is only applied to the current generation. You can, however, use parameter ancGens to set affection status for all ancestral generations (ALL_AVAIL), or individuals in specified generations if a list of ancestral generations is specified. Note that this parameter is ignored if the operator is applied during mating. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: BasePenetrance(ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a base penetrance operator. This operator assign individual affection status in the present generation (default). If ALL_AVAIL or a list of ancestral generations are spcified in parameter ancGens, individuals in specified ancestral generations will be processed. A penetrance operator can be applied to specified (virtual) subpopulations (parameter subPops) and replicates (parameter reps). If an informatio field is given, penetrance value will be stored in this information field of each individual. """ _simuPOP_la.BasePenetrance_swiginit(self,_simuPOP_la.new_BasePenetrance(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_BasePenetrance def applyToIndividual(self, *args, **kwargs): """ Usage: x.applyToIndividual(ind, pop=None) Details: Apply the penetrance operator to a single individual ind and set his or her affection status. A population reference can be passed if the penetrance model depends on population properties such as generation number. This function returns the affection status. """ return _simuPOP_la.BasePenetrance_applyToIndividual(self, *args, **kwargs) BasePenetrance.applyToIndividual = new_instancemethod(_simuPOP_la.BasePenetrance_applyToIndividual,None,BasePenetrance) BasePenetrance_swigregister = _simuPOP_la.BasePenetrance_swigregister BasePenetrance_swigregister(BasePenetrance) class MapPenetrance(BasePenetrance): """ Details: This penetrance operator assigns individual affection status using a user-specified penetrance dictionary. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MapPenetrance(loci, penetrance, ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a penetrance operator that get penetrance value from a dictionary penetrance with genotype at loci as keys, and penetrance as values. For each individual, genotypes at loci are collected one by one (e.g. p0_loc0, p1_loc0, p0_loc1, p1_loc1... for a diploid individual) and are looked up in the dictionary. Parameter loci can be a list of loci indexes, names or ALL_AVAIL. If a genotype cannot be found, it will be looked up again without phase information (e.g. (1,0) will match key (0,1)). If the genotype still can not be found, a ValueError will be raised. This operator supports sex chromosomes and haplodiploid populations. In these cases, only valid genotypes should be used to generator the dictionary keys. """ _simuPOP_la.MapPenetrance_swiginit(self,_simuPOP_la.new_MapPenetrance(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MapPenetrance MapPenetrance_swigregister = _simuPOP_la.MapPenetrance_swigregister MapPenetrance_swigregister(MapPenetrance) class MaPenetrance(BasePenetrance): """ Details: This operator is called a 'multi-allele' penetrance operator because it groups multiple alleles into two groups: wildtype and non-wildtype alleles. Alleles in each allele group are assumed to have the same effect on individual penetrance. If we denote all wildtype alleles as A, and all non-wildtype alleles a, this operator assign Individual penetrance according to genotype AA, Aa, aa in the diploid case, and A and a in the haploid case. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MaPenetrance(loci, penetrance, wildtype=0, ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Creates a multi-allele penetrance operator that groups multiple alleles into a wildtype group (with alleles wildtype, default to [0]), and a non-wildtype group. A list of penetrance values is specified through parameter penetrance, for genotypes at one or more loci. Parameter loci can be a list of loci indexes, names or ALL_AVAIL. If we denote wildtype alleles using capital letters A, B ... and non-wildtype alleles using small letters a, b ..., the penetrance values should be for * genotypes A and a for the haploid single-locus case, * genotypes AB, Ab, aB and bb for haploid two=locus cases, * genotypes AA, Aa and aa for diploid single-locus cases, * genotypes AABB, AABb, AAbb, AaBB, AaBb, Aabb, aaBB, aaBb, and aabb for diploid two-locus cases, * and in general 2**n for diploid and 3**n for haploid cases if there are n loci. This operator does not support haplodiploid populations and sex chromosomes. """ _simuPOP_la.MaPenetrance_swiginit(self,_simuPOP_la.new_MaPenetrance(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MaPenetrance MaPenetrance_swigregister = _simuPOP_la.MaPenetrance_swigregister MaPenetrance_swigregister(MaPenetrance) class MlPenetrance(BasePenetrance): """ Details: This penetrance operator is created by a list of penetrance operators. When it is applied to an individual, it applies these penetrance operators to the individual, obtain a list of penetrance values, and compute a combined penetrance value from them and assign affection status accordingly. ADDITIVE, multiplicative, and a heterogeneour multi-locus model are supported. Please refer to Neil Rish (1989) "Linkage Strategies for Genetically Complex Traits" for some analysis of these models. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MlPenetrance(ops, mode=MULTIPLICATIVE, ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a multiple-locus penetrance operator from a list penetrance operator ops. When this operator is applied to an individual (parents when used before mating and offspring when used during mating), it applies these operators to the individual and obtain a list of (usually single-locus) penetrance values. These penetrance values are combined to a single penetrance value using * Prod(f_i), namely the product of individual penetrance if mode = MULTIPLICATIVE, * sum(f_i) if mode = ADDITIVE, and * 1-Prod(1 - f_i) if mode = HETEROGENEITY 0 or 1 will be returned if the combined penetrance value is less than zero or greater than 1. """ _simuPOP_la.MlPenetrance_swiginit(self,_simuPOP_la.new_MlPenetrance(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MlPenetrance MlPenetrance_swigregister = _simuPOP_la.MlPenetrance_swigregister MlPenetrance_swigregister(MlPenetrance) class PyPenetrance(BasePenetrance): """ Details: This penetrance operator assigns penetrance values by calling a user provided function. It accepts a list of loci (parameter loci), and a Python function func which should be defined with one or more of parameters geno, gen, ind, pop, or names of information fields. When this operator is applied to a population, it passes genotypes at specified loci, generation number, a reference to an individual, a reference to the current population (usually used to retrieve population variables) and values at specified information fields to respective parameters of this function. The returned penetrance values will be used to determine the affection status of each individual. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: PyPenetrance(func, loci=[], ancGens=UNSPECIFIED, begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Python hybrid penetrance operator that passes genotype at specified loci, values at specified information fields (if requested), and a generation number to a user-defined function func. Parameter loci can be a list of loci indexes, names, or ALL_AVAIL. The return value will be treated as Individual penetrance. """ _simuPOP_la.PyPenetrance_swiginit(self,_simuPOP_la.new_PyPenetrance(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_PyPenetrance PyPenetrance_swigregister = _simuPOP_la.PyPenetrance_swigregister PyPenetrance_swigregister(PyPenetrance) class Pedigree(Population): """ Details: The pedigree class is derived from the population class. Unlike a population class that emphasizes on individual properties, the pedigree class emphasizes on relationship between individuals. An unique ID for all individuals is needed to create a pedigree object from a population object. Compared to the Population class, a Pedigree object is optimized for access individuals by their IDs, regardless of population structure and ancestral generations. Note that the implementation of some algorithms rely on the fact that parental IDs are smaller than their offspring because individual IDs are assigned sequentially during evolution. Pedigrees with manually assigned IDs should try to obey such a rule. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: Pedigree(pop, loci=[], infoFields=[], ancGens=ALL_AVAIL, idField="ind_id", fatherField="father_id", motherField="mother_id", stealPop=False) Details: Create a pedigree object from a population, using a subset of loci (parameter loci, can be a list of loci indexes, names, or ALL_AVAIL, default to no locus), information fields (parameter infoFields, default to no information field besides idField, fatherField and motherField), and ancestral generations (parameter ancGens, default to all ancestral generations). By default, information field father_id (parameter fatherField) and mother_id (parameter motherField) are used to locate parents identified by ind_id (parameter idField), which should store an unique ID for all individuals. Multiple individuls with the same ID are allowed and will be considered as the same individual, but a warning will be given if they actually differ in genotype or information fields. Operators IdTagger and PedigreeTagger are usually used to assign such IDs, although function sampling.indexToID could be used to assign unique IDs and construct parental IDs from index based relationship recorded by operator ParentsTagger. A pedigree object could be constructed with one or no parent but certain functions such as relative tracking will not be available for such pedigrees. In case that your are no longer using your population object, you could steal the content from the population by setting stealPop to True. """ _simuPOP_la.Pedigree_swiginit(self,_simuPOP_la.new_Pedigree(*args, **kwargs)) def clone(self): """ Usage: x.clone() Details: Create a cloned copy of a Pedigree. """ return _simuPOP_la.Pedigree_clone(self) def save(self, *args, **kwargs): """ Usage: x.save(filename, infoFields=[], loci=[]) Details: Save a pedigree to file filename. This function goes through all individuals of a pedigree and outputs in each line the ID of individual, IDs of his or her parents, sex ('M' or 'F'), affection status ('A' or 'U'), values of specified information fields infoFields and genotypes at specified loci (parameter loci, which can be a list of loci indexes, names, or ALL_AVAIL). Allele numbers, instead of their names are outputed. Two columns are used for each locus if the population is diploid. This file can be loaded using function loadPedigree although additional information such as names of information fields need to be specified. This format differs from a .ped file used in some genetic analysis software in that there is no family ID and IDs of all individuals have to be unique. Note that parental IDs will be set to zero if the parent is not in the pedigree object. Therefore, the parents of individuals in the top-most ancestral generation will always be zero. """ return _simuPOP_la.Pedigree_save(self, *args, **kwargs) def indByID(self, *args, **kwargs): """ Usage: x.indByID(id) Details: Return a reference to individual with id. An IndexError will be raised if no individual with id is found. An float id is acceptable as long as it rounds closely to an integer. """ return _simuPOP_la.Pedigree_indByID(self, *args, **kwargs) def numParents(self): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_numParents(self) def locateRelatives(self, *args, **kwargs): """ Usage: x.locateRelatives(relType, resultFields=[], sex=ANY_SEX, affectionStatus=ANY_AFFECTION_STATUS, ancGens=ALL_AVAIL) Details: This function locates relatives (of type relType) of each individual and store their IDs in information fields relFields. The length of relFields determines how many relatives an individual can have. Parameter relType specifies what type of relative to locate, which can be * SPOUSE locate spouses with whom an individual has at least one common offspring. * OUTBRED_SPOUSE locate non-slibling spouses, namely spouses with no shared parent. * OFFSPRING all offspring of each individual. * COMMON_OFFSPRING common offspring between each individual and its spouse (located by SPOUSE or OUTBRED_SPOUSE). relFields should consist of an information field for spouse and m-1 fields for offspring where m is the number of fields. * FULLSIBLING siblings with common father and mother, * SIBLING siblings with at least one common parent. Optionally, you can specify the sex and affection status of relatives you would like to locate, using parameters sex and affectionStatus. sex can be ANY_SEX (default), MALE_ONLY, FEMALE_ONLY, SAME_SEX or OPPOSITE_SEX, and affectionStatus can be AFFECTED, UNAFFECTED or ANY_AFFECTION_STATUS (default). Only relatives with specified properties will be located. This function will by default go through all ancestral generations and locate relatives for all individuals. This can be changed by setting parameter ancGens to certain ancestral generations you would like to process. """ return _simuPOP_la.Pedigree_locateRelatives(self, *args, **kwargs) def traceRelatives(self, *args, **kwargs): """ Usage: x.traceRelatives(fieldPath, sex=[], affectionStatus=[], resultFields=[], ancGens=ALL_AVAIL) Details: Trace a relative path in a population and record the result in the given information fields resultFields. This function is used to locate more distant relatives based on the relatives located by function locateRelatives. For example, after siblings and offspring of all individuals are located, you can locate mother's sibling's offspring using a relative path, and save their indexes in each individuals information fields resultFields. A relative path consits of a fieldPath that specifies which information fields to look for at each step, a sex specifies sex choices at each generation, and a affectionStatus that specifies affection status at each generation. fieldPath should be a list of information fields, sex and affectionStatus are optional. If specified, they should be a list of ANY_SEX, MALE_ONLY, FEMALE_ONLY, SAME_SEX and OppsiteSex for parameter sex, and a list of UNAFFECTED, AFFECTED and ANY_AFFECTION_STATUS for parameter affectionStatus. For example, if fieldPath = [['father_id', 'mother_id'], ['sib1', 'sib2'], ['off1', 'off2']], and sex = [ANY_SEX, MALE_ONLY, FEMALE_ONLY], this function will locate father_id and mother_id for each individual, find all individuals referred by father_id and mother_id, find informaton fields sib1 and sib2 from these parents and locate male individuals referred by these two information fields. Finally, the information fields off1 and off2 from these siblings are located and are used to locate their female offspring. The results are father or mother's brother's daughters. Their indexes will be saved in each individuals information fields resultFields. If a list of ancestral generations is given in parameter ancGens is given, only individuals in these ancestral generations will be processed. """ return _simuPOP_la.Pedigree_traceRelatives(self, *args, **kwargs) def individualsWithRelatives(self, *args, **kwargs): """ Usage: x.individualsWithRelatives(infoFields, sex=[], affectionStatus=[], subPops=ALL_AVAIL, ancGens=ALL_AVAIL) Details: Return a list of IDs of individuals who have non-negative values at information fields infoFields. Additional requirements could be specified by parameters sex and affectionStatus. sex can be ANY_SEX (default), MALE_ONLY, FEMALE_ONLY, SAME_SEX or OPPOSITE_SEX, and affectionStatus can be AFFECTED, UNAFFECTED or ANY_AFFECTION_STATUS (default). This function by default check all individuals in all ancestral generations, but you could limit the search using parameter subPops (a list of (virtual) subpopulations) and ancestral generations ancGens. Relatives fall out of specified subpopulations and ancestral generaions will be considered invalid. """ return _simuPOP_la.Pedigree_individualsWithRelatives(self, *args, **kwargs) def identifyFamilies(self, *args, **kwargs): """ Usage: x.identifyFamilies(pedField="", subPops=ALL_AVAIL, ancGens=ALL_AVAIL) Details: This function goes through all individuals in a pedigree and group related individuals into families. If an information field pedField is given, indexes of families will be assigned to this field of each family member. The return value is a list of family sizes corresponding to families 0, 1, 2, ... etc. If a list of (virtual) subpopulations (parameter subPops) or ancestral generations are specified (parameter ancGens), the search will be limited to individuals in these subpopulations and generations. """ return _simuPOP_la.Pedigree_identifyFamilies(self, *args, **kwargs) def identifyAncestors(self, *args, **kwargs): """ Usage: x.identifyAncestors(IDs=ALL_AVAIL, subPops=ALL_AVAIL, ancGens=ALL_AVAIL) Details: If a list of individuals (IDs) is given, this function traces backward in time and find all ancestors of these individuals. If IDs is ALL_AVAIL, ancestors of all individuals in the present generation will be located. If a list of (virtual) subpopulations (subPops) or ancestral geneartions (ancGens) is given, the search will be limited to individuals in these subpopulations and generations. This could be used to, for example, find all fathers of IDs. This function returns a list of IDs, which includes valid specified IDs. Invalid IDs will be silently ignored. Note that parameters subPops and ancGens will limit starting IDs if IDs is set to ALL_AVAIL, but specified IDs will not be trimmed according to these parameters. """ return _simuPOP_la.Pedigree_identifyAncestors(self, *args, **kwargs) def identifyOffspring(self, *args, **kwargs): """ Usage: x.identifyOffspring(IDs=[], subPops=ALL_AVAIL, ancGens=ALL_AVAIL) Details: This function traces forward in time and find all offspring of individuals specified in parameter IDs. If a list of (virtual) subpopulations (subPops) or ancestral geneartions (ancGens) is given, the search will be limited to individuals in these subpopulations and generations. This could be used to, for example, find all male offspring of IDs. This function returns a list of IDs, which includes valid starting IDs. Invalid IDs are silently ignored. Note that parameters subPops and ancGens will limit search result but will not be used to trim specified IDs. """ return _simuPOP_la.Pedigree_identifyOffspring(self, *args, **kwargs) def removeIndividuals(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_removeIndividuals(self, *args, **kwargs) def removeSubPops(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_removeSubPops(self, *args, **kwargs) def push(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_push(self, *args, **kwargs) def addChrom(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_addChrom(self, *args, **kwargs) def addChromFrom(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_addChromFrom(self, *args, **kwargs) def addIndFrom(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_addIndFrom(self, *args, **kwargs) def mergeSubPops(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_mergeSubPops(self, *args, **kwargs) def resize(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_resize(self, *args, **kwargs) def setSubPopByIndInfo(self, *args, **kwargs): """Obsolete or undocumented function.""" return _simuPOP_la.Pedigree_setSubPopByIndInfo(self, *args, **kwargs) __swig_destroy__ = _simuPOP_la.delete_Pedigree Pedigree.clone = new_instancemethod(_simuPOP_la.Pedigree_clone,None,Pedigree) Pedigree.save = new_instancemethod(_simuPOP_la.Pedigree_save,None,Pedigree) Pedigree.indByID = new_instancemethod(_simuPOP_la.Pedigree_indByID,None,Pedigree) Pedigree.numParents = new_instancemethod(_simuPOP_la.Pedigree_numParents,None,Pedigree) Pedigree.locateRelatives = new_instancemethod(_simuPOP_la.Pedigree_locateRelatives,None,Pedigree) Pedigree.traceRelatives = new_instancemethod(_simuPOP_la.Pedigree_traceRelatives,None,Pedigree) Pedigree.individualsWithRelatives = new_instancemethod(_simuPOP_la.Pedigree_individualsWithRelatives,None,Pedigree) Pedigree.identifyFamilies = new_instancemethod(_simuPOP_la.Pedigree_identifyFamilies,None,Pedigree) Pedigree.identifyAncestors = new_instancemethod(_simuPOP_la.Pedigree_identifyAncestors,None,Pedigree) Pedigree.identifyOffspring = new_instancemethod(_simuPOP_la.Pedigree_identifyOffspring,None,Pedigree) Pedigree.removeIndividuals = new_instancemethod(_simuPOP_la.Pedigree_removeIndividuals,None,Pedigree) Pedigree.removeSubPops = new_instancemethod(_simuPOP_la.Pedigree_removeSubPops,None,Pedigree) Pedigree.push = new_instancemethod(_simuPOP_la.Pedigree_push,None,Pedigree) Pedigree.addChrom = new_instancemethod(_simuPOP_la.Pedigree_addChrom,None,Pedigree) Pedigree.addChromFrom = new_instancemethod(_simuPOP_la.Pedigree_addChromFrom,None,Pedigree) Pedigree.addIndFrom = new_instancemethod(_simuPOP_la.Pedigree_addIndFrom,None,Pedigree) Pedigree.mergeSubPops = new_instancemethod(_simuPOP_la.Pedigree_mergeSubPops,None,Pedigree) Pedigree.resize = new_instancemethod(_simuPOP_la.Pedigree_resize,None,Pedigree) Pedigree.setSubPopByIndInfo = new_instancemethod(_simuPOP_la.Pedigree_setSubPopByIndInfo,None,Pedigree) Pedigree_swigregister = _simuPOP_la.Pedigree_swigregister Pedigree_swigregister(Pedigree) def loadPedigree(*args, **kwargs): """ Usage: loadPedigree(file, idField="ind_id", fatherField="father_id", motherField="mother_id", ploidy=2, loci=[], chromTypes=[], lociPos=[], chromNames=[], alleleNames=[], lociNames=[], subPopNames=[], infoFields=[]) Details: Load a pedigree from a file saved by operator PedigreeTagger or function Pedigree.save. This file contains the ID of each offspring and their parent(s) and optionally sex ('M' or 'F'), affection status ('A' or 'U'), values of information fields and genotype at some loci. IDs of each individual and their parents are loaded to information fields idField, fatherField and motherField. Only numeric IDs are allowed, and individual IDs must be unique across all generations. Because this file does not contain generation information, generations to which offspring belong are determined by the parent-offspring relationships. Individuals without parents are assumed to be in the top-most ancestral generation. This is the case for individuals in the top- most ancestral generation if the file is saved by function ``Pedigree.save()``, and for individuals who only appear as another individual's parent, if the file is saved by operator ``PedigreeTagger``. The order at which offsprng is specified is not important because this function essentially creates a top-most ancestral generation using IDs without parents, and creates the next generation using offspring of these parents, and so on until all generations are recreated. That is to say, if you have a mixture of pedigrees with different generations, they will be lined up from the top most ancestral generation. If individual sex is not specified, sex of of parents are determined by their parental roles (father or mother) but the sex of individuals in the last generation can not be determined so they will all be males. If additional information fields are given, their names have to be specified using parameter infoFields. The rest of the columns are assued to be alleles, arranged ploidy consecutive columns for each locus. If paraemter loci is not specified, the number of loci is calculated by number of columns divided by ploidy (default to 2). All loci are assumed to be on one chromosome unless parameter loci is used to specified number of loci on each chromosome. Additional parameters such as ploidy, chromTypes, lociPos, chromNames, alleleNames, lociNames could be used to specified the genotype structured of the loaded pedigree. Please refer to class Population for details about these parameters. """ return _simuPOP_la.loadPedigree(*args, **kwargs) class RevertFixedSites(BaseOperator): """ Details: This operator looks into a population in mutational space and revert a mutant to wildtype allele if it is fixed in the population. If a valid output is specifieid, fixed alleles will be outputed with a leading generation number. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: RevertFixedSites(output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create an operator to revert alleles at fixed loci from value 1 to 0. Parameter subPops is ignored. """ _simuPOP_la.RevertFixedSites_swiginit(self,_simuPOP_la.new_RevertFixedSites(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_RevertFixedSites RevertFixedSites_swigregister = _simuPOP_la.RevertFixedSites_swigregister RevertFixedSites_swigregister(RevertFixedSites) class MutSpaceSelector(BaseSelector): """ Details: This selector assumes that alleles are mutant locations in the mutational space and assign fitness values to them according to a random distribution. The overall individual fitness is determined by either an additive, an multiplicative or an exponential model. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MutSpaceSelector(selDist, mode=EXPONENTIAL, output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=ALL_AVAIL) Details: Create a selector that assigns individual fitness values according to random fitness effects. selDist can be * (CONSTANT, s, h) where s will be used for all mutants. The fitness value for genotypes AA, Aa and aa will be (1, 1-hs, 1-s). If h is unspecified, a default value h=0.5 (additive model) will be used. * (GAMMA_DISTRIBUTION, theta, k, h where s follows a gamma distribution with scale parameter theta and shape parameter k. Fitness values for genotypes AA, Aa and aa will be 1, 1-hs and 1-s. A default value h=0.5 will be used if h is unspecified. * a Python function, which will be called when selection coefficient of a new mutant is needed. This function should return a single value s (with default value h=0.5) or a sequence of (h, s). Mutant location will be passed to this function if it accepts a parameter loc. This allows the definition of site-specific selection coefficients. Individual fitness will be combined in ADDITIVE, MULTIPLICATIVE or EXPONENTIAL mode. (See MlSelector for details). If an output is given, mutants and their fitness values will be written to the output, in the form of 'mutant s h'. """ _simuPOP_la.MutSpaceSelector_swiginit(self,_simuPOP_la.new_MutSpaceSelector(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MutSpaceSelector MutSpaceSelector_swigregister = _simuPOP_la.MutSpaceSelector_swigregister MutSpaceSelector_swigregister(MutSpaceSelector) class MutSpaceMutator(BaseOperator): """ Details: This is an infite site mutation model in mutational space. The alleles in the population is assumed to be locations of mutants. A mutation rate is given that mutate alleles in 'regions'. If number of mutants for an individual exceed the number of loci, 10 loci will be added to everyone in the population. """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MutSpaceMutator(rate, ranges, model=1, output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: This operator accepts a list of ranges which is the 'real range' of each chromosome. Mutation happens with muation rate rate and mutants will be recorded to the population (instead of alleles). By default, this mutator assumes an finite-allele model where all mutations are allowed and if a mutant (allele 1) is mutated, it will be mutated to allele 0 (back mutation). Alternatively (model = 2), an infinite-sites mutation model can be used where mutations can happen only at a new locus. Mutations happen at a locus with existing mutants will be moved to a random locus without existing mutant. A warning message will be printed if there is no vacant locus available. If a valid output is given, mutants will be outputted in the format of "gen mutant ind type" where type is 0 for forward (0->1), 1 for backward (1->0), 2 for relocated mutations, and 3 for ignored mutation because no vacent locus is available. The second mode has the advantage that all mutants in the simulated population can be traced to a single mutation event. If the regions are reasonably wide and mutation rates are low, these two mutation models should yield similar results. """ _simuPOP_la.MutSpaceMutator_swiginit(self,_simuPOP_la.new_MutSpaceMutator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MutSpaceMutator MutSpaceMutator_swigregister = _simuPOP_la.MutSpaceMutator_swigregister MutSpaceMutator_swigregister(MutSpaceMutator) class MutSpaceRecombinator(GenoTransmitter): """ Details: This during mating operator recombine chromosomes, which records mutant locations, using a fixed recombination rate (per base pair). """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ Usage: MutSpaceRecombinator(rate, ranges, output="", begin=0, end=-1, step=1, at=[], reps=ALL_AVAIL, subPops=ALL_AVAIL, infoFields=[]) Details: Create a Recombinator (a mendelian genotype transmitter with recombination and gene conversion) that passes genotypes from parents (or a parent in case of self-fertilization) to offspring. A recombination rate in the unit of base pair is needed. """ _simuPOP_la.MutSpaceRecombinator_swiginit(self,_simuPOP_la.new_MutSpaceRecombinator(*args, **kwargs)) __swig_destroy__ = _simuPOP_la.delete_MutSpaceRecombinator MutSpaceRecombinator_swigregister = _simuPOP_la.MutSpaceRecombinator_swigregister MutSpaceRecombinator_swigregister(MutSpaceRecombinator)