Example #1
0
    def create_condit_dict(self):
        """takes pmap_path, opens it and turns it into condit_dict (conditions dict)"""
        # open plate map and get headings
        pmap_rows = mia.csv_to_arr(self.pmap_path)
        col_headings = pmap_rows[0][1:]
        del pmap_rows[0]
        pmap_cols = mia.rotate(pmap_rows)
        row_headings = pmap_cols[0]

        del pmap_cols[0]
        pmap_cols = delete_empty_arrs(pmap_cols, col_headings, blank='')
        pmap_rows = mia.rotate(pmap_cols)
        pmap_rows = delete_empty_arrs(pmap_rows, row_headings, blank='')
        pmap_cols = mia.rotate(pmap_rows)

        # make dict keys
        condit_dict = {}
        for row in pmap_rows:
            for item in row:
                condit_dict[item] = []

            # put in values
        for r in range(len(pmap_rows)):
            for c in range(len(pmap_rows[r])):
                well_name = (row_headings[r] + double_digits(col_headings[c]))
                condit_dict[pmap_rows[r][c]].append(well_name)

        self.pmap_rows = pmap_rows
        self.condit_index = sorted(condit_dict.keys())

        return condit_dict
Example #2
0
    def make_cells(self):
        """ 
            in progress, makes cells 
            need to refactor all of well class
        """

        try:
            col_del_num = self.col_headings.index(" ")
        except ValueError:  #use 'in' to do this instead
            col_del_num = -1
        if col_del_num > -1:
            del self.cols[col_del_num]
            del self.col_headings[col_del_num]

        cell_col_num = self.col_headings.index(self.cell_col_h)
        self.row_headings = self.cols[cell_col_num]
        del self.cols[cell_col_num]
        del self.col_headings[cell_col_num]

        self.rows = mia.rotate(self.cols)
        cell_ids = sorted(set(self.row_headings))

        cell_dict = {}
        for cell_id in cell_ids:
            cell_dict[cell_id] = []

        for i, rh in enumerate(self.row_headings):
            cell_dict[rh].append(self.rows[i])

        self.cells = []

        for id_num, rows in cell_dict.items():
            self.cells.append(
                cell(id_num, self.condition, self, rows,
                     copy.copy(self.col_headings)))
    def __init__(self, condition, name) :
        """ well constructor """
        self.condition = condition
        self.plate = self.condition.plate
        
        self.name = name
        self.path = (self.plate.path + self.plate.name 
                    + "_" + self.name + ".csv")
        self.rows = mia.csv_to_arr(self.path)
        
       
        for i, item in enumerate(self.rows[0]):
            self.rows[0][i] = spec_encode(item)
            
     
        self.col_headings = self.rows[0]
        del self.rows[0]
        self.cols = mia.rotate(self.rows)
        
        
        self.cell_col_h = "Track n°"

        self.cell_col_h = spec_encode(self.cell_col_h)
   
        self.make_cells()
Example #4
0
    def make_avg_col(self):
        #mia.print_types(self.all_dist_cols)
        dist_rows = mia.rotate(self.all_dist_cols)

        avg_col = []
        for row in dist_rows:
            #try :
            avg_col.append(mia.calc_avg(row))
            #except TypeError :
            #print("condition = {0}, row = {1}".format(self.name,row))
            #if self.plate.except_count == 0 :
            #print(self.name)
            #mia.print_arr(dist_rows)
            #self.plate.except_count+=1

        return avg_col
Example #5
0
    def __init__(self, id_num, condition, well, rows, col_headings):
        """ cell constructor """

        self.id_num = id_num
        self.condition = condition
        self.well = well

        self.rows = rows

        self.col_headings = col_headings
        self.cols = mia.rotate(rows)

        x_i = self.col_headings.index("X")
        y_i = self.col_headings.index("Y")

        self.x_col = self.cols[x_i]
        self.y_col = self.cols[y_i]

        self.dist_col = self.make_dist_col()
Example #6
0
 def print_to_csv(self):
     rows = mia.rotate(self.all_condit_cols)
     mia.arr_to_csv(rows, self.out_path, mode="w")
Example #7
0
 def print_to_csv(self):
     self.out_path = self.make_out_path()
     rows = mia.rotate(self.all_dist_cols)
     mia.arr_to_csv(rows, self.out_path, mode="w")