Skip to content

Commit

Permalink
Merge branch 'physipkpd-tab' of https://github.com/drbergman/PhysiCel…
Browse files Browse the repository at this point in the history
…l-Studio into physipkpd-tab
drbergman committed Jan 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 0239574 + 6ac7fe5 commit 402b4f2
Showing 3 changed files with 47 additions and 20 deletions.
25 changes: 21 additions & 4 deletions bin/cell_def_tab.py
Original file line number Diff line number Diff line change
@@ -515,6 +515,9 @@ def init_default_phenotype_params(self, cdname, reset_mapping):
self.new_intracellular_params(cdname)
self.new_custom_data_params(cdname)

if reset_mapping and self.pkpd_flag:
self.new_pd_data_params(cdname)

# print("\n\n",self.param_d)
# self.custom_data_tab.param_d = self.param_d
# self.custom_data_tab.new_custom_data_params(cdname)
@@ -672,6 +675,7 @@ def copy_cell_def(self):
cdname_original = self.current_cell_def
self.param_d[cdname_copy] = copy.deepcopy(self.param_d[cdname_original])


self.param_d[cdname_copy]["ID"] = str(self.new_cell_def_count) # rwh Note: we won't do this if we auto-generate the ID #s at "save"

for cdname in self.param_d.keys(): # for each cell def, set how it interacts with new cell based on how it interacted with original cell
@@ -693,7 +697,7 @@ def copy_cell_def(self):
self.current_cell_def = cdname_copy
# self.cell_type_name.setText(cdname)

self.add_new_celltype(cdname_copy) # add to all qcomboboxes that have celltypes (e.g., in interactions)
self.add_new_celltype(cdname_copy, reset_mapping=False) # add to all qcomboboxes that have celltypes (e.g., in interactions)
# print('3) copy_cell_def(): param_d.keys=',self.param_d.keys())

#----- Update this new cell def's widgets' values
@@ -7063,7 +7067,7 @@ def new_intracellular_params(self, cdname):
self.param_d[cdname]["intracellular"] = None


def add_new_substrate(self, sub_name): # called for both "New" and "Copy" of substrate/signal
def add_new_substrate(self, sub_name, sub_to_copy): # called for both "New" and "Copy" of substrate/signal
self.add_new_substrate_comboboxes(sub_name)

sval = self.default_sval
@@ -7089,8 +7093,14 @@ def add_new_substrate(self, sub_name): # called for both "New" and "Copy" of su
if self.rules_tab:
self.rules_tab.add_new_substrate(sub_name)

self.pkpd_add_new_substrate(sub_name, sub_to_copy)

def pkpd_add_new_substrate(self, sub_name, sub_to_copy):
for cdname in self.param_d.keys():
D = {} if sub_to_copy is None else self.param_d[cdname]["pd"][sub_to_copy]
self.param_d[cdname]["pd"][sub_name] = D

def add_new_celltype(self, cdname):
def add_new_celltype(self, cdname, reset_mapping=True):
self.add_new_celltype_comboboxes(cdname)
self.physiboss_update_list_signals()
self.physiboss_update_list_behaviours()
@@ -7103,7 +7113,7 @@ def add_new_celltype(self, cdname):
# self.param_d[cdname]["secretion"][sub_name]["secretion_target"] = sval
# self.param_d[cdname]["secretion"][sub_name]["uptake_rate"] = sval
# self.param_d[cdname]["secretion"][sub_name]["net_export_rate"] = sval
if self.pkpd_flag is True:
if reset_mapping is True and self.pkpd_flag is True:
self.pd_model_combobox.setCurrentIndex(self.pd_model_combobox.findText("None"))

def new_custom_data_params(self, cdname):
@@ -7121,6 +7131,13 @@ def new_custom_data_params(self, cdname):
self.param_d[cdname]['custom_data'][key] = [self.custom_var_value_str_default, self.custom_var_conserved_default] # [value, conserved flag]
idx += 1

