# # declare all options. getParam will use these information to get parameters # from a tk/wxPython-based dialog, command line, config file or user input # options = [ { 'separator': 'Genotype structure:' }, { 'name': 'numChrom', 'default': 10, 'label': 'Number of chromosomes', 'description': 'Number of chromosomes.', 'type': [int], 'validator': simuOpt.valueGT(0) }, { 'name': 'numLoci', 'default': 20, 'label': 'Number of loci on each chrom', 'description': '''Number of loci on each chromosome, current there only equal number of markers on each chromosome is supported.''', 'type': [int], 'validator': simuOpt.valueGT(0) }, { 'name': 'markerType', 'default': 'microsatellite', 'label': 'Marker type', 'description': '''Type of markers. Can be microsatellite or SNP.
}, { 'longarg': 'init_freq=', 'default': [0.2] * 3 + [0.8] * 3, 'label': 'Initial allele-freq for Sub-pop', 'allowedTypes': [types.ListType, types.TupleType], 'description': '', 'validate': simuOpt.valueListOf(simuOpt.valueBetween(0, 1)) }, { 'longarg': 'n_ind=', 'default': 100, 'label': 'Sub-pop Size', 'allowedTypes': [types.IntType, types.LongType], 'description': '', 'validate': simuOpt.valueGT(10) }, { 'longarg': 'n_gen=', 'default': 100, 'useDefault': True, 'label': 'Generations', 'allowedTypes': [types.IntType, types.LongType], 'description': '', 'validate': simuOpt.valueGT(0) }, { 'longarg': 'n_chrom=', 'default': 1, 'label': 'Chromosomes', 'allowedTypes': [types.IntType, types.LongType],
This program demonstrate the Hardy-weinberg equilibrium when the allele frequencies in females and males are different. """ import os, sys, types, time import simuOpt from simuPOP import * options = [ { 'name':'size', 'default':100000, 'label':'Population Size', 'type':[int, long], 'validator':simuOpt.valueGT(0), 'description':'''population size. HWE assumes infinite population size so large population size improves approximity to theoretical estimates.''' }, { 'name':'endGen', 'default':5, 'type':[int, long], 'label':'Ending Generation', 'description':'Length of evolution', 'validator':simuOpt.valueGT(0) }, { 'name':'malleleFreq', 'default':0.4, 'type':[float, long],
locus exists in this population, the genetic map will be used.''', 'validate': simuOpt.valueGE(0), }, {'longarg': 'scale=', 'default': 1, 'useDefault': True, 'allowedTypes': [types.IntType, types.LongType, types.FloatType], 'label': 'Acceleration scale', 'description': '''This parameter is used to speed up recombination, mutation and selection. Briefly speaking, certain parts of the evolutionary process is accelerated but random genetic drift is kept. Please refer to Peng 2008 for more details''', 'validate': simuOpt.valueGT(0), }, {'separator': 'Demographic model'}, {'longarg': 'expandGen=', 'default': 500, 'useDefault': True, 'label': 'Generations to expand', 'description': '''Number of generations to evolve during the population expansion stage. The actual evolved population is scaled down by parameter --scale. (If scale==10, expandGen=1000, the actually evolved generation is 100).''', 'allowedTypes': [types.IntType, types.LongType], 'validate': simuOpt.valueGT(0) }, {'longarg': 'initSize=', 'default': 0,
Note that many simulations will fail because all x chromosomes disappeared because of genetic drift. """ import simuOpt from simuPOP import * import types options = [{ 'arg': 'N:', 'longarg': 'N=', 'default': 10000, 'label': 'population size', 'allowedTypes': [types.IntType, types.LongType], 'validate': simuOpt.valueGT(0) }, { 'arg': 'r:', 'longarg': 'rep=', 'default': 10, 'label': 'Replicates', 'allowedTypes': [types.IntType, types.LongType], 'validate': simuOpt.valueGT(0) }] # this will be used by a duringMating pyOpertor, # however, for this particular problem, you can # use a postMating operator and handle all invidiauls # one by one. The performance will be *much* better. #
'label': 'Chromosomes to use', 'description': 'A list of chromosomes (1-22) to use.', 'allowedTypes': [TupleType, ListType], 'chooseFrom':range(1,23), 'validate': simuOpt.valueListOf(simuOpt.valueBetween(1, 22)), }, { 'name': 'numMarkers', 'default': [2000,2000,2000], 'label': 'Number of markers to use', 'description': '''Number of markers to use for each chromosome. This parameter should be ignored if it is unspecified or is set to zero for some chromosomes. ''', 'allowedTypes': [TupleType, ListType], 'validate': simuOpt.valueOr(simuOpt.valueGT(0), simuOpt.valueListOf(simuOpt.valueGE(0))) }, { 'name': 'startPos', 'default': [25000000, 25000000, 40000000], 'label': 'staring position (bp)', 'description': '''Starting position of the markers on each chromosome. The beginning of the chromosomes will be assumed if this parameter is unspecified or is set to zero.''', 'allowedTypes': [TupleType, ListType], 'validate': simuOpt.valueOr(simuOpt.valueGE(0), simuOpt.valueListOf(simuOpt.valueGE(0))) }, { 'name': 'endPos', 'default': [], 'label': 'Ending position (bp)',
from simuPOP.sampling import drawRandomSample try: from simuPOP.plotter import VarPlotter except: useRPy=False else: useRPy=True options = [ { 'name':'NA', 'default':5000, 'label':'Ancestral Population Size', 'type':[int, long], 'validator':simuOpt.valueGT(0), 'description':'Ancestral population size' }, { 'name':'N1', 'default':1000, 'label':'Daugther 1 Population Size', 'type':[int, long], 'validator':simuOpt.valueGT(0), 'description':'Daughter 1 population size' }, { 'name':'N2', 'default':1000, 'label':'Daugther 2 Population Size', 'type':[int, long],
""" import simuOpt simuOpt.setOptions(alleleType='long') from simuPOP import * import os, sys, types, exceptions, math # declare all options, getParam will use these info to get parameters # from a tk/wx-based dialog, command line, options etc. options = [ {'name': 'numDSL', 'default': 1, 'label': 'Number of DSL', 'description': '''Number of disease susecptibility loci for the disease.''', 'type': [int], 'validator': simuOpt.valueGT(0) }, {'name': 'initSpec', 'default': [0.9]+[0.02]*5, 'label': 'Initial allelic spectrum', 'description': '''Initial allelic spectrum for the disease. It will be the same for all disease susceptibility loci of the disease. The first element should be the allele frequency of the wild type (allele 1) and the rest are frquencies of disease alleles. These frequencies should add up to one. You can also specify spectra for all DSL using a 2d list''', 'type': [types.ListType, types.TupleType], }, {'name': 'selModel', 'default': ['recessive'], 'label': 'Selection model(s)', 'description': '''Given selection coef, for recessive model,
import simuPOP as sim import sys, types, os, math options = [ {'name': 'demo', 'default': 'instant', 'label': 'Population growth model', 'description': 'How does a sim.Population grow from N0 to N1.', 'type': ('chooseOneOf', ['instant', 'exponential']), }, {'name': 'N0', 'default': 10000, 'label': 'Initial sim.population size', 'type': 'integer', 'description': '''Initial sim.population size. This size will be maintained till the end of burnin stage''', 'validator': simuOpt.valueGT(0) }, {'name': 'N1', 'default': 100000, 'label': 'Final sim.population size', 'type': 'integer', 'description': 'Ending sim.population size (after sim.population expansion)', 'validator': simuOpt.valueGT(0) }, {'name': 'G0', 'default': 500, 'label': 'Length of burn-in stage', 'type': 'integer', 'description': 'Number of generations of the burn in stage.', 'validator': simuOpt.valueGT(0) },
simuOpt.setOptions(alleleType='long') from simuPOP import * import os, sys, types, exceptions, math # declare all options, getParam will use these info to get parameters # from a tk/wx-based dialog, command line, options etc. options = [ { 'name': 'numDSL', 'default': 1, 'label': 'Number of DSL', 'description': '''Number of disease susecptibility loci for the disease.''', 'type': [int], 'validator': simuOpt.valueGT(0) }, { 'name': 'initSpec', 'default': [0.9] + [0.02] * 5, 'label': 'Initial allelic spectrum', 'description': '''Initial allelic spectrum for the disease. It will be the same for all disease susceptibility loci of the disease. The first element should be the allele frequency of the wild type (allele 1) and the rest are frquencies of disease alleles. These frequencies should add up to one. You can also specify spectra for all DSL using a 2d list''', 'type': [types.ListType, types.TupleType], }, { 'name': 'selModel',