コード例 #1
0
ファイル: ecolopy_sim-log.py プロジェクト: zzygyx9119/sesbio
if not (1 <= tmp['fmin']['theta'] < com.S and \
        1e-50 <= tmp['fmin']['m'] < 1-1e-50):
    del (tmp['fmin'])

# find the model with the higher likelihood:
met = min(tmp, key=lambda x: tmp[x]['lnL'])

# load it as 'etienne' model
com.set_model(tmp[met]['model'])

lrt = com.lrt('ewens', 'etienne')
best = 'ewens' if lrt > 0.05 else 'etienne'
print 'Best model by LRT was: ' + best

com.generate_random_neutral_distribution(model=best)

pval, neut_h = com.test_neutrality(model=best, gens=10000, full=True)
#draw_shannon_distrib(neut_h, abd.shannon)
draw_shannon_distrib(neut_h,
                     com.shannon,
                     outfile='Fulcaldea_stuessyi_log_shannon_dist.pdf',
                     filetype='pdf')
print 'P-value for neutrality test was: ', pval

out = open('Fulcaldea_stuessyi_log_shannon_neutral_data.tsv', 'w')
out.write('# shannon:' + str(com.shannon) + '\n')
out.write('\n'.join([str(s for s in neut_h)]) + '\n')
out.close()

com.dump_community('Fulcaldea_stuessyi_log_ecolopy.pik')
コード例 #2
0
ファイル: ecolopy_sim-log.py プロジェクト: sestaton/sesbio
        print '    optimization failed: ' + e.args[0]

# in case optimization by fmin failed to found correct values for theta and m:
if not (1 <= tmp['fmin']['theta'] < com.S and \
        1e-50 <= tmp['fmin']['m'] < 1-1e-50):
    del (tmp['fmin'])

# find the model with the higher likelihood:
met = min(tmp, key=lambda x: tmp[x]['lnL'])

# load it as 'etienne' model
com.set_model(tmp[met]['model'])

lrt = com.lrt('ewens', 'etienne')
best = 'ewens' if lrt > 0.05 else 'etienne'
print 'Best model by LRT was: ' + best

com.generate_random_neutral_distribution(model=best)

pval, neut_h = com.test_neutrality (model=best, gens=10000, full=True)
#draw_shannon_distrib(neut_h, abd.shannon)
draw_shannon_distrib(neut_h, com.shannon, outfile='Fulcaldea_stuessyi_log_shannon_dist.pdf', filetype='pdf')
print 'P-value for neutrality test was: ', pval

out = open('Fulcaldea_stuessyi_log_shannon_neutral_data.tsv', 'w')
out.write('# shannon:' + str(com.shannon) + '\n')
out.write('\n'.join([str(s for s in neut_h)]) + '\n')
out.close()

com.dump_community('Fulcaldea_stuessyi_log_ecolopy.pik')
コード例 #3
0
# find the model with the higher likelihood:
met = min(tmp, key=lambda x: tmp[x]['lnL'])

# load it as 'etienne' model
com.set_model(tmp[met]['model'])

lrt = com.lrt('ewens', 'etienne')
best = 'ewens' if lrt > 0.05 else 'etienne'
print 'Best model by LRT was: ' + best

com.generate_random_neutral_distribution(model=best)

pval, neut_h = com.test_neutrality(model=best,
                                   gens=10000,
                                   full=True,
                                   method='shannon',
                                   n_cpus=4)
draw_shannon_distrib(neut_h,
                     com.shannon,
                     outfile='test_log_shannon_dist.pdf',
                     filetype='pdf')
print 'P-value for neutrality test was: ', pval

out = open('test_log_shannon_neutral_data.tsv', 'w')
out.write('# shannon:' + str(com.shannon) + '\n')
out.write('\n'.join([str(s) for s in neut_h]) + '\n')
out.close()

com.dump_community('test_log_ecolopy.pik')
コード例 #4
0
ファイル: ecolopy.py プロジェクト: sestaton/sesbio
    except Exception as e:
        print '    optimization failed: ' + e.args[0]

# in case optimization by fmin failed to found correct values for theta and m:
if not (1 <= tmp['fmin']['theta'] < com.S and \
        1e-50 <= tmp['fmin']['m'] < 1-1e-50):
    del (tmp['fmin'])

# find the model with the higher likelihood:
met = min(tmp, key=lambda x: tmp[x]['lnL'])

# load it as 'etienne' model
com.set_model(tmp[met]['model'])

lrt = com.lrt('ewens', 'etienne')
best = 'ewens' if lrt > 0.05 else 'etienne'
print 'Best model by LRT was: ' + best

com.generate_random_neutral_distribution(model=best)

pval, neut_h = com.test_neutrality (model=best, gens=10000, full=True, method='shannon', n_cpus=4)
draw_shannon_distrib(neut_h, com.shannon, outfile='test_log_shannon_dist.pdf', filetype='pdf')
print 'P-value for neutrality test was: ', pval

out = open('test_log_shannon_neutral_data.tsv', 'w')
out.write('# shannon:' + str(com.shannon) + '\n')
out.write('\n'.join([str(s) for s in neut_h]) + '\n')
out.close()

com.dump_community('test_log_ecolopy.pik')