In [1]:
%matplotlib inline
import numpy as np
import pandas as p
import matplotlib.pyplot as plt
import seaborn as sns
import ast
import copy
import itertools
sns.set_style("white")
sns.set(style="ticks")
from matplotlib import rc
rc('text', usetex=True)

In [ ]:
def myFloat(myList):
    return map(float, myList)

In [2]:
all_data = p.read_csv('../data/newleaf_compete_compiled_data.csv',index_col=0,converters={'motiffreq':ast.literal_eval,'motiffreq_sd':ast.literal_eval,'motiffreq_se':ast.literal_eval,'motif':ast.literal_eval,'bias':ast.literal_eval})

In [3]:
cooperate_list = []
compete_list = []
zero_motif = []
for row in range(len(all_data)):
    if all_data['bias'][row] == [0.5,0.5]:
        cooperate_list.append(True)
        compete_list.append(True)
        if all_data['motif'][row][0].count('0') > 2:
            zero_motif.append(all_data['motif'][row][0])
        else:
            zero_motif.append(all_data['motif'][row][1])
    elif all_data['motif'][row][0].count('0') > 2:
        cooperate_list.append(False)
        compete_list.append(True)
        zero_motif.append(all_data['motif'][row][0])
    elif all_data['motif'][row][0].count('1') > 2:
        cooperate_list.append(True)
        compete_list.append(False)
        zero_motif.append(all_data['motif'][row][1])

all_data['cooperate'] = cooperate_list
all_data['compete'] = compete_list
all_data['zero_motif'] = zero_motif

In [4]:
all_data