#-----------------------------------------------------------------------------------------
def new_pd_data_params(self, cdname):
if "pd" not in self.param_d[cdname].keys():
return
for substrate in self.param_d[cdname]["pd"].keys():
self.param_d[cdname]["pd"][substrate] = {} # set to empty dictionary, enable_pd_parameters() will take care of the rest

#-----------------------------------------------------------------------------------------
def update_cycle_params(self):
# pass
36 changes: 20 additions & 16 deletions bin/microenv_tab.py
Original file line number Diff line number Diff line change
@@ -1073,20 +1073,21 @@ def new_substrate(self):
self.param_d[subname]["enable_zmin"] = bval
self.param_d[subname]["enable_zmax"] = bval

self.param_d[subname]["pk_model"] = "None"
self.param_d[subname]["schedule_format"] = "parameters"
self.param_d[subname]["total_doses"] = "0"
self.param_d[subname]["loading_doses"] = "0"
self.param_d[subname]["first_dose_time"] = "0"
self.param_d[subname]["dose_interval"] = "1"
self.param_d[subname]["regular_dose"] = "0"
self.param_d[subname]["loading_dose"] = "0"
self.param_d[subname]["elimination_rate"] = "0"
self.param_d[subname]["k12"] = "0"
self.param_d[subname]["k21"] = "0"
self.param_d[subname]["volume_ratio"] = "1"
self.param_d[subname]["biot_number"] = "1"
self.param_d[subname]["sbml_filename"] = "PK_default.xml"
if self.pkpd_flag:
self.param_d[subname]["pk_model"] = "None"
self.param_d[subname]["schedule_format"] = "parameters"
self.param_d[subname]["total_doses"] = "0"
self.param_d[subname]["loading_doses"] = "0"
self.param_d[subname]["first_dose_time"] = "0"
self.param_d[subname]["dose_interval"] = "1"
self.param_d[subname]["regular_dose"] = "0"
self.param_d[subname]["loading_dose"] = "0"
self.param_d[subname]["elimination_rate"] = "0"
self.param_d[subname]["k12"] = "0"
self.param_d[subname]["k21"] = "0"
self.param_d[subname]["volume_ratio"] = "1"
self.param_d[subname]["biot_number"] = "1"
self.param_d[subname]["sbml_filename"] = "PK_default.xml"

# NOooo!
# self.param_d["gradients"] = bval
@@ -1098,8 +1099,10 @@ def new_substrate(self):

self.new_substrate_count += 1

self.celldef_tab.add_new_substrate(subname)
substrate_to_copy = None
self.celldef_tab.add_new_substrate(subname, substrate_to_copy)
self.config_tab.add_new_substrate(subname)

# self.celldef_tab.add_new_substrate_comboboxes(subname)
# self.param_d[cell_def_name]["secretion"][substrate_name] = {}

@@ -1146,7 +1149,8 @@ def copy_substrate(self):

# self.celldef_tab.add_new_substrate_comboboxes(subname)

self.celldef_tab.add_new_substrate(subname)
substrate_to_copy = self.current_substrate
self.celldef_tab.add_new_substrate(subname, substrate_to_copy)
self.config_tab.add_new_substrate(subname)

self.current_substrate = subname
6 changes: 6 additions & 0 deletions bin/populate_tree_cell_defs.py
Original file line number Diff line number Diff line change
@@ -60,6 +60,12 @@ def pkpd_populate_tree_cell_defs(cell_def_tab, uep, pkpd_flag):
return
idx = 1
for cell_def in uep:
if cell_def.tag != "cell_definition":
logging.debug(f'--------pkpd_populate_tree_cell_defs: found unexpected child <cell_definitions>; skip over {cell_def}')
continue
if cell_def.tag == "cell_rules":
logging.debug(f'--------pkpd_populate_tree_cell_defs: found cell_rules child; break out on {cell_def}')
continue
cell_def_name = cell_def.attrib['name']
cell_def_tab.param_d[cell_def_name]["pd"] = {}
jdx = 1

0 comments on commit 402b4f2

Please sign in to comment.