rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
noDSLChrom = [pop.numLoci(x)==numLoci for x in range(pop.numChrom())].index(True) | try: noDSLChrom = [pop.numLoci(x)==numLoci for x in range(pop.numChrom())].index(True) except: noDSLChrom = -1 | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
i = pop.chromBegin( noDSLChrom) noDSLLD = [ [i+x, i+numLoci/2] for x in range(numLoci/2)] + \ [ [i + numLoci/2, i+x] for x in range(numLoci/2+1, numLoci)] | if noDSLChrom > -1: i = pop.chromBegin( noDSLChrom) noDSLLD = [ [i+x, i+numLoci/2] for x in range(numLoci/2)] + \ [ [i + numLoci/2, i+x] for x in range(numLoci/2+1, numLoci)] else: noDSLLD = [] | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
print >> output, "\n\nD between a center marker %d (chrom %d) and surrounding markers at gen %d" \ % (pop.chromBegin(noDSLChrom)+numLoci/2, noDSLChrom, gen) for ld in noDSLLD: print >> output, '%.4f ' % pop.dvars().LD[ld[0]][ld[1]], | if noDSLChrom > -1 : print >> output, "\n\nD between a center marker %d (chrom %d) and surrounding markers at gen %d" \ % (pop.chromBegin(noDSLChrom)+numLoci/2, noDSLChrom, gen) for ld in noDSLLD: print >> output, '%.4f ' % pop.dvars().LD[ld[0]][ld[1]], | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
print >> output, "\n\nD' between a center marker %d (chrom %d) and surrounding markers at gen %d" \ % (pop.chromBegin(noDSLChrom)+numLoci/2, noDSLChrom, gen) for ld in noDSLLD: print >> output, '%.4f ' % pop.dvars().LD_prime[ld[0]][ld[1]], | if noDSLChrom > -1: print >> output, "\n\nD' between a center marker %d (chrom %d) and surrounding markers at gen %d" \ % (pop.chromBegin(noDSLChrom)+numLoci/2, noDSLChrom, gen) for ld in noDSLLD: print >> output, '%.4f ' % pop.dvars().LD_prime[ld[0]][ld[1]], | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
for ld in pop.dvars().noDSLLD: if ld[1] == pop.chromBegin(pop.dvars().noDSLChrom) + numLoci/2: dist.append(pop.locusDist(ld[0])) else: dist.append(pop.locusDist(ld[1])) ldprime.append(pop.dvars().LD_prime[ld[0]][ld[1]]) ldvalue.append(pop.dvars().LD[ld[0]][ld[1]]) res['DpNon'] = max(ldprime) res['DNon'] = max(ldvalue) ... | if pop.dvars().noDSLChrom > -1: for ld in pop.dvars().noDSLLD: if ld[1] == pop.chromBegin(pop.dvars().noDSLChrom) + numLoci/2: dist.append(pop.locusDist(ld[0])) else: dist.append(pop.locusDist(ld[1])) ldprime.append(pop.dvars().LD_prime[ld[0]][ld[1]]) ldvalue.append(pop.dvars().LD[ld[0]][ld[1]]) res['DpNon'] = max(ldpr... | def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' # return max LD res = {} # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] # D' ldvalue = [] # D for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.append(pop.locusDist(ld[... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): | def TDT(geneHunter, DSL, cutoff, dataDir, data, epsFile, jpgFile): | def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+data+ "_%d" % ch i... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
if not hasRPy: | if not hasRPy or geneHunter in ['', 'none']: | def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+data+ "_%d" % ch i... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): | def Linkage(geneHunter, DSL, cutoff, dataDir, data, epsFile, jpgFile): | def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
if not hasRPy: | if not hasRPy or geneHunter in ['', 'none']: | def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): | mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, geneHunter, dryrun, popIdx): | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
(suc,res) = TDT(pop.dvars().DSL, -math.log10(0.05/pop.totNumLoci()), | (suc,res) = TDT(geneHunter, pop.dvars().DSL, -math.log10(0.05/pop.totNumLoci()), | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
(suc,res) = Linkage(pop.dvars().DSL, -math.log10(0.05/pop.totNumLoci()), | (suc,res) = Linkage(geneHunter, pop.dvars().DSL, -math.log10(0.05/pop.totNumLoci()), | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
dryrun, popIdx) | geneHunter, dryrun, popIdx) | def writeReport(content, allParam, numChrom, numLoci, DSLafter, peneFunc, numSample, results): ''' write a HTML file. The parts for each population has been written but we need a summary table. ''' print "Writing a report (saved in summary.htm )" try: summary = open(outputDir + "/summary.htm", 'w') except: raise except... | a136497e0e1088471de0ae39dc64a100205947ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/a136497e0e1088471de0ae39dc64a100205947ce/simuComplexDisease.py |
opt['label'] = a.pop('configname') | opt['label'] = opt('configName') | def getParam(options=[], doc='', details='', noDialog=False, checkUnprocessedArgs=True, verbose=False, nCol=1): """ get parameter from either - useTk ... - command line argument - configuration file specified by -f file, or - prompt for user input parameter: verbose: whether or not print detailed info checkUnprocesse... | b327a73ed75b2161d70629da4d5dfc95b2292e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/b327a73ed75b2161d70629da4d5dfc95b2292e7f/simuOpt.py |
'''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy) > 0: ploidy = atPloidy else: ploidy = range(0, pop.ploidy()) if len(... | '''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy) > 0: ploidy = atPloidy | def getGenotype(pop, atLoci=[], subPop=[], indRange=[], atPloidy=[]): '''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
for i in range(pop.popSize()): for p in ploidy: for loc in loci: geno.append( arr[ gs*i + p*tl +loc] ) return geno | ploidy = range(0, pop.ploidy()) if len(atLoci) > 0: loci = atLoci else: loci = range(pop.totNumLoci()) gs = pop.genoSize() tl = pop.totNumLoci() if len(indRange) > 0: if type(indRange[0]) not in [type([]), type(())]: indRange = [indRange] arr = pop.arrGenotype() for r in indRange: for i in range(r[0], r[1]): for p in p... | def getGenotype(pop, atLoci=[], subPop=[], indRange=[], atPloidy=[]): '''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ if level < 0 or (level > 0 and curLevel < level): if type(var) == types.ListType or type(var) == types.TupleType: index = 0 for x in var: if type(x) != types.ListType and type(x) != types.DictType: if x !=... | ''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ if level < 0 or (level > 0 and curLevel < level): if type(var) == types.ListType or type(var) == types.TupleType: index = 0 for x in var: if type(x) != types.ListType and type(x) != types.DictType: if x !=... | def _listVars(var, level=-1, name='', subPop=True, indent=0, curLevel=0): ''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ # all level or level < specified maximum level if level < 0 or (level > 0 and curLevel < level): # list is list or typle type if type(va... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
print ' '*indent, var else: if type(var) == types.ListType or type(var) == types.TupleType: print ' '*indent, 'list of length', len(var) elif type(var) == types.DictType: print ' '*indent, 'dict with keys [', for num in range(0,len(var.keys())): if type(var.keys()[num]) == types.StringType: print "'"+ var.keys()[num] +... | if type(var) == type( dw({}) ): fillFrame = fill.FillingFrame(rootObject=var.__dict__, rootLabel='var') else: fillFrame = fill.FillingFrame(rootObject=var, rootLabel='var') fillFrame.Show(True) app.SetTopWindow(fillFrame) app.MainLoop() | def _listVars(var, level=-1, name='', subPop=True, indent=0, curLevel=0): ''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ # all level or level < specified maximum level if level < 0 or (level > 0 and curLevel < level): # list is list or typle type if type(va... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' The population size is constant, but will split into numSubPop subpopulations at generation split ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [int(bottleneckSize/numSubPop)]*numSubPop if gen < split: return [size] else: return [int(size/numSubPop)]*n... | ''' The population size is constant, but will split into numSubPop subpopulations at generation split ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [int(bottleneckSize/numSubPop)]*numSubPop if gen < split: return [size] else: return [int(size/numSubPop)]*n... | def constSize(size, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' The population size is constant, but will split into numSubPop subpopulations at generation split ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [int(bottleneckSize/numSubPop)... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' Linearly expand population size from intiSize to endSize after burnin, split the population at generation split. ''' inc = (endSize-initSize)/float(end-burnin) def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*numSubPop if gen <= bur... | ''' Linearly expand population size from intiSize to endSize after burnin, split the population at generation split. ''' inc = (endSize-initSize)/float(end-burnin) def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*numSubPop if gen <= bur... | def LinearExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Linearly expand population size from intiSize to endSize after burnin, split the population at generation split. ''' inc = (endSize-initSize)/float(end-burnin) def func(gen, oldSize=[]): if gen == bottle... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' Exponentially expand population size from intiSize to endSize after burnin, split the population at generation split. ''' rate = (math.log(endSize)-math.log(initSize))/(end-burnin) def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*num... | ''' Exponentially expand population size from intiSize to endSize after burnin, split the population at generation split. ''' rate = (math.log(endSize)-math.log(initSize))/(end-burnin) def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*num... | def ExponentialExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Exponentially expand population size from intiSize to endSize after burnin, split the population at generation split. ''' rate = (math.log(endSize)-math.log(initSize))/(end-burnin) def func(gen, old... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' Instaneously expand population size from intiSize to endSize after burnin, split the population at generation split. ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*numSubPop if gen <= burnin: tot = initSize else: tot = endSiz... | ''' Instaneously expand population size from intiSize to endSize after burnin, split the population at generation split. ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [bottleneckSize/numSubPop]*numSubPop if gen <= burnin: tot = initSize else: tot = endS... | def InstantExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Instaneously expand population size from intiSize to endSize after burnin, split the population at generation split. ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bott... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
g = range(end) rng = [min( [ func(x)[0] for x in g]), max( [ sum(func(x)) for x in g])] r.plot(g, [sum(func(x)) for x in g], ylim=rng, type='l', xlab='gen', ylab='subPopSize(0)') r.lines(g, [func(x)[0] for x in g], type='l', xlab='gen', ylab='subPopSize(0)', lty=2) | g = range(end) rng = [min( [ func(x)[0] for x in g]), max( [ sum(func(x)) for x in g])] r.plot(g, [sum(func(x)) for x in g], ylim=rng, type='l', xlab='gen', ylab='subPopSize(0)') r.lines(g, [func(x)[0] for x in g], type='l', xlab='gen', ylab='subPopSize(0)', lty=2) | def testDemoFunc(end, func): g = range(end) rng = [min( [ func(x)[0] for x in g]), max( [ sum(func(x)) for x in g])] r.plot(g, [sum(func(x)) for x in g], ylim=rng, type='l', xlab='gen', ylab='subPopSize(0)') r.lines(g, [func(x)[0] for x in g], type='l', xlab='gen', ylab='subPopSize(0)', lty=2) | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' migration rate matrix x m/(n-1) m/(n-1) .... m/(n-1) x ............ ..... .... m/(n-1) m/(n-1) x where x = 1-m ''' if n == 1: return [[1]] m = [] for i in range(0,n): m.append( [r/(n-1.)]*n) m[-1][i] = 1-r return m | ''' migration rate matrix x m/(n-1) m/(n-1) .... m/(n-1) x ............ ..... .... m/(n-1) m/(n-1) x where x = 1-m ''' if n == 1: return [[1]] m = [] for i in range(0,n): m.append( [r/(n-1.)]*n) m[-1][i] = 1-r return m | def migrIslandRates(r, n): ''' migration rate matrix x m/(n-1) m/(n-1) .... m/(n-1) x ............ ..... .... m/(n-1) m/(n-1) x where x = 1-m ''' # n==1? if n == 1: return [[1]] # m = [] for i in range(0,n): m.append( [r/(n-1.)]*n) m[-1][i] = 1-r return m | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
''' migration rate matrix, circular step stone model (X=1-m) | ''' migration rate matrix, circular step stone model (X=1-m) | def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
if n < 2: raise exceptions.ValueError("Can not define step stone model for n < 2") elif n == 2: return [[1-r,r],[r,1-r]] m = [] for i in range(0, n): m.append([0]*n) m[i][i] = 1-r m[i][(i+1)%n] = r/2. m[i][(i+n-1)%n] = r/2. if not circular: m[0][1] = r m[0][-1] = 0 m[n-1][0] = 0 m[n-1][n-2] = r return m | if n < 2: raise exceptions.ValueError("Can not define step stone model for n < 2") elif n == 2: return [[1-r,r],[r,1-r]] m = [] for i in range(0, n): m.append([0]*n) m[i][i] = 1-r m[i][(i+1)%n] = r/2. m[i][(i+n-1)%n] = r/2. if not circular: m[0][1] = r m[0][-1] = 0 m[n-1][0] = 0 m[n-1][n-2] = r return m | def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\t"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' return eval(cmd) | parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\t"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' return eval(cmd) | def tab(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\t"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' return eval(cmd) | parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' return eval(cmd) | def endl(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
""" collect variables so that plotters can plot them all at once You can of course put it in other uses Usage: a = dataAggregator( maxRecord=0, recordSize=0) maxRecord: if more data is pushed, the old ones are discarded recordSize: size of record a.push(gen, data, idx=-1) gen: generation number data: on... | """ collect variables so that plotters can plot them all at once You can of course put it in other uses Usage: a = dataAggregator( maxRecord=0, recordSize=0) maxRecord: if more data is pushed, the old ones are discarded recordSize: size of record a.push(gen, data, idx=-1) gen: generation number data: one reco... | def endl(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
Internal data storage: self.gen [ .... ] self.data column1 [ ...... ] column2 [ ...... ] ....... each record is pushed at the end of """ def __init__(self, maxRecord=0, recordSize=0): """ maxRecord: maxRecorddow size. I.e., maximum generations of data to keep """ self.gen = [] self.data = [] self.maxRecord = maxRe... | def __repr__(self): s = str(self.gen) + "\n" for i in range(0, len(self.data)): s += str(self.data[i]) + "\n" return s def clear(self): self.gen = [] self.data = [] def ready(self): return self.recordSize>0 and len(gen)>0 and len( data[0] ) == len( data[-1] ) def flatData(self): res = [] for d in self.data: res.exte... | def endl(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
value = eval(expr, globals(), pop.vars()) d = pop.vars() if not d.has_key(name): d[name] = {} d[name][gen] = value | value = eval(expr, globals(), pop.vars()) d = pop.vars() if not d.has_key(name): d[name] = {} d[name][gen] = value | def CollectValue(pop, gen, expr, name): value = eval(expr, globals(), pop.vars()) d = pop.vars() if not d.has_key(name): d[name] = {} d[name][gen] = value | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' opt = '''pyExec(exposePop=1, %s stmts=r\'\'\'CollectValue(pop, gen, expr="""%s""", name="""%s""")\'\'\')''' \ % ( parm, expr, name) return eval(opt) | parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' opt = '''pyExec(exposePop=1, %s stmts=r\'\'\'CollectValue(pop, gen, expr="""%s""", name="""%s""")\'\'\')''' \ % ( parm, expr, name) return eval(opt) | def collector(name, expr, **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # Collect(pop, expr, name) # """) opt = '''pyExec(exposePop=1, %s stmts=r\'\'\'CollectValue(pop, gen, expr="""%s""", name="""%s""")\'... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) else: raise exceptions.ValueError, "Please specify output or outputExpr" try: f = open(file, "w") except exceptions.IOError: raise exceptions.IOError, "Can not open file " + file + " to write." np = pop.numSubPop() ... | if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) else: raise exceptions.ValueError, "Please specify output or outputExpr" try: f = open(file, "w") except exceptions.IOError: raise exceptions.IOError, "Can not open file " + file + " to write." np = pop.numSubPop() ... | def SaveFstat(pop, output='', outputExpr='', maxAllele=0): if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) else: raise exceptions.ValueError, "Please specify output or outputExpr" # open file try: f = open(file, "w") except exceptions.IOError: raise exceptions.IOErr... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' opt = '''pyEval(exposePop=1, %s stmts=r\'\'\'SaveFstat(pop, rep=rep, output=r"""%s""", outputExpr=r"""%s""" )\'\'\')''' % ( parm, output, outputExpr) return eval(opt) | parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' opt = '''pyEval(exposePop=1, %s stmts=r\'\'\'SaveFstat(pop, rep=rep, output=r"""%s""", outputExpr=r"""%s""" )\'\'\')''' % ( parm, output, outputExpr) return eval(opt) | def saveFstat(output='', outputExpr='', **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # saveInFSTATFormat( pop, rep=rep?, output=output?, outputExpr=outputExpr?) # """) opt = '''pyEval(exposePop=1, %s stmt... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") try: [np, nl, nu, nd] = map(int, f.readline().split()) except exceptions.ValueError: raise exceptions.ValueError("The first line does not have 4 numbers. Are you sure this is a FSTAT file?") nu... | try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") try: [np, nl, nu, nd] = map(int, f.readline().split()) except exceptions.ValueError: raise exceptions.ValueError("The first line does not have 4 numbers. Are you sure this is a FSTAT file?") nu... | def LoadFstat(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") # # file is opened. get basic parameters try: # get numSubPop(), totNumLoci(), maxAllele(), digit [np, nl, nu, nd] = map(int, f.readline().split()) except exc... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") gt = [] for line in f.readlines(): gt.append( line.split() ) f.close() popSize = len(gt) numAllele = (len(gt[0]))/2-1 if reduce(operator.add, loci,0.) == numAllele: lociNum = loci else: lociNum ... | try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") gt = [] for line in f.readlines(): gt.append( line.split() ) f.close() popSize = len(gt) numAllele = (len(gt[0]))/2-1 if reduce(operator.add, loci,0.) == numAllele: lociNum = loci else: lociNum ... | def LoadGCData(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") gt = [] for line in f.readlines(): gt.append( line.split() ) f.close() # now we have a 2-d matrix of strings # population size? popSize = len(gt) # number of... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be saved. Must have ancestralDepth 1. paired individuals are sibs. Parental population are co... | recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be saved. Must have ancestralDepth 1. paired individuals are sibs. Parental population are co... | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
popType: population type. Can be 'sibpair' or 'bySubPop'. If type is sibpair, pairs of individuals will be considered as sibpairs. If type is bySubPop, individuals in a subpopulation is considered as siblings. output: output.dat and output.ped will be the data and pedigree file. You may need to rename them to be analy... | chromsome famID,indID,sex,affectedness,allel1-1,allel1-2,allele2-1,allele2-2, ... ... chromosome """ if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
pedFile = open(file + ".ped", "w") except exceptions.IOError: raise exceptions.IOError, "Can not open file " + file + ".dat/.ped to write." markers = [pop.chromBegin(chrom)+m for m in range(pop.numLoci(chrom))] for e in exclude: markers.remove(e) dataFile.write( '''%d 0 0 5 << nlocus, risklocus, sexlink, n... | raise exceptions.ValueError, "Please specify output or outputExpr" markers = {} for ch in range(0,pop.numChrom()): markers[ch] = [] for m in range(0, pop.numLoci(ch)): if not pop.chromBegin(ch) + m in exclude: markers[ch].append(m) try: out = open( file, "w") except exceptions.IOError: raise exceptions.IOError, "Can n... | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
for ped in range(0, np): pop.useAncestralPop(1) par1 = pop.individual(2*ped) if pre: pedFile.write("%3d 1 0 0 %d %d " \ % (ped+1, sexCode(par1), affectedCode(par1))) else: pedFile.write("%3d 1 0 0 3 0 0 %d 0 %d " \ % (ped+1, sexCode(par1), affectedCode(par1))) pedFile.write( genoStr(par1) + '\n' ) par2 = pop.individ... | for ch in range(0, pop.numChrom()): for ped in range(0, np): pop.useAncestralPop(1) par1 = pop.individual(2*ped) content[ch] += "%3d,1,%d,%d" % (ped+1, sexCode(par1), affectedCode(par1)) content[ch] += genoStr(par1, ch) + '\n' par2 = pop.individual(2*ped+1) content[ch] += "%3d,2,%d,%d" % (ped+1, sexCode(par2), affe... | def genoStr(ind): string = '' for marker in markers: string += "%d %d " % (ind.allele(marker, 0)+1, ind.allele(marker, 1)+1) return string | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
""" load file from randfam CSV format file: input file For format description, please see SaveCSV """ try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") def sexCode(code): if code == 1: return Male | """ load file from randfam CSV format file: input file For format description, please see SaveCSV """ try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") def sexCode(code): if code == 1: return Male else: ret... | def LoadCSV(file): """ load file from randfam CSV format file: input file For format description, please see SaveCSV """ # determine files to read try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") # sex code ... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
return Female def affectedCode(code): if code == 1: return True else: return False numLoci = [] lociOrder = [] lociPos = [] lociNames = [] for line in allLines: if line[:10] == 'Chromosome': numLoci.append(0) lociOrder.append([]) lociPos.append([]) lociNames.append([]) i = len(numLoci) - 1 chInfo = line.split(',') n... | raise exceptions.ValueError("Wrong freq length") spTraj = [0]*numSP*numLoci for sp in range(numSP): print "Generting trajectory for subpopulation %d (generation %d - %d)" % (sp, split, curGen) def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] while True: t = FreqTrajectoryM... | def sexCode(code): if code == 1: return Male else: return Female | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
fitness=fitness, minMutAge=minMutAge, maxMutAge=maxMutAge, restartIfFail=restartIfFail) if len(traj) == 0: print "Failed to generate trajectory. You may need to set a different set of parameters." sys.exit(1) return (traj, [curGen-len(x)+1 for x in traj], trajFunc(curGen, traj)) split = curGen; while(True): if len(Nt... | def FreqTrajectoryMultiStochWithSubPop( curGen, numLoci, freq, NtFunc, fitness, minMutAge, maxMutAge, mode = 'uneven', restartIfFail=True): ''' Simulate frequency trajectory with subpopulation structure, migration is currently ignored. The essential part of this script is to simulate the trajectory of each subpopulatio... | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py | |
minMutAge=curGen-split, maxMutAge=curGen-split, restartIfFail=False) if 0 in [len(x) for x in t]: print "Failed to generate trajectory. You may need to set a different set of parameters." sys.exit(1) if 0 in [x[0] for x in t]: print "Subpop return 0 index. restart " else: break; | minMutAge=minMutAge-len(traj[0])+1, maxMutAge=maxMutAge-len(traj[0])+1, ploidy=ploidy, restartIfFail=True) if 1 in [len(x) for x in trajBeforeSplit]: print "Failed to generated trajectory. (Tried more than 1000 times)" sys.exit(0) def trajFuncWithSubPop(gen): if gen >= split: return [spTraj[x][gen-split] for x in range... | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
spTraj[sp+i*numSP] = t[i] traj = [] for i in range(numLoci): traj.append([]) for g in range(split, curGen+1): totAllele = sum( [ spTraj[sp+i*numSP][g-split] * NtFunc(g)[sp] for sp in range(numSP) ]) traj[i].append( totAllele / sum(NtFunc(g)) ) print "Starting allele frequency (at split) ", [traj[i][0] for i in range(... | trajAll.append( [] ) trajAll[i].extend(trajBeforeSplit[i]) trajAll[i].extend(traj[i][1:]) return (trajAll, [curGen-len(x)+1 for x in trajAll ], trajFuncWithSubPop) | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
pass | pass | def trajFuncWithSubPop(gen): if gen >= split: return [spTraj[x][gen-split] for x in range(numLoci*numSP)] else: freq = [] for tr in trajBeforeSplit: if gen < split - len(tr) + 1: freq.append( 0 ) else: freq.append( tr[ gen - (split - len(tr) + 1) ] ) return freq | 221d6e46bb102816794d97211e9ea83f19d74d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/221d6e46bb102816794d97211e9ea83f19d74d6c/simuUtil.py |
off.setAllele(pop.gen(), 0) return True | off.setAllele(pop.gen(), 0) return True | def setGen(pop, off, dad, mom): off.setAllele(pop.gen(), 0) return True | 467f05af36b87d2f819d1a9dc7420d10e3ebf810 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/467f05af36b87d2f819d1a9dc7420d10e3ebf810/test_05_matings.py |
def testNoMating(self): 'Testing noMating mating scheme' simu = simulator(population(10, loci=[1], ploidy=1), noMating()) simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.assertEqual( simu.population(0).arrGenotype(), [0]*10) simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.asse... | def testNoMating(self): 'Testing noMating mating scheme' simu = simulator(population(10, loci=[1], ploidy=1), noMating()) simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.assertEqual( simu.population(0).arrGenotype(), [0]*10) simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.asse... | def testNoMating(self): 'Testing noMating mating scheme' simu = simulator(population(10, loci=[1], ploidy=1), noMating()) # during mating operator will be applied simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.assertEqual( simu.population(0).arrGenotype(), [0]*10) simu.step( ops=[ pyOperator(func=... | 467f05af36b87d2f819d1a9dc7420d10e3ebf810 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/467f05af36b87d2f819d1a9dc7420d10e3ebf810/test_05_matings.py |
## def testTrajectoryStoch(self): | 467f05af36b87d2f819d1a9dc7420d10e3ebf810 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/467f05af36b87d2f819d1a9dc7420d10e3ebf810/test_05_matings.py | ||
def testControlledMating(self): 'Testing controlled mating' freq = FreqTrajectoryStoch(freq=0.05, N=100) burnin = 100 mutAge = len(freq) def freqRange(gen): if gen <= burnin: return [0,1] expected = freq[gen-1-burnin] return [expected, expected + 0.05] simu = simulator( population(100, lo... | def testControlledMating(self): 'Testing controlled mating' freq = FreqTrajectoryStoch(freq=0.05, N=100) burnin = 100 mutAge = len(freq) def freqRange(gen): if gen <= burnin: return [0,1] expected = freq[gen-1-burnin] return [expected, expected + 0.05] simu = simulator( population(100, lo... | ## def testTrajectoryMultiStoch(self): | 467f05af36b87d2f819d1a9dc7420d10e3ebf810 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/467f05af36b87d2f819d1a9dc7420d10e3ebf810/test_05_matings.py |
def mate(par, off): ''' a function that get aprental, offspring generations it will select all male and add 1 to their age, and spread to the generation ''' idx = par.infoIdx('age') for i in range(par.popSize()): ind = par.individual(i) ind.setInfo(ind.info(idx)+1, idx) return True pop = population(20, loci=[1], infoF... | def testPyMating(self): ' test pyMating ' | 467f05af36b87d2f819d1a9dc7420d10e3ebf810 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/467f05af36b87d2f819d1a9dc7420d10e3ebf810/test_05_matings.py | |
os.remove(logFile) | try: os.remove(logFile) except: pass | def last_two(gen): if gen >= endGen -2: return 2 else: return 1 | 09b4bd660f6b2f9ad2482f436371cee45901a209 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/09b4bd660f6b2f9ad2482f436371cee45901a209/simuComplexDisease.py |
for val in values[g]: entryWidgets[g].select_set( opt['chooseFrom'].index(val)) | if type(values[g]) in [types.TupleType, types.ListType]: for val in values[g]: entryWidgets[g].select_set( opt['chooseFrom'].index(val)) else: entryWidgets[g].select_set( opt['chooseFrom'].index( values[g] )) | def doOK(event): " OK buton is pressed " root1.quit() | 9f8ba07926e3e3988189cc735092033d26860ba4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/9f8ba07926e3e3988189cc735092033d26860ba4/simuOpt.py |
if type(values[g]) in [types.ListType, types.TupleType] and len(values[g])>0: | if type(values[g]) in [types.ListType, types.TupleType]: | def formatDesc(text): # linux can auto wrap, windows can not but sometime wrap # at unexpected places... It is safer to wrap at original # place. return '\n'.join( [x.strip() for x in text.splitlines()] ) | 9f8ba07926e3e3988189cc735092033d26860ba4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/401/9f8ba07926e3e3988189cc735092033d26860ba4/simuOpt.py |
db = multi_database(options.databases)[0][0] | db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0] | def debug(args=None): options = load_options(args) zope.app.appsetup.config(options.site_definition) db = multi_database(options.databases)[0][0] notify(zope.app.appsetup.interfaces.DatabaseOpened(db)) return db | ae4a09608d02383aedfef11b862e8a4fee08693c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9654/ae4a09608d02383aedfef11b862e8a4fee08693c/main.py |
"ptyperegisterinit", map | "ptyperegisterinit", | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | e11779d081bb50419a73327514ff2ba2acd1a5ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/e11779d081bb50419a73327514ff2ba2acd1a5ba/readcfg.py |
sys.path = ".." | sys.path = os.getcwd() | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | d37620766061489b262d12501c46388fbc049f35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/d37620766061489b262d12501c46388fbc049f35/readcfg.py |
e = "../overrides/" + xsubdir | e = gtkpascalgen_outdir + "/overrides/" + xsubdir | def psimplevardecl(vartype, varname): global needtypes global c2penumcopied global wrapperprefix #extra = "" a = vartype.split(" ") extra = " ".join(a[:-1]) if a[-1].endswith("*"): a[-1] = "P" + a[-1][:-1] if a[-1].endswith("*"): # actually this is an c array most of the time so this here is "wrong" a[-1] = "P" + a[-... | a28d84b9e5391aa1aa04c66318d3c5133a71e2b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/a28d84b9e5391aa1aa04c66318d3c5133a71e2b2/scanclasses.py |
nf = os.path.join("..", "output", os.path.basename(xsubdir), pfilename) | nf = os.path.join(gtkpascalgen_outdir, "output", os.path.basename(xsubdir), pfilename) | def psimplevardecl(vartype, varname): global needtypes global c2penumcopied global wrapperprefix #extra = "" a = vartype.split(" ") extra = " ".join(a[:-1]) if a[-1].endswith("*"): a[-1] = "P" + a[-1][:-1] if a[-1].endswith("*"): # actually this is an c array most of the time so this here is "wrong" a[-1] = "P" + a[-... | a28d84b9e5391aa1aa04c66318d3c5133a71e2b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/a28d84b9e5391aa1aa04c66318d3c5133a71e2b2/scanclasses.py |
print classname, "warning", fn["name"], "parameter is overridden const but was not originally var" | print classname, "warning", fn["name"], "parameter is overridden 'const' but was not originally 'var'" | def func_cb(varname, fn): global classname global cclassconstructparams global c2pfuncparamoverride global pextratypes global c2pcallbackpointers global preturntransformers global poverridearraytypes global wrapperpointerprefix global wrapperprefix global pstringtype global interfaceprefix if fn["name"] in c2pfuncparam... | 18da3727386bfab1a4356cdae87ddce393e0db6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/18da3727386bfab1a4356cdae87ddce393e0db6e/tool.py |
print classname, "warning", fn["name"], "parameter is overridden const but was not originally var" | print classname, "warning", fn["name"], "parameter is overridden 'out' but was not originally 'var'" | def func_cb(varname, fn): global classname global cclassconstructparams global c2pfuncparamoverride global pextratypes global c2pcallbackpointers global preturntransformers global poverridearraytypes global wrapperpointerprefix global wrapperprefix global pstringtype global interfaceprefix if fn["name"] in c2pfuncparam... | 18da3727386bfab1a4356cdae87ddce393e0db6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/18da3727386bfab1a4356cdae87ddce393e0db6e/tool.py |
print "NO", rest | def fnsFromFNLines(fnlines): fns = {} rest = "" for fnline in fnlines: rest = rest + fnline.replace("\n", "") if fnline.find(";") > -1: #fns.append(rest) if rest.find("(*Gtk") > -1: # probably a function pointer type (I hope only them) rest = "" continue if rest.find("(*Gdk") > -1: # probably a function pointer type (I... | ee77859b026dea5dadb8e35699d8a1cdafdbaecc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/ee77859b026dea5dadb8e35699d8a1cdafdbaecc/tool2.py | |
line = line.replace(")</programlisting>", ");") | def stripTags(line): match = re.search(r"^(.*)\)[ ]*:[^<]*</programlisting>.*$", line) if match != None: line = match.group(1) + ");" #line = line.replace(")</programlisting>", ");") # gtk 2.8 forgot the ";" :) while True: match = indexterm1.match(line) if match == None: break line = match.group(1) + match.group(3) ... | 89c077dc9bd529e347b9846ba575674bcdff7fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/89c077dc9bd529e347b9846ba575674bcdff7fd4/tool2.py | |
print sys.path | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | 7a005f36deb3dff22efb243c37058a49d2d67a70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2589/7a005f36deb3dff22efb243c37058a49d2d67a70/readcfg.py | |
return _prelude.idmef_time_get_sec(self.res) | return int(_prelude.idmef_time_get_sec(self.res)) | def __int__(self): """Return the number of seconds.""" return _prelude.idmef_time_get_sec(self.res) | 02c4b516a706795fdcbf027fd9e25e3d175a636a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/02c4b516a706795fdcbf027fd9e25e3d175a636a/prelude.py |
if type(py_value) is not str: raise IDMEFValueError(py_value, "expected %s, got %s" % (str, type(py_value))) | def _idmef_value_python_to_c(object, py_value): object_type = _prelude.idmef_object_get_value_type(object) if object_type is _prelude.IDMEF_VALUE_TYPE_TIME: time = _idmef_value_time_python_to_c(py_value) c_value = _prelude.idmef_value_new_time(time) if not c_value: raise Error() elif object_type in [ _prelude.IDMEF_V... | 02c4b516a706795fdcbf027fd9e25e3d175a636a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/02c4b516a706795fdcbf027fd9e25e3d175a636a/prelude.py | |
return (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) | value = (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) return value | def idmef_value_c_to_python(value): func_type_table = { _prelude.IDMEF_VALUE_TYPE_INT8: _prelude.idmef_value_get_int8, _prelude.IDMEF_VALUE_TYPE_UINT8: _prelude.idmef_value_get_uint8, _prelude.IDMEF_VALUE_TYPE_INT16: _prelude.idmef_value_get_int16, _prelude.IDMEF_VALUE_TYPE_UINT16: _prelude.idmef_value_g... | 02c4b516a706795fdcbf027fd9e25e3d175a636a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/02c4b516a706795fdcbf027fd9e25e3d175a636a/prelude.py |
m = re.compile("(\w+)\[(\w+)\]").match(self.name) | m = re.compile("(.+)\[(.+)\]").match(self.name) | def __init__(self, parent, option): self.parent = parent self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(\w+)\[(\w+)\]").match(self.name) self.in... | 228325325afc82d3251c6659e4c34b19fb722c41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/228325325afc82d3251c6659e4c34b19fb722c41/prelude.py |
_prelude.idmef_value_destroy(c_value) | if c_value != None: _prelude.idmef_value_destroy(c_value) | def __getitem__(self, object_name): """Get the value of the object in the message.""" object = _prelude.idmef_object_new_fast(object_name) if not object: raise IDMEFObjectError(object_name) c_value = _prelude.idmef_object_get(self.res, object) _prelude.idmef_object_destroy(object) | 11928dd877bbd7a680b6e5758f44aa8310b98bfa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/11928dd877bbd7a680b6e5758f44aa8310b98bfa/prelude.py |
self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) | self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.HAVE_CONTEXT) | def __init__(self, parent, option): self.parent = parent self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(.+)\[(.+)\]").match(self.name) self.inst... | 780e4b934e64cc9d2b05d439842fd90b06150b25 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/780e4b934e64cc9d2b05d439842fd90b06150b25/prelude.py |
if _prelude.prelude_client_init(self._client, name, config, len(sys.argv), sys.argv) < 0: | if _prelude.prelude_client_init(self._client, name, config, 1, [ sys.argv[0] ]) < 0: | def __init__(self, name, config=None): if not name: name = sys.argv[0] if not config: file = os.popen("libprelude-config --prefix") path = file.read() file.close() config = path[:-1] + "/etc/prelude/default/client.conf" self._client = _prelude.prelude_client_new(_prelude.PRELUDE_CLIENT_CAPABILITY_SEND_IDMEF) if not s... | 070f5053aeb7a0f72cb810770d3e67f7c5ad1a50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/070f5053aeb7a0f72cb810770d3e67f7c5ad1a50/prelude.py |
def __init__(self, parent, name, description, value): | def __init__(self, parent, option): | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) | cd1da66868e748e65faa498ebd346bf8a3a2b7a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/cd1da66868e748e65faa498ebd346bf8a3a2b7a7/prelude.py |
self.name = name self.description = description self.value = value | self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(\w+)\[(\w+)\]").match(self.name) self.instantiable_name = m.group(1) self.instance_name = m.group... | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) | cd1da66868e748e65faa498ebd346bf8a3a2b7a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/cd1da66868e748e65faa498ebd346bf8a3a2b7a7/prelude.py |
nodes = [ name ] | nodes = [ self.name ] | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) | cd1da66868e748e65faa498ebd346bf8a3a2b7a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/cd1da66868e748e65faa498ebd346bf8a3a2b7a7/prelude.py |
name = _prelude.prelude_option_get_longopt(cur) value = _prelude.prelude_option_get_value(cur) description = _prelude.prelude_option_get_description(cur) option = Option(parent, name, description, value) | option = Option(parent, cur) | def _get_option_list(self, parent, start): options = [ ] cur = None while True: cur = _prelude.prelude_option_get_next(start, cur) if not cur: break name = _prelude.prelude_option_get_longopt(cur) value = _prelude.prelude_option_get_value(cur) description = _prelude.prelude_option_get_description(cur) option = Option... | cd1da66868e748e65faa498ebd346bf8a3a2b7a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/cd1da66868e748e65faa498ebd346bf8a3a2b7a7/prelude.py |
def set_option(self, analyzerid, name, value): msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, "%s=%s" % (name, value)) | def set_option(self, analyzerid, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, value) | def set_option(self, analyzerid, name, value): msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, "%s=%s" % (name, value)) retval = _prelude.prelude_option_recv_set(msg) return retval | cd1da66868e748e65faa498ebd346bf8a3a2b7a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/cd1da66868e748e65faa498ebd346bf8a3a2b7a7/prelude.py |
if len < 0: | if size < 0: | def __str__(self): """Return the RFC8601 string representation of the object.""" buf = "A" * 128 | 1b7dc3f35091317fb9402de1bad86b9946d2cd8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/1b7dc3f35091317fb9402de1bad86b9946d2cd8f/prelude.py |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def set_option(self, analyzer_path, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_SET, value) if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read set_option answer") | 3bfc82e9c10910b733a22d5234759df6bed00671 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3bfc82e9c10910b733a22d5234759df6bed00671/prelude.py |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def commit(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_COMMIT, instance) if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read commit answer") | 3bfc82e9c10910b733a22d5234759df6bed00671 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3bfc82e9c10910b733a22d5234759df6bed00671/prelude.py |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def destroy(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_DESTROY, instance) | 3bfc82e9c10910b733a22d5234759df6bed00671 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3bfc82e9c10910b733a22d5234759df6bed00671/prelude.py |
RECV_IDMEF = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_IDMEF SEND_IDMEF = _prelude.PRELUDE_CLIENT_CAPABILITY_SEND_IDMEF RECV_ADMIN = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_ADMIN SEND_ADMIN = _prelude.PRELUDE_CLIENT_CAPABILITY_SEND_ADMIN RECV_CM = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_CM SEND_CM = _prelude.PRELUDE_CLIE... | def get_libprelude_prefix(): return os.popen("libprelude-config --prefix").read()[:-1] | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py | |
class Admin(Client): | class Admin: | def is_section(self): return len(self.options) > 0 | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
Client.__init__(self, Client.SEND_ADMIN, name, get_libprelude_prefix() + "/etc/prelude/default/client.conf") self._manager_connection = _prelude.prelude_connection_new(self._client, address, port) if not self._manager_connection: raise ClientError("could not create new connection to %s:%p" % (address, port)) if _prel... | self._profile = _prelude.prelude_client_profile_new(name or sys.argv[0]) if not self._profile: raise ClientError("could not create client profile for %s" % name or sys.argv[0]) self._connection = _prelude.prelude_connection_new(address, port) if not self._connection: raise ClientError("could not create connection to %... | def __init__(self, name=None, address="127.0.0.1", port=5554): Client.__init__(self, Client.SEND_ADMIN, name, get_libprelude_prefix() + "/etc/prelude/default/client.conf") self._manager_connection = _prelude.prelude_connection_new(self._client, address, port) if not self._manager_connection: raise ClientError("could n... | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
_prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) | _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(sel... | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._manager_connection)) | msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(sel... | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
c_data = _prelude.idmef_data_new_dup(py_value, len(py_value) + 1) | if type(py_value) is str: c_data = _prelude.idmef_data_new_char_string_dup(py_value) elif type(py_value) is int: c_data = _prelude.idmef_data_new_uint32(py_value) elif type(py_value) is long: c_data = _prelude.idmef_data_new_uint64(py_value) else: raise IDMEFValueError(py_value, "type %s is not handled by idmef_data" %... | def _idmef_value_python_to_c(object, py_value): object_type = _prelude.idmef_object_get_value_type(object) if object_type is _prelude.IDMEF_VALUE_TYPE_TIME: time = _idmef_value_time_python_to_c(py_value) c_value = _prelude.idmef_value_new_time(time) if not c_value: raise Error() elif object_type in [ _prelude.IDMEF_V... | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
return _prelude.idmef_data_get_data(data) | return (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) | def idmef_value_c_to_python(value): func_type_table = { _prelude.IDMEF_VALUE_TYPE_INT8: _prelude.idmef_value_get_int8, _prelude.IDMEF_VALUE_TYPE_UINT8: _prelude.idmef_value_get_uint8, _prelude.IDMEF_VALUE_TYPE_INT16: _prelude.idmef_value_get_int16, _prelude.IDMEF_VALUE_TYPE_UINT16: _prelude.idmef_value_g... | 70503a61b09c81c138dcbfff4fd6a60a97ea41c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/70503a61b09c81c138dcbfff4fd6a60a97ea41c3/prelude.py |
def _idmef_value_c_to_python(value): | def idmef_value_c_to_python(value): | def _idmef_value_c_to_python(value): func_type_table = { type_int16: idmef_value_get_int16, type_uint16: idmef_value_get_uint16, type_int32: idmef_value_get_int32, type_uint32: idmef_value_get_uint32, type_int64: idmef_value_get_int64, type_uint64: idmef_value_get_uint64, type_float: idmef_val... | 04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5/prelude.py |
return _idmef_value_c_to_python(value) | return idmef_value_c_to_python(value) | def _idmef_value_list_c_to_python(value): if value is None: return None if not idmef_value_is_list(value): return _idmef_value_c_to_python(value) ret = [ ] for i in range(idmef_value_get_count(value)): ret.append(_idmef_value_list_c_to_python(idmef_value_get_nth(value, i))) return ret | 04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5/prelude.py |
def __init__(self): """Create a new empty IDMEF message.""" self.res = idmef_message_new() if not self.res: raise Error() | def __init__(self, res=None): """Create a new empty IDMEF message.""" if res: self.res = res else: self.res = idmef_message_new() if not self.res: raise Error() | def __init__(self): """Create a new empty IDMEF message.""" self.res = idmef_message_new() if not self.res: raise Error() | 04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5/prelude.py |
def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) top_criteria.res = idmef_criteria_clone(self.res) if not top_criteria.res: raise Error() if type(value) is IDMEFCriteria: criteria2 = idmef_criteria_clone(value.res) if not criteria2: raise Error() else: crite... | def __append(self, new_sub_criteria, operator): new_criteria = IDMEFCriteria() idmef_criteria_destroy(new_criteria.res) new_criteria.res = idmef_criteria_clone(self.res) if not new_criteria.res: raise Error() new_sub_criteria_res = idmef_criteria_clone(new_sub_criteria.res) if not new_sub_criteria_res: raise Error() ... | def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) | 04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/04b5eb8bff2bdc1fcfe7fea2a578a560e1eaa5d5/prelude.py |
def __init__(self, name, config): | def __init__(self, name, config=None): | def __init__(self, name, config): if not config: file = os.popen("libprelude-config --prefix") path = file.read() file.close() config = path[:-1] + "/etc/prelude/default/client.conf" Client.__init__(self, Client.SEND_IDMEF, name, config) self._analyzer = _prelude.prelude_client_get_analyzer(self._client) if not self.... | 6f35664e76d40311460c58b99198a4bac485f0b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/6f35664e76d40311460c58b99198a4bac485f0b1/prelude.py |
_prelude.type_IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], | _prelude.IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], | def _idmef_integer_python_to_c(object, py_value): value_type_table = { _prelude.IDMEF_VALUE_TYPE_INT16: { 'py_type': [ int ], 'check_value': lambda i: i >= -2 ** 15 and i < 2 ** 15, 'convert': _prelude.idmef_value_new_int16 }, _prelude.type_IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], 'check_value': lambda i: i >= 0... | 522d15be1b2f600b00f1b7a7245c702618795d6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/522d15be1b2f600b00f1b7a7245c702618795d6e/prelude.py |
if _prelude.prelude_connection_connect(self._connection, self._profile, _prelude.PRELUDE_CONNECTION_CAPABILITY_CONNECT) < 0: raise ClientError("could not connect to %s:%d" % (address, port)) | self.connect() | def __init__(self, name=None, address="127.0.0.1", port=5554): self._profile = _prelude.prelude_client_profile_new(name or sys.argv[0]) if not self._profile: raise ClientError("could not create client profile for %s" % name or sys.argv[0]) self._connection = _prelude.prelude_connection_new(address, port) if not self._... | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
_prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) | ret = _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) if ret < 0: raise ClientError(ret) ret = _prelude.prelude_option_push_request(self._msgbuf, type, value) if ret < 0: raise ClientError(ret) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)... | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)) | msg = _prelude.prelude_connection_recv(self._connection) if not msg: raise Error("could not read request answer") | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)... | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") | def get_option_list(self, analyzer_path): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_LIST) if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py | |
return | raise Error("could not retrieve option list") | def get_option_list(self, analyzer_path): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_LIST) if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
retval = _prelude.prelude_option_recv_set(msg) return retval | if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read set_option answer") | def set_option(self, analyzer_path, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_SET, value) retval = _prelude.prelude_option_recv_set(msg) return retval | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
if not msg: return retval = _prelude.prelude_option_recv_set(msg) return retval | if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read commit answer") | def commit(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_COMMIT, instance) if not msg: return retval = _prelude.prelude_option_recv_set(msg) | 3d2f8d947615f8dc41c8549dd2184704ff9aee5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11628/3d2f8d947615f8dc41c8549dd2184704ff9aee5c/prelude.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.