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
    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()