コード例 #1
0
def LoadMutationData(arg, dirname, files):
    '''Walks thorough directory tree and looks into MutationRecords.dat files
    calculating the average number and STD of mutations per clone, but only if
    population makes it to the end of simulation. Append all thet that to a
    list'''
    for file in files:
        filepath_general = os.path.join(dirname, file)
        if filepath_general == os.path.join(dirname,'GeneralData.dat'):
            l = re.split(" ", ln.getline(filepath_general,
                                         fl.file_len(filepath_general)-1))
            is_alive = float(l[4])
            if  is_alive > 0.0:
                filepath_turb = os.path.join(dirname,'ModelParams.dat')
                l = re.split(" ", ln.getline(filepath_turb, 6))
                turb_param = float(l[6])
                # change the line number in ln.getline below to extract the
                # parameter you're interested in
                l = re.split(" ", ln.getline(filepath_turb, 12))
                interesting_param = float(l[6])
                filepath_mut = os.path.join(dirname,'MutationRecords.dat')
                Mut_raw_data = p.genfromtxt(filepath_mut)
                l_2 = re.split(" ", ln.getline(filepath_mut,
                                               fl.file_len(filepath_mut)-1))
                time_stamp = float(l_2[1])
                arg.append((turb_param, MutationPerClone(Mut_raw_data),
                            interesting_param, time_stamp))
            else:
                break
コード例 #2
0
def LoadGeneCost(arg, dirname, files):
    for file in files:
        filepath = os.path.join(dirname, file)
        if filepath == os.path.join(dirname, 'Evelopes.dat'):
            l = re.split(" ", ln.getline(filepath, fl.file_len(filepath)))
            death_rate = float(l[1])
            arg.append((death_rate))
コード例 #3
0
def LoadInterestinParam(arg, dirname, files):
        for file in files:
            filepath = os.path.join(dirname, file)
            if filepath == os.path.join(dirname, 'Shannons.dat'):
                l = re.split(" ", ln.getline(filepath, fl.file_len(filepath)))
                fancy_param = float(l[1])
                arg.append((fancy_param))
コード例 #4
0
def LoadTheBigData(arg, dirname, files):
    '''Walks thorough directory tree and looks into GeneralData.dat files
    calculating the average number and STD of born and dead cells per time step,
    but only if population makes it to the end of simulation. Appends all of
    that to a list'''
    for file in files:
        filepath_general = os.path.join(dirname, file)
        if filepath_general == os.path.join(dirname, 'GeneralData.dat'):
            l = re.split(
                " ",
                ln.getline(filepath_general,
                           fl.file_len(filepath_general) - 1))
            is_alive = float(l[4])
            if is_alive > 0.0:
                data = p.genfromtxt(filepath_general)
                filepath_turb = os.path.join(dirname, 'ModelParams.dat')
                l = re.split(" ", ln.getline(filepath_turb, 6))
                turb_param = float(l[6])
                half_run_len = p.floor(data.shape[0] / 2.0)
                data = data[half_run_len:-1, :]
                # goes: turbulence, mean_born, std_born, mean_dead, std_dead
                arg.append((turb_param, data[:, 10].mean(), data[:, 10].std(),
                            data[:, 11].mean(), data[:, 11].std()))
            else:
                break
コード例 #5
0
def LoadMyData(arg, dirname, files):
        for file in files:
            filepath = os.path.join(dirname, file)
            if filepath == os.path.join(dirname,'GeneralData.dat'):
                line_num = fl.file_len(filepath)
                l_1 = re.split(" ", ln.getline(filepath, line_num))
                time_of_comp = float(l_1[5])
                l_2 = re.split(" ", ln.getline(filepath, line_num - 1))
                how_many_cells = float(l_2[4])
                if how_many_cells != 0:
                   did_make_it = 1
                else:
                    did_make_it = 0
                arg.append((time_of_comp, did_make_it))
コード例 #6
0
                    x[j, 4] = p.nan
    x = x[~p.isnan(x).any(1)]
    Mut_record[1] = x.shape[0]
    Mut_record[2] = x[:, 1].mean()
    Mut_record[3] = x[:, 1].std()
    Mut_record[4] = x[:, 2].mean()
    Mut_record[5] = x[:, 2].std()
    Mut_record[6] = x[:, 3].mean()
    Mut_record[7] = x[:, 3].std()
    return Mut_record


l = re.split(
    " ",
    ln.getline('MutationRecords.dat',
               fl.file_len('MutationRecords.dat') - 2))
is_alive = float(l[0])
if (is_alive != -1):
    # Printing stuff just in case...
    mutations = p.genfromtxt('MutationRecords.dat')
    MUTT = MutationPerClone(mutations)
    print "Number of cells :", MUTT[0]
    print "Number of clonal strains :", MUTT[1]
    print "---------------------------------------------"
    print "Average number of gene modification:", MUTT[2], "+/-", MUTT[3], \
    "(mean +/- STD)"
    print "Average number of duplications     :", MUTT[4], "+/-", MUTT[5], \
    "(mean +/- STD)"
    print "Average number of deletions        :", MUTT[6], "+/-", MUTT[7], \
    "(mean +/- STD)"
else: