def retrieve(self, cell, drug, correct_background=True, correct_lower_boundary=True): drug_c_array = np.array([0]+[2**_i for _i in range(0, 9)])*0.5**8 def helper_round(t_container): t_container_vals = [np.repeat(t_container[cell_n, _drug_n][:, np.newaxis], 10, axis=1) for _drug_n in drugs_nos] t_container_vals = supporting_functions.block_fusion(t_container_vals) t_container_vals = t_container_vals[:, c_argsort] return t_container_vals cell_n = self.cell_line_2_idx[cell] retained_drugs = [drug_v for drug_v in self.drug_versions[drug]] drugs_nos = [self.drug_2_idx[drug_v] for drug_v in retained_drugs] drug_vals = [self.raw_data[cell_n, drug_n].copy() for drug_n in drugs_nos] drug_c = [drug_v[1]*drug_c_array for drug_v in retained_drugs] anchor = np.min(np.array([drug_v[1] for drug_v in retained_drugs])) anchor /= 2.**10 drug_vals = supporting_functions.block_fusion(drug_vals) drug_c = np.hstack(drug_c) c_argsort = np.argsort(drug_c) drug_c = drug_c[c_argsort] drug_vals = drug_vals[:, c_argsort, :] t0_bck_vals = helper_round(self.t0_background.copy()) tf_bck_vals = helper_round(self.t_f_background.copy()) t0_vals = helper_round(self.t0_median.copy()) noise_dispersion = [helper_round(self.background[:, :, :, i].copy()) for i in range(0, 4)] noise_dispersion = supporting_functions.estimate_differences(noise_dispersion) if correct_background: drug_vals -= tf_bck_vals[:, :, np.newaxis] t0_vals -= t0_bck_vals[:, :] if correct_lower_boundary: drug_vals = supporting_functions.get_boundary_correction(drug_vals, self.std_of_tools) # print 'drug_vals', drug_vals # print 'drug_c', drug_c # print 't0_vals', t0_vals return drug_vals, drug_c, t0_vals, noise_dispersion, anchor
def helper_round(t_container): t_container_vals = [np.repeat(t_container[cell_n, _drug_n][:, np.newaxis], 10, axis=1) for _drug_n in drugs_nos] t_container_vals = supporting_functions.block_fusion(t_container_vals) t_container_vals = t_container_vals[:, c_argsort] return t_container_vals