Out[4]:
bias cells cellswithmotif cellswithmotif_sd cellswithmotif_se elong maxstrandlen motif motiffreq motiffreq_sd ... nonemptystrands_sd nonemptystrands_se nr_samples rounds sampler_start strands trials cooperate compete zero_motif
0 [0.5, 0.5] 100 ['0.78303999999999996', '0.0055196376692678243'] ['0.0062646947252040473', '0.00551963766926782... ['0.0014008283263840615', '0.00123422850396513... 0.0500 7 [00000, 11111] [0.026563515868995979, 0.026720859127929774] [0.00042602582969270464, 0.00036847211422622603] ... ['0.0010062715090868679'] ['0.0002250091498139534'] 50 7000 1000 100 20 True True 00000
1 [0.6, 0.4] 100 ['0.69462999999999997', '0.016145696020921505'] ['0.019978015416952689', '0.016145696020921505'] ['0.0044672200527845016', '0.00361028738468283... 0.0500 7 [00000, 11111] [0.033151330556673783, 0.033194263137421166] [0.0022195408256048465, 0.002173387547884883] ... ['0.0009955282818684822'] ['0.00022260689117814975'] 50 7000 1000 100 20 False True 00000
2 [0.7, 0.3] 100 ['0.59461000000000008', '0.092301004869936268'] ['0.085305673316608918', '0.092301004869936268'] ['0.019074928440232748', '0.020639132128071662'] 0.0500 7 [00000, 11111] [0.059753199164690428, 0.056418272547945736] [0.013836420154208122, 0.013273114868409215] ... ['0.00082135366316830665'] ['0.00018366026244127988'] 50 7000 1000 100 20 False True 00000
3 [0.8, 0.2] 100 ['0.54421999999999993', '0.2062390678314853'] ['0.20483661684376647', '0.2062390678314853'] ['0.045802859954374026', '0.046116457528739122'] 0.0500 7 [00000, 11111] [0.10786570810624171, 0.093566021158762808] [0.043617299348785853, 0.042976838311198681] ... ['0.00089810940870250957'] ['0.00020082336890909526'] 50 7000 1000 100 20 False True 00000
4 [0.9, 0.1] 100 ['0.67671000000000014', '0.25972034498667984'] ['0.25773335426366534', '0.25972034498667984'] ['0.05763093002025909', '0.058075234652991282'] 0.0500 7 [00000, 11111] [0.21846523167609955, 0.10677944122347405] [0.0863052776627459, 0.089292350976521773] ... ['0.00082901914935663813'] ['0.00018537431726104939'] 50 7000 1000 100 20 False True 00000
5 [1.0, 0.0] 100 ['0.54250999999999994', '0.3316526924359276'] ['0.32899100580411011', '0.3316526924359276'] ['0.0735646252964018', '0.074159796520756438'] 0.0500 7 [00000, 11111] [0.25619102220790013, 0.22239374932433537] [0.15703337288481853, 0.15791405269472841] ... ['0.0010179160279708609'] ['0.00022761294339294222'] 50 7000 1000 100 20 False True 00000
6 [0.6, 0.4] 100 ['0.82796000000000003', '0.0065966355060743153'] ['0.0062615014173918269', '0.00659663550607431... ['0.0014001142810499407', '0.00147505254143708... 0.0500 7 [11111, 00000] [0.028911430269514288, 0.029062897288985673] [0.00034060666127784821, 0.00042786563802803268] ... ['0.0010599447910150633'] ['0.00023701086051064897'] 50 7000 1000 100 20 True False 00000
7 [0.7, 0.3] 100 ['0.85846', '0.0051188279908588449'] ['0.0048025409940988546', '0.00511882799085884... ['0.0010738808127534454', '0.00114460473526890... 0.0500 7 [11111, 00000] [0.032173203290633397, 0.032173750227490958] [0.00043543160814900626, 0.00044826116985947868] ... ['0.00091752190164592689'] ['0.00020516413429251686'] 50 7000 1000 100 20 True False 00000
8 [0.8, 0.2] 100 ['0.88006999999999991', '0.0045554802161791776'] ['0.0049288031001451238', '0.00455548021617917... ['0.00110211387796362', '0.0010186363433532077'] 0.0500 7 [11111, 00000] [0.034808408279791384, 0.03481641286167856] [0.00043322381305633829, 0.0004028772578036081] ... ['0.0011062522135570991'] ['0.00024736551497732878'] 50 7000 1000 100 20 True False 00000
9 [0.9, 0.1] 100 ['0.89627000000000012', '0.0042572291458177524'] ['0.0049832820510181631', '0.00425722914581775... ['0.0011142957417131188', '0.00095194537658418... 0.0500 7 [11111, 00000] [0.036533329478025005, 0.036612933270406982] [0.00041372739691955724, 0.00042091426135845711] ... ['0.00096489590630288453'] ['0.00021575728377045176'] 50 7000 1000 100 20 True False 00000
10 [1.0, 0.0] 100 ['0.9094199999999999', '0.0043890317838903613'] ['0.0046134152208532142', '0.00438903178389036... ['0.0010315910042259992', '0.00098141734241860... 0.0500 7 [11111, 00000] [0.037742519337525135, 0.037787546801743933] [0.00038586453795342039, 0.00040985167159946065] ... ['0.00099527282691732146'] ['0.00022254976971455132'] 50 7000 1000 100 20 True False 00000
11 [0.5, 0.5] 100 ['0.85012999999999983', '0.0042654894209222909'] ['0.0047147746499700679', '0.00426548942092229... ['0.0010542556615925848', '0.00095379243024884... 0.0500 7 [00010, 11101] [0.038149833353219552, 0.037976858459404669] [0.00053781785042562446, 0.0004670799952957574] ... ['0.00091333202615474763'] ['0.00020422724965096315'] 50 7000 1000 100 20 True True 00010
12 [0.6, 0.4] 100 ['0.81020999999999999', '0.009287470053787503'] ['0.0078180496289036328', '0.009287470053787503'] ['0.0017481690421695527', '0.00207674143792624... 0.0500 7 [00010, 11101] [0.04059556908247814, 0.039551057074896562] [0.00099669246682975278, 0.0012575364381482888] ... ['0.00092018330239136421'] ['0.0002057592415907335'] 50 7000 1000 100 20 False True 00010
13 [0.7, 0.3] 100 ['0.69741000000000009', '0.034174638257046711'] ['0.040177828462971958', '0.034174638257046711'] ['0.0089840355631531192', '0.00764168142492213... 0.0500 7 [00010, 11101] [0.045864225106528489, 0.044751929918765122] [0.0059342934126664438, 0.005402261290233786] ... ['0.0010991884779236005'] ['0.00024578601567216973'] 50 7000 1000 100 20 False True 00010
14 [0.8, 0.2] 100 ['0.52214000000000005', '0.11007021168327061'] ['0.11070969424580668', '0.11007021168327061'] ['0.024755440210184103', '0.024612447562158461'] 0.0500 7 [00010, 11101] [0.044811125194977861, 0.052872263142612543] [0.011757223149597382, 0.013438078597081914] ... ['0.00075119996671989633'] ['0.00016797341902812678'] 50 7000 1000 100 20 False True 00010
15 [0.9, 0.1] 100 ['0.51803999999999983', '0.1832004309492748'] ['0.18412810323250495', '0.1832004309492748'] ['0.041172295539597982', '0.040964861710983472'] 0.0500 7 [00010, 11101] [0.040729215222032655, 0.037338836349428688] [0.016677774122160392, 0.016266734038424314] ... ['0.00075363176684636532'] ['0.0001685171860671745'] 50 7000 1000 100 20 False True 00010
16 [1.0, 0.0] 100 ['0.41252000000000005', '0.055599446040405828'] ['0.065494225699675238', '0.055599446040405828'] ['0.014644954079818756', '0.012432414085767894'] 0.0500 7 [00010, 11101] [0.0093124310491074606, 0.0098316844311660614] [0.0015289404588059582, 0.0013223845144083311] ... ['0.00091845715741128791'] ['0.00020537326383928645'] 50 7000 1000 100 20 False True 00010
17 [0.5, 0.5] 100 ['0.8542700000000002', '0.0061652169467099919'] ['0.005295384782997372', '0.0061652169467099919'] ['0.0011840840341800095', '0.001378584418887724'] 0.0500 7 [00011, 11100] [0.038153589465268908, 0.037952345891485509] [0.00068710431990004245, 0.00049769138626010222] ... ['0.00089307863035681552'] ['0.00019969845267302466'] 50 7000 1000 100 20 True True 00011
18 [0.6, 0.4] 100 ['0.84681000000000017', '0.0075397877954223565'] ['0.0067062582711971738', '0.00753978779542235... ['0.0014995649369067099', '0.00168594780464876... 0.0500 7 [00011, 11100] [0.037034600395558621, 0.036993522382078162] [0.00075115748880579404, 0.00059462727315147401] ... ['0.00087339120100900756'] ['0.00019529620964063238'] 50 7000 1000 100 20 False True 00011
19 [0.7, 0.3] 100 ['0.81234000000000006', '0.012649407100730087'] ['0.012297007766119366', '0.012649407100730087'] ['0.0027496945284885737', '0.00282849341523010... 0.0500 7 [00011, 11100] [0.032476044023593678, 0.03264610542732195] [0.00080306510076232898, 0.0011679425116202457] ... ['0.00094824488398300799'] ['0.00021203400199024073'] 50 7000 1000 100 20 False True 00011
20 [0.8, 0.2] 100 ['0.74502000000000002', '0.017567071469086731'] ['0.015581899755806421', '0.017567071469086731'] ['0.0034842187072570527', '0.00392811659704750... 0.0500 7 [00011, 11100] [0.025721537585108457, 0.025752892845518332] [0.00075282952473154662, 0.00076810550509678183] ... ['0.00079662846421654006'] ['0.00017813153987994424'] 50 7000 1000 100 20 False True 00011
21 [0.9, 0.1] 100 ['0.66626999999999981', '0.020785367449241768'] ['0.02712734966781679', '0.020785367449241768'] ['0.0060658597906644678', '0.00464774945538160... 0.0500 7 [00011, 11100] [0.019248237613798531, 0.019400087873206132] [0.00077188025075358344, 0.00057182341538650737] ... ['0.0009495246179009821'] ['0.00021232015919361096'] 50 7000 1000 100 20 False True 00011
22 [1.0, 0.0] 100 ['0.64610000000000001', '0.019339314879281529'] ['0.019480400406562456', '0.019339314879281529'] ['0.004355949953798819', '0.0043244022708346635'] 0.0500 7 [00011, 11100] [0.016359765568783706, 0.016443219617371645] [0.00048064081323673203, 0.00049344098382933749] ... ['0.0010940138710272501'] ['0.0002446289383944619'] 50 7000 1000 100 20 False True 00011
23 [0.5, 0.5] 100 ['0.85124000000000011', '0.0070003642762359215'] ['0.005153096156680941', '0.0070003642762359215'] ['0.001152267330093149', '0.0015653290388924635'] 0.0500 7 [00100, 11011] [0.038113438035414574, 0.038085144538984955] [0.00051673634626110459, 0.00051258769219834866] ... ['0.00087854231542939187'] ['0.00019644803384101826'] 50 7000 1000 100 20 True True 00100
24 [0.6, 0.4] 100 ['0.80144000000000004', '0.0093544588298842685'] ['0.010638345736062534', '0.0093544588298842685'] ['0.0023788064233980859', '0.00209172058363443... 0.0500 7 [00100, 11011] [0.039714403769462364, 0.039943403283594983] [0.001296344235387037, 0.0013376150050147984] ... ['0.00091797718381234441'] ['0.00020526593847982217'] 50 7000 1000 100 20 False True 00100
25 [0.7, 0.3] 100 ['0.68777000000000021', '0.030241724487866103'] ['0.035812918060387042', '0.030241724487866103'] ['0.0080080119255655346', '0.00676225517116886... 0.0500 7 [00100, 11011] [0.046078239793168198, 0.045377798030211532] [0.005093972805991458, 0.004876139696051972] ... ['0.0005935217266452911'] ['0.00013271549269019191'] 50 7000 1000 100 20 False True 00100
26 [0.8, 0.2] 100 ['0.53837000000000002', '0.065467973849814523'] ['0.067164820404732706', '0.065467973849814523'] ['0.015018510412154726', '0.014639083987736388'] 0.0500 7 [00100, 11011] [0.047081500626485688, 0.051387280275620298] [0.0076342820204130628, 0.0086286584284456704] ... ['0.0010975497938590193'] ['0.00024541959477596484'] 50 7000 1000 100 20 False True 00100
27 [0.9, 0.1] 100 ['0.45997000000000005', '0.096485669402248536'] ['0.099713154097140072', '0.096485669402248536'] ['0.022296539081211687', '0.021574851563799922'] 0.0500 7 [00100, 11011] [0.037734737970515721, 0.041318507432286891] [0.0093052259486816457, 0.0092431286328221139] ... ['0.0012547098270118079'] ['0.00028056164652354041'] 50 7000 1000 100 20 False True 00100
28 [1.0, 0.0] 100 ['0.39433000000000001', '0.025812591888456311'] ['0.02603607305259379', '0.025812591888456311'] ['0.005821842921275017', '0.005771871013804798'] 0.0500 7 [00100, 11011] [0.012189813778062757, 0.012547316634654382] [0.00080162314363986422, 0.0010210658556869985] ... ['0.00097832519644544058'] ['0.00021876016433528407'] 50 7000 1000 100 20 False True 00100
29 [0.5, 0.5] 100 ['0.85397999999999996', '0.0063294470532582721'] ['0.0066926526878361148', '0.00632944705325827... ['0.0014965226359798232', '0.00141530738710712... 0.0500 7 [00101, 11010] [0.037949438011491962, 0.037980511003081793] [0.00054637093520814618, 0.0005000977376221357] ... ['0.0010110386540582957'] ['0.00022607511583542427'] 50 7000 1000 100 20 True True 00101
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
323 [0.55, 0.45] 100 ['0.96274799999999972', '0.0023930699947975029'] ['0.0026165045385016681', '0.00239306999479750... ['0.00037002962043598153', '0.0003384312042350... 0.1000 7 [11110, 00001] [0.059342205555559378, 0.05928462664998959] [0.00041407199985723294, 0.00039256571269818513] ... ['0.00054846800599485141'] ['7.7565089260564686e-05'] 50 15000 1000 100 50 True False 00001
324 [0.55, 0.45] 100 ['0.99026400000000014', '0.0014017646022068332'] ['0.0013708041435595961', '0.00140176460220683... ['0.0001938609811179216', '0.00019823945116954... 0.2000 7 [11110, 00001] [0.074778520109619148, 0.074769001830886778] [0.00043432869542204373, 0.00032965682375266477] ... ['0.00034420575242141385'] ['4.8678044332119922e-05'] 50 15000 1000 100 50 True False 00001
325 [0.55, 0.45] 100 ['0.86150800000000016', '0.0058821506271090861'] ['0.005339244890431593', '0.0058821506271090861'] ['0.00075508325368796086', '0.0008318617192779... 0.0500 7 [11110, 00001] [0.038539971056176132, 0.038480160137304605] [0.00036528531944925077, 0.00041104488903725343] ... ['0.0008233059057240244'] ['0.000116433037785678'] 50 15000 1000 100 50 True False 00001
326 [0.55, 0.45] 100 ['0.59083199999999991', '0.0064629603124264851'] ['0.0072909105055541674', '0.00646296031242648... ['0.0010310904519003183', '0.00091400061269125... 0.0250 7 [11110, 00001] [0.018290195835687209, 0.018249483763658435] [0.0003848059415542257, 0.00036023050941186784] ... ['0.0012267288508875896'] ['0.00017348565782795915'] 50 15000 1000 100 50 True False 00001
327 [0.55, 0.45] 100 ['0.22218000000000007', '0.0078751294592533504'] ['0.007161480293905711', '0.0078751294592533504'] ['0.0010127862558309115', '0.00111371148867199... 0.0125 7 [11110, 00001] [0.005566399039314762, 0.0055726278887849911] [0.00020124466738552242, 0.00019971769563267887] ... ['0.0017680901248522095'] ['0.00025004570340639336'] 50 15000 1000 100 50 True False 00001
328 [0.65, 0.35] 100 ['0.97003999999999957', '0.002509068352994785'] ['0.0029189039038652618', '0.002509068352994785'] ['0.00041279534881100258', '0.0003548358493726... 0.1000 7 [11110, 00001] [0.066337609407777526, 0.066382818510201919] [0.00055851183637161924, 0.00052506762804505633] ... ['0.00053424896817871588'] ['7.5554213648217202e-05'] 50 15000 1000 100 50 True False 00001
329 [0.65, 0.35] 100 ['0.9928880000000001', '0.0014965346638150781'] ['0.001266276431116073', '0.0014965346638150781'] ['0.00017907853025977505', '0.0002116419618128... 0.2000 7 [11110, 00001] [0.084416915145856711, 0.084524840984949098] [0.00051472111058724064, 0.00053532418402409327] ... ['0.00033960977371090914'] ['4.8028074789642546e-05'] 50 15000 1000 100 50 True False 00001
330 [0.65, 0.35] 100 ['0.87472000000000005', '0.0045077515459483949'] ['0.0042528108352006292', '0.00450775154594839... ['0.0006014382761347979', '0.00063749233720885... 0.0500 7 [11110, 00001] [0.042538552838037987, 0.042520552147891716] [0.0004789737930923399, 0.00047042909925619286] ... ['0.00080789855699831979'] ['0.00011425410963286768'] 50 15000 1000 100 50 True False 00001
331 [0.65, 0.35] 100 ['0.60588400000000009', '0.008382148650554918'] ['0.0079301036563212742', '0.008382148650554918'] ['0.0011214860141794015', '0.00118541483034421... 0.0250 7 [11110, 00001] [0.019751342466833615, 0.019755969809512802] [0.00039263731184543851, 0.00030256598095132134] ... ['0.0014194413689899456'] ['0.00020073932350190139'] 50 15000 1000 100 50 True False 00001
332 [0.65, 0.35] 100 ['0.22590400000000005', '0.0078442937221906654'] ['0.0074610712367594962', '0.00784429372219066... ['0.0010551548132857081', '0.00110935065691601... 0.0125 7 [11110, 00001] [0.0056946554790428643, 0.0057334197826674829] [0.00019760824891569247, 0.00024245626130042921] ... ['0.0015916294362696439'] ['0.0002250903935044774'] 50 15000 1000 100 50 True False 00001
333 [0.75, 0.25] 100 ['0.97675199999999951', '0.001918732915233349'] ['0.0020993560917576606', '0.001918732915233349'] ['0.00029689378572142592', '0.0002713498111294... 0.1000 7 [11110, 00001] [0.08001681447517564, 0.079897656770610212] [0.00061504904180550632, 0.00074099042775153349] ... ['0.00055475688368871866'] ['7.845447087324196e-05'] 50 15000 1000 100 50 True False 00001
334 [0.75, 0.25] 100 ['0.99518400000000029', '0.00087109126961533434'] ['0.00093023867904965527', '0.0008710912696153... ['0.00013155561561560553', '0.0001231909087554... 0.2000 7 [11110, 00001] [0.10397719968434066, 0.1039945441863136] [0.0007596197478450719, 0.00077923425682470686] ... ['0.00036613231269579235'] ['5.1778928223741649e-05'] 50 15000 1000 100 50 True False 00001
335 [0.75, 0.25] 100 ['0.89070400000000016', '0.0051388714714419737'] ['0.0052465973735364487', '0.00513887147144197... ['0.00074198091619663044', '0.0007267461730205... 0.0500 7 [11110, 00001] [0.05062379843484105, 0.050655368872215153] [0.00062190069961056684, 0.00062309994448999989] ... ['0.0010082170313974886'] ['0.00014258341996178689'] 50 15000 1000 100 50 True False 00001
336 [0.75, 0.25] 100 ['0.62203199999999981', '0.0084902051800884049'] ['0.0068659577627596868', '0.00849020518008840... ['0.00097099305867755822', '0.0012006963313011... 0.0250 7 [11110, 00001] [0.022596069239005825, 0.022548316400511904] [0.00043021148866141537, 0.00041402245757876107] ... ['0.0015884852880653593'] ['0.00022464574380121638'] 50 15000 1000 100 50 True False 00001
337 [0.75, 0.25] 100 ['0.23430799999999993', '0.0085185125462136791'] ['0.0083957332020497093', '0.00851851254621367... ['0.0011873359760404792', '0.001204699597410075'] 0.0125 7 [11110, 00001] [0.0061399621419395856, 0.0061317498248924483] [0.00025735438881882702, 0.00025816473032994747] ... ['0.0015763279861754902'] ['0.00022292644167976468'] 50 15000 1000 100 50 True False 00001
338 [0.85, 0.15] 100 ['0.98055599999999965', '0.001986417881514367'] ['0.0023400136751737712', '0.001986417881514367'] ['0.00033092790755692573', '0.0002809219108578... 0.1000 7 [11110, 00001] [0.098119544364747263, 0.098171062626750683] [0.0011165716409831045, 0.00092044403872229661] ... ['0.00045278713055915931'] ['6.4033770090476036e-05'] 50 15000 1000 100 50 True False 00001
339 [0.85, 0.15] 100 ['0.99631600000000009', '0.0010371113729971499'] ['0.00099284641309721824', '0.0010371113729971... ['0.00014040968627555665', '0.0001466696969383... 0.2000 7 [11110, 00001] [0.12746951922516728, 0.12742627137245108] [0.0010932136662547534, 0.0010634053250715562] ... ['0.00032571963404129806'] ['4.6063712399240493e-05'] 50 15000 1000 100 50 True False 00001
340 [0.85, 0.15] 100 ['0.90454800000000002', '0.0053547795472829703'] ['0.0051939672698237257', '0.00535477954728297... ['0.00073453789555066699', '0.0007572801859285... 0.0500 7 [11110, 00001] [0.061844473034300441, 0.061956733337335777] [0.00092503728361584769, 0.00077376062967712302] ... ['0.00084635285407448733'] ['0.0001196923684785317'] 50 15000 1000 100 50 True False 00001
341 [0.85, 0.15] 100 ['0.6415479999999999', '0.0079500399998993845'] ['0.0094798995775271858', '0.00795003999989938... ['0.001340660255247392', '0.0011243054389266309'] 0.0250 7 [11110, 00001] [0.027012470602832468, 0.026864790528040014] [0.0005921677085852109, 0.00057142814523746888] ... ['0.00094764517325842789'] ['0.00013401726563394702'] 50 15000 1000 100 50 True False 00001
342 [0.85, 0.15] 100 ['0.2416320000000001', '0.0065616046817832466'] ['0.0077626139927217692', '0.00656160468178324... ['0.0010977993987974287', '0.00092795103319086... 0.0125 7 [11110, 00001] [0.0068422405523996168, 0.0067701969044090139] [0.00030847324115585838, 0.00034828920247247157] ... ['0.001533836927446999'] ['0.00021691729852642229'] 50 15000 1000 100 50 True False 00001
343 [0.95, 0.05] 100 ['0.96431600000000006', '0.0028548036710078061'] ['0.0027785147111360855', '0.00285480367100780... ['0.00039294131877418143', '0.0004037302069451... 0.1000 7 [11110, 00001] [0.093641027641140101, 0.094045209213950903] [0.0015219020544851728, 0.0010942165080685298] ... ['0.00056357391706857954'] ['7.9701387691811503e-05'] 50 15000 1000 100 50 True False 00001
344 [0.95, 0.05] 100 ['0.99047199999999991', '0.0015564061166675114'] ['0.0014487290982099503', '0.00155640611666751... ['0.00020488123388930551', '0.0002201090638751... 0.2000 7 [11110, 00001] [0.11400276595877307, 0.11427423088924007] [0.0013812882814484087, 0.0013778019519159205] ... ['0.00028367120121718385'] ['4.0117166001600861e-05'] 50 15000 1000 100 50 True False 00001
345 [0.95, 0.05] 100 ['0.87039999999999995', '0.0059481775360189374'] ['0.0064670240451075696', '0.00594817753601893... ['0.00091457531127840392', '0.0008411993342840... 0.0500 7 [11110, 00001] [0.064474361560184365, 0.064507593954978196] [0.0011826605490361942, 0.0013627925922206638] ... ['0.00094551184360641672'] ['0.00013371556726125833'] 50 15000 1000 100 50 True False 00001
346 [0.95, 0.05] 100 ['0.61447599999999991', '0.011212582218204687'] ['0.0090856273311203089', '0.011212582218204687'] ['0.0012849017394338008', '0.001585698584220847'] 0.0250 7 [11110, 00001] [0.030312016814031187, 0.030426793774914009] [0.00098361258904640348, 0.00098326040867229166] ... ['0.0010888604869311641'] ['0.00015398812681502244'] 50 15000 1000 100 50 True False 00001
347 [0.95, 0.05] 100 ['0.23733600000000007', '0.0090577780939919087'] ['0.0077728182791057168', '0.00905777809399190... ['0.0010992425028172805', '0.00128096326254892... 0.0125 7 [11110, 00001] [0.0072522651537347549, 0.0071323315685162892] [0.00037864314678126744, 0.00031718354189214288] ... ['0.0015878681683313676'] ['0.00022455846989147447'] 50 15000 1000 100 50 True False 00001
348 [1.0, 0.0] 100 ['0.48103200000000002', '0.010019469846254354'] ['0.011150344209933589', '0.010019469846254354'] ['0.0015768968006816394', '0.00141696701443611... 0.1000 7 [11110, 00001] [0.020274231160187638, 0.02014622295780466] [0.00077214625161338923, 0.00060623140238257132] ... ['0.00047893632311613781'] ['6.7731824366394489e-05'] 50 15000 1000 100 50 True False 00001
349 [1.0, 0.0] 100 ['0.48445200000000005', '0.0091094895575986965'] ['0.0093814975350420757', '0.00910948955759869... ['0.0013267441049426263', '0.00128827636786521... 0.2000 7 [11110, 00001] [0.016328352528625214, 0.016447356716112135] [0.0005128159112497662, 0.00053084809425854769] ... ['0.00030730604680025093'] ['4.3459637918417592e-05'] 50 15000 1000 100 50 True False 00001
350 [1.0, 0.0] 100 ['0.48018000000000005', '0.0091039332159237665'] ['0.0072865080800065055', '0.00910393321592376... ['0.0010304678549086341', '0.00128749058248982... 0.0500 7 [11110, 00001] [0.021765541937272214, 0.021996796479556293] [0.00081698342558340713, 0.00066061870342397811] ... ['0.00096612784578439294'] ['0.00013663111024945904'] 50 15000 1000 100 50 True False 00001
351 [1.0, 0.0] 100 ['0.42596399999999995', '0.010231293955311815'] ['0.0088610328969031676', '0.010231293955311815'] ['0.0012531392899434615', '0.00144692346722278... 0.0250 7 [11110, 00001] [0.016989661326626583, 0.016955838598398408] [0.00057430096756925966, 0.00058119723513719713] ... ['0.0011429300619022911'] ['0.00016163471943861412'] 50 15000 1000 100 50 True False 00001
352 [1.0, 0.0] 100 ['0.21349600000000002', '0.0072270602598843731'] ['0.0073631775749332523', '0.00722706025988437... ['0.0010413105588632041', '0.00102206066356161... 0.0125 7 [11110, 00001] [0.006169625853467889, 0.0061400189225864774] [0.00028987383500209959, 0.00033964245252247601] ... ['0.0015524799386787379'] ['0.0002195538184591622'] 50 15000 1000 100 50 True False 00001

353 rows × 22 columns


In [5]:
high_bias = []

for row in range(len(all_data)):
    high_bias.append(all_data['bias'][row][0])
all_data['high_bias'] = high_bias

In [6]:
compete_data = all_data[(all_data['compete'] == True) & (all_data['elong'] == 0.05)]
cooperate_data = all_data[(all_data['cooperate'] == True) & (all_data['elong'] == 0.05)]

In [7]:
np.unique(compete_data['motif'].values)
np.unique(cooperate_data['motif'].values)
print np.unique(compete_data['motif'].values)
print np.unique(cooperate_data['motif'].values)


[['00000', '11111'] ['00001', '11110'] ['00010', '11101']
 ['00011', '11100'] ['00100', '11011'] ['00101', '11010']
 ['01000', '10111'] ['01001', '10110'] ['01010', '10101']
 ['01100', '10011'] ['10000', '01111'] ['10001', '01110']
 ['10010', '01101'] ['10100', '01011'] ['11000', '00111']]
[['00000', '11111'] ['00001', '11110'] ['00010', '11101']
 ['00011', '11100'] ['00100', '11011'] ['00101', '11010']
 ['00111', '11000'] ['01000', '10111'] ['01001', '10110']
 ['01010', '10101'] ['01011', '10100'] ['01100', '10011']
 ['01101', '10010'] ['01110', '10001'] ['01111', '10000']
 ['10000', '01111'] ['10001', '01110'] ['10010', '01101']
 ['10011', '01100'] ['10100', '01011'] ['10101', '01010']
 ['10110', '01001'] ['10111', '01000'] ['11000', '00111']
 ['11010', '00101'] ['11011', '00100'] ['11100', '00011']
 ['11101', '00010'] ['11110', '00001'] ['11111', '00000']]

In [10]:
for motif in np.unique(cooperate_data['zero_motif'].values):
    plt.figure()
    ax = plt.subplot(111)
    mirrored = motif
    moment = cooperate_data[cooperate_data['zero_motif'] == motif]
    biaslist = np.sort(moment['high_bias'].values)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]

    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=mirrored,color='r',linewidth=2,alpha=0.9)
    for cap in caps:
        cap.set_markeredgewidth(1)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][1])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][1])  for bias in biaslist]
    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=mirrored.replace('0','2').replace('1','0').replace('2','1'),color='r',linestyle='--',alpha=0.7)
    for cap in caps:
        cap.set_markeredgewidth(1)
    
    motif = motif[::-1]
    moment = cooperate_data[cooperate_data['zero_motif'] == motif]
    biaslist = np.sort(moment['high_bias'].values)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]

    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=motif,color='b',linewidth=2,alpha=0.9)
    for cap in caps:
        cap.set_markeredgewidth(1)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][1])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][1])  for bias in biaslist]
    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=motif.replace('0','2').replace('1','0').replace('2','1'),color='b',linestyle='--',alpha=0.7)
    for cap in caps:
        cap.set_markeredgewidth(1)
    plt.xlim(0.49,1.01)
    plt.ylim(0.00,0.07)
    ax.xaxis.set_ticks_position('bottom')
    plt.xlabel(r"$b$",fontsize=20)
    plt.ylabel('Motif Frequency at Steady State',fontsize=18)
    plt.tick_params(labelsize=18)
    plt.legend(fontsize=14,loc='upper left')
    plt.title('Cooperate',fontsize=20)
#     plt.savefig('newleaf_revision_cooperate_colorswap_{m1}_{m2}.pdf'.format(m1=mirrored,m2=motif),bbox_inches='tight')


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-10-084fc584ec5d> in <module>()
     42     plt.ylabel('Motif Frequency at Steady State',fontsize=18)
     43     plt.tick_params(labelsize=18)
---> 44     plt.legend(fontsize=14,loc='upper left')
     45     plt.title('Cooperate',fontsize=20)
     46     plt.savefig('newleaf_revision_cooperate_colorswap_{m1}_{m2}.pdf'.format(m1=mirrored,m2=motif),bbox_inches='tight')

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.pyc in legend(*args, **kwargs)
   3517 @docstring.copy_dedent(Axes.legend)
   3518 def legend(*args, **kwargs):
-> 3519     ret = gca().legend(*args, **kwargs)
   3520     draw_if_interactive()
   3521     return ret

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in legend(self, *args, **kwargs)
    511             raise TypeError('Invalid arguments to legend.')
    512 
--> 513         self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
    514         self.legend_._remove_method = lambda h: setattr(self, 'legend_', None)
    515         return self.legend_

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend.pyc in __init__(self, parent, handles, labels, loc, numpoints, markerscale, scatterpoints, scatteryoffsets, prop, fontsize, borderpad, labelspacing, handlelength, handleheight, handletextpad, borderaxespad, columnspacing, ncol, mode, fancybox, shadow, title, framealpha, bbox_to_anchor, bbox_transform, frameon, handler_map)
    366 
    367         # init with null renderer
--> 368         self._init_legend_box(handles, labels)
    369 
    370         if framealpha is None:

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend.pyc in _init_legend_box(self, handles, labels)
    640                 # original artist/handle.
    641                 handle_list.append(handler.legend_artist(self, orig_handle,
--> 642                                                          fontsize, handlebox))
    643 
    644         if len(handleboxes) > 0:

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend_handler.pyc in legend_artist(self, legend, orig_handle, fontsize, handlebox)
    116         artists = self.create_artists(legend, orig_handle,
    117                                       xdescent, ydescent, width, height,
--> 118                                       fontsize, handlebox.get_transform())
    119 
    120         # create_artists will return a list of artists.

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend_handler.pyc in create_artists(self, legend, orig_handle, xdescent, ydescent, width, height, fontsize, trans)
    471                       for x, y in zip(xdata_marker, ydata_marker)]
    472             coll = mcoll.LineCollection(verts)
--> 473             self.update_prop(coll, barlinecols[0], legend)
    474             handle_barlinecols.append(coll)
    475 

IndexError: tuple index out of range

In [12]:
for motif in np.unique(compete_data['zero_motif'].values):
    plt.figure()
    ax = plt.subplot(111)
    mirrored = motif
    moment = compete_data[compete_data['zero_motif'] == motif]
    biaslist = np.sort(moment['high_bias'].values)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]

    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=mirrored,color='r',linewidth=2,alpha=0.9)
    for cap in caps:
        cap.set_markeredgewidth(1)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][1])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][1])  for bias in biaslist]
    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=mirrored.replace('0','2').replace('1','0').replace('2','1'),color='r',linestyle='--',alpha=0.7)
    for cap in caps:
        cap.set_markeredgewidth(1)

    motif = motif[::-1]
    moment = compete_data[compete_data['zero_motif'] == motif]
    biaslist = np.sort(moment['high_bias'].values)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]

    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=motif,color='b',linewidth=2,alpha=0.9)
    for cap in caps:
        cap.set_markeredgewidth(1)
    meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][1])    for bias in biaslist]
    cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][1])  for bias in biaslist]
    (__,caps,__) = plt.errorbar(biaslist,meanlist,yerr=cilist,label=motif.replace('0','2').replace('1','0').replace('2','1'),color='b',linestyle='--',alpha=0.7)
    for cap in caps:
        cap.set_markeredgewidth(1)
    plt.xlim(0.49,1.01)
    plt.ylim(0.00,0.07)
    ax.xaxis.set_ticks_position('bottom')
    plt.xlabel(r"$b$",fontsize=20)
    plt.ylabel('Motif Frequency at Steady State',fontsize=18)
    plt.tick_params(labelsize=18)
    plt.legend(fontsize=14,loc='upper left')
    plt.title('Compete',fontsize=20)
#     plt.savefig('newleaf_revision_compete_nolim_colorswap_{m1}_{m2}.pdf'.format(m1=mirrored,m2=motif),bbox_inches='tight')
#     plt.savefig('newleaf_revision_compete_colorswap_{m1}_{m2}.pdf'.format(m1=mirrored,m2=motif),bbox_inches='tight')


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-12-ae62093f2c14> in <module>()
     41     plt.ylabel('Motif Frequency at Steady State',fontsize=18)
     42     plt.tick_params(labelsize=18)
---> 43     plt.legend(fontsize=14,loc='upper left')
     44     plt.title('Compete',fontsize=20)
     45 #     plt.savefig('newleaf_revision_compete_nolim_colorswap_{m1}_{m2}.pdf'.format(m1=mirrored,m2=motif),bbox_inches='tight')

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.pyc in legend(*args, **kwargs)
   3517 @docstring.copy_dedent(Axes.legend)
   3518 def legend(*args, **kwargs):
-> 3519     ret = gca().legend(*args, **kwargs)
   3520     draw_if_interactive()
   3521     return ret

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in legend(self, *args, **kwargs)
    511             raise TypeError('Invalid arguments to legend.')
    512 
--> 513         self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
    514         self.legend_._remove_method = lambda h: setattr(self, 'legend_', None)
    515         return self.legend_

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend.pyc in __init__(self, parent, handles, labels, loc, numpoints, markerscale, scatterpoints, scatteryoffsets, prop, fontsize, borderpad, labelspacing, handlelength, handleheight, handletextpad, borderaxespad, columnspacing, ncol, mode, fancybox, shadow, title, framealpha, bbox_to_anchor, bbox_transform, frameon, handler_map)
    366 
    367         # init with null renderer
--> 368         self._init_legend_box(handles, labels)
    369 
    370         if framealpha is None:

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend.pyc in _init_legend_box(self, handles, labels)
    640                 # original artist/handle.
    641                 handle_list.append(handler.legend_artist(self, orig_handle,
--> 642                                                          fontsize, handlebox))
    643 
    644         if len(handleboxes) > 0:

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend_handler.pyc in legend_artist(self, legend, orig_handle, fontsize, handlebox)
    116         artists = self.create_artists(legend, orig_handle,
    117                                       xdescent, ydescent, width, height,
--> 118                                       fontsize, handlebox.get_transform())
    119 
    120         # create_artists will return a list of artists.

/Users/grantkinsler/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/legend_handler.pyc in create_artists(self, legend, orig_handle, xdescent, ydescent, width, height, fontsize, trans)
    471                       for x, y in zip(xdata_marker, ydata_marker)]
    472             coll = mcoll.LineCollection(verts)
--> 473             self.update_prop(coll, barlinecols[0], legend)
    474             handle_barlinecols.append(coll)
    475 

IndexError: tuple index out of range

In [77]:
cooperate_data_no00000[cooperate_data_no00000['high_bias']==0.9]


Out[77]:
bias cells cellswithmotif cellswithmotif_sd cellswithmotif_se elong maxstrandlen motif motiffreq motiffreq_sd ... nonemptystrands_se nr_samples rounds sampler_start strands trials cooperate compete zero_motif high_bias
38 [0.9, 0.1] 100 ['0.85284000000000015', '0.007370610558155976'] ['0.0050725141695218924', '0.007370610558155976'] ['0.0011342486499881842', '0.00164811862437144... 0.05 7 [00111, 11000] [0.035013655233347624, 0.035020681293004764] [0.00047653477131490271, 0.00049215463287092642] ... ['0.00020354263803930346'] 50 7000 1000 100 20 True False 11000 0.9
61 [0.9, 0.1] 100 ['0.77416999999999991', '0.0077548436476824042'] ['0.0088808276641313029', '0.00775484364768240... ['0.0019858134353458261', '0.00173403575511002... 0.05 7 [01011, 10100] [0.02409304917479518, 0.023842220313185399] [0.00041483839891352369, 0.00053169693663315592] ... ['0.00029268368249698494'] 50 7000 1000 100 20 True False 10100 0.9
70 [0.9, 0.1] 100 ['0.70740000000000003', '0.0065688583482976575'] ['0.0072512067961133329', '0.00656885834829765... ['0.0016214191315017869', '0.00146884138013605... 0.05 7 [01101, 10010] [0.018581994485631755, 0.018645445723336856] [0.00026518105940538021, 0.00025683055938335468] ... ['0.00019379874096597932'] 50 7000 1000 100 20 True False 10010 0.9
75 [0.9, 0.1] 100 ['0.68302999999999991', '0.0080145867017582233'] ['0.0073954783482882364', '0.00801458670175822... ['0.0016536792312900361', '0.00179211606766972... 0.05 7 [01110, 10001] [0.019731838450871196, 0.019541093906271866] [0.00050201531115208063, 0.00050492063073901859] ... ['0.00019164838115674285'] 50 7000 1000 100 20 True False 10001 0.9
89 [0.9, 0.1] 100 ['0.79094999999999993', '0.0073982700680631907'] ['0.004811600565300468', '0.0073982700680631907'] ['0.0010759065944588261', '0.001654303478809129'] 0.05 7 [10011, 01100] [0.027318708609762404, 0.027319540231588845] [0.00051172975103048698, 0.00044234877070414548] ... ['0.00017901375785116984'] 50 7000 1000 100 20 True False 01100 0.9
99 [0.9, 0.1] 100 ['0.76337999999999995', '0.0069101085374978083'] ['0.0073348210612120572', '0.00691010853749780... ['0.0016401158495667305', '0.00154514724217467... 0.05 7 [10101, 01010] [0.023526984856746036, 0.023507327523864828] [0.0003659361483050524, 0.00037454493561796324] ... ['0.00018598483809171347'] 50 7000 1000 100 20 True False 01010 0.9
104 [0.9, 0.1] 100 ['0.60818000000000005', '0.0098134397639156393'] ['0.010677246836146487', '0.0098134397639156393'] ['0.0023875049738168101', '0.00219435184052148... 0.05 7 [10110, 01001] [0.01407222720905112, 0.013820651541368611] [0.00033939370767995024, 0.00031514773187306177] ... ['0.00021559644129715979'] 50 7000 1000 100 20 True False 01001 0.9
109 [0.9, 0.1] 100 ['0.87238000000000004', '0.0054175271111458409'] ['0.0058500940163385739', '0.00541752711114584... ['0.0013081207895297817', '0.00121139588904701... 0.05 7 [10111, 01000] [0.034051324912520289, 0.034145286019669506] [0.00038312238363362856, 0.00035459198246088778] ... ['0.00016717758671543859'] 50 7000 1000 100 20 True False 01000 0.9
120 [0.9, 0.1] 100 ['0.59147999999999989', '0.0092771709049688338'] ['0.0080496956464204301', '0.00927717090496883... ['0.0017999666663580192', '0.00207443847823935... 0.05 7 [11010, 00101] [0.014617205058125433, 0.014622699055582059] [0.00037031655773894551, 0.00036113388194471162] ... ['0.00020607398671351052'] 50 7000 1000 100 20 True False 00101 0.9
125 [0.9, 0.1] 100 ['0.85666999999999993', '0.0050637041777734371'] ['0.0054601373609095057', '0.00506370417777343... ['0.0012209238305479957', '0.00113227867594510... 0.05 7 [11011, 00100] [0.030994816164120854, 0.031099084946655708] [0.00036852640871603182, 0.00040974197959439234] ... ['0.00019211482373831349'] 50 7000 1000 100 20 True False 00100 0.9
130 [0.9, 0.1] 100 ['0.63441000000000003', '0.0082213137636268085'] ['0.012302597286752072', '0.0082213137636268085'] ['0.0027509443832982104', '0.001838341643982418'] 0.05 7 [11100, 00011] [0.028810293307396866, 0.0285515601595475] [0.0011740252129996825, 0.00075615628957589214] ... ['0.00018066906763472736'] 50 7000 1000 100 20 True False 00011 0.9
135 [0.9, 0.1] 100 ['0.84727999999999992', '0.0060254792340526751'] ['0.0037917805843692789', '0.00602547923405267... ['0.00084786791424135838', '0.0013473381164355... 0.05 7 [11101, 00010] [0.030098184153307346, 0.029882490346718422] [0.0005511777567757905, 0.00044135102546340031] ... ['0.00022055087735032506'] 50 7000 1000 100 20 True False 00010 0.9
140 [0.9, 0.1] 100 ['0.90540399999999988', '0.0044769632564942811'] ['0.0039471488444192326', '0.00447696325649428... ['0.00055821114284829686', '0.0006331382155580... 0.05 7 [01111, 10000] [0.041925285875835695, 0.041934133104306326] [0.00040019901444195393, 0.00039149795168601237] ... ['0.00012833606495447799'] 50 15000 1000 100 50 True False 10000 0.9
314 [0.9, 0.1] 100 ['0.90128399999999997', '0.0046295071011933772'] ['0.0054146601001355613', '0.00462950710119337... ['0.00076574857492521715', '0.0006547111729610... 0.05 7 [11110, 00001] [0.067006625869633629, 0.066624470107593495] [0.0011698704082052089, 0.0010022435384090551] ... ['0.00012441660339359431'] 50 15000 1000 100 50 True False 00001 0.9

14 rows × 23 columns


In [167]:
sns.set_palette('Greys_d',13)
fig,ax = plt.subplots()
finished = []
cooperate_data_no00000 = cooperate_data
Y = np.swapaxes(np.asarray(map(myFloat,cooperate_data_no00000[cooperate_data_no00000['high_bias']==0.9]['motiffreq'].values)),0,1)[0]
X = cooperate_data_no00000[cooperate_data_no00000['high_bias']==0.9]['zero_motif'].values
new_order = [x for (y,x) in sorted(zip(Y,X), key=lambda pair: pair[0])]
print new_order[::-1]
print len(new_order)
for motif in new_order[::-1]:
    if motif not in finished:
        mirrored = motif
        moment = cooperate_data_no00000[cooperate_data_no00000['zero_motif'] == motif]
        biaslist = np.sort(moment['high_bias'].values)
        meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
        cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]
        if motif == '10000':
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5,color='b')
        elif motif == '00001':
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5,color='r')
        else:
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5)
        for cap in caps:
                cap.set_markeredgewidth(1)

        finished.append(motif)

ax.xaxis.set_ticks_position('bottom')
plt.xlim(0.49,1.01)
plt.ylim(0,0.07)
plt.xlabel(r"$b$",fontsize=20)
plt.ylabel('Motif Frequency at Steady State',fontsize=18)
plt.tick_params(labelsize=18)
plt.title('Cooperate',fontsize=20)
plt.legend(new_order[::-1],loc='lower left',ncol=3,fontsize=12)
# plt.savefig('newleaf_revision_cooperate_all_with00000_ylim_greyscale.pdf',bbox_inches='tight')


['00001', '10000', '00000', '11000', '01000', '00100', '00010', '00011', '01100', '10100', '01010', '10001', '10010', '00101', '01001']
15
00001
10000
00000
11000
01000
00100
00010
00011
01100
10100
01010
10001
10010
00101
01001
['00001', '10000', '00000', '11000', '01000', '00100', '00010', '00011', '01100', '10100', '01010', '10001', '10010', '00101', '01001']

In [166]:
sns.set_palette('Greys_d',13)
fig,ax = plt.subplots()
finished = []
compete_data_no00000 = compete_data
Y = np.swapaxes(np.asarray(map(myFloat,compete_data_no00000[compete_data_no00000['high_bias']==0.9]['motiffreq'].values)),0,1)[0]
X = compete_data_no00000[compete_data_no00000['high_bias']==0.9]['zero_motif'].values
new_order = [x for (y,x) in sorted(zip(Y,X), key=lambda pair: pair[0])]
for motif in new_order[::-1]:
    if motif not in finished:
        mirrored = motif
        moment = compete_data_no00000[compete_data_no00000['zero_motif'] == motif]
        biaslist = np.sort(moment['high_bias'].values)
        meanlist = [float(moment[moment['high_bias'] == bias]['motiffreq'].values[0][0])    for bias in biaslist]
        cilist = [1.96*float(moment[moment['high_bias'] == bias]['motiffreq_se'].values[0][0])  for bias in biaslist]
        if motif == '10000':
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5,color='b')
        elif motif == '00001':
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5,color='r')
        else:
            (ebar, caps, _) = plt.errorbar(biaslist,meanlist,yerr=cilist,alpha=0.9,capsize=5)
        for cap in caps:
                cap.set_markeredgewidth(1)

        color = ebar.get_color()
        finished.append(motif)

plt.xlim(0.49,1.01)
plt.ylim(0.0,0.07)
ax.xaxis.set_ticks_position('bottom')
plt.xlabel(r"$b$",fontsize=20)
plt.ylabel('Motif Frequency at Steady State',fontsize=18)
plt.tick_params(labelsize=18)
ax.legend(finished,loc='lower left',ncol=3,fontsize=12)
plt.title('Compete',fontsize=20)
# plt.savefig('newleaf_revision_compete_all_ylim_with00000_greyscale.pdf',bbox_inches='tight')


00000
10000
01000
00001
00010
00100
11000
00011
10100
00101
10001
01100
01001
10010
01010
['00000', '10000', '01000', '00001', '00010', '00100', '11000', '00011', '10100', '00101', '10001', '01100', '01001', '10010', '01010']