From be1d9e998b3434382d1b5cf499367fdf415c9af6 Mon Sep 17 00:00:00 2001 From: Furkan Kurtoglu Date: Thu, 27 Jul 2023 18:36:09 -0400 Subject: [PATCH 1/2] Modernized ode-energy-sample model --- .../ode_energy/config/PhysiCell_settings.xml | 146 ++++++++++++++---- .../ode/ode_energy/custom_modules/custom.cpp | 89 +++++------ 2 files changed, 153 insertions(+), 82 deletions(-) diff --git a/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml b/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml index 41901eff6..5a19b3905 100644 --- a/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml +++ b/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml @@ -35,7 +35,7 @@ # # # BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # # # -# Copyright (c) 2015-2018, Paul Macklin and the PhysiCell Project # +# Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project # # All rights reserved. # # # # Redistribution and use in source and binary forms, with or without # @@ -87,7 +87,7 @@ - 1440 + 1440 min micron @@ -120,7 +120,8 @@ false - false + true + false @@ -131,26 +132,29 @@ 38 0 - + - + + + 300.0 0.0 50 - 0.0 + 0 + 300.0 0.0 - 0 - 0.0 + 0 + 0 - + false true @@ -169,51 +173,99 @@ - - - 0.0000000001 - - + + 0.0 + + + 0.0 + + 0.0 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + 0.0 + + + + 0.0 + 0.0 + + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + 2494 - 0.0 0.75 540 - - 0.5 - 0.045 - 0.55 + + 0.05 + 0.0045 + 0.0055 0 0 2.0 - - - 0.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 4.0 + 10.0 + 0.01 + 0.0 + 0.0 + + + + 0.0 0.1 .9 + true true - + false oxygen 1 - - + + 0.0 0.0 @@ -233,7 +285,26 @@ 0 - + + + 0 + + 0 + + + 0 + + 1 + + 0 + + + + + 0 + + + ./config/Toy_Metabolic_Model.xml 0.01 @@ -245,15 +316,34 @@ + + - + 0.0 0.0 0.0 0.0 - + + + + + ./config + cells.csv + + + + + + + ./config + cell_rules.csv + + + + 0 diff --git a/sample_projects_intracellular/ode/ode_energy/custom_modules/custom.cpp b/sample_projects_intracellular/ode/ode_energy/custom_modules/custom.cpp index f88eb0230..562c31bf8 100644 --- a/sample_projects_intracellular/ode/ode_energy/custom_modules/custom.cpp +++ b/sample_projects_intracellular/ode/ode_energy/custom_modules/custom.cpp @@ -105,7 +105,9 @@ void create_cell_types( void ) build_cell_definitions_maps(); display_cell_definitions( std::cout ); - + setup_signal_behavior_dictionaries(); + + return; } @@ -164,23 +166,32 @@ void setup_tissue( void ) for( int i=0; i < positions.size(); i++ ) { pCell = create_cell(get_cell_definition("default")); - int i_Oxy_i = pCell->custom_data.find_variable_index( "intra_oxy" ); - int i_Glu_i = pCell->custom_data.find_variable_index( "intra_glu" ); - int i_Lac_i = pCell->custom_data.find_variable_index( "intra_lac" ); - int energy_vi = pCell->custom_data.find_variable_index( "intra_energy" ); pCell->assign_position( positions[i] ); - pCell->custom_data[i_Oxy_i] = parameters.doubles("initial_internal_oxygen"); + set_single_behavior( pCell , "custom:intra_oxy" , parameters.doubles("initial_internal_oxygen")); + set_single_behavior( pCell , "custom:intra_glu" , parameters.doubles("initial_internal_glucose")); + set_single_behavior( pCell , "custom:intra_lac" , parameters.doubles("initial_internal_lactate")); + set_single_behavior( pCell , "custom:intra_energy" , parameters.doubles("initial_energy")); + +/* pCell->custom_data[i_Oxy_i] = parameters.doubles("initial_internal_oxygen"); pCell->custom_data[i_Glu_i] = parameters.doubles("initial_internal_glucose"); pCell->custom_data[i_Lac_i] = parameters.doubles("initial_internal_lactate"); - pCell->custom_data[energy_vi] = parameters.doubles("initial_energy"); + pCell->custom_data[energy_vi] = parameters.doubles("initial_energy"); */ double cell_volume = pCell->phenotype.volume.total; - pCell->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index]= pCell->custom_data[i_Oxy_i] * cell_volume; - pCell->phenotype.molecular.internalized_total_substrates[glucose_substrate_index]= pCell->custom_data[i_Glu_i] * cell_volume; - pCell->phenotype.molecular.internalized_total_substrates[lactate_substrate_index]= pCell->custom_data[i_Lac_i] * cell_volume; + + //std::cout << "oxygen custom data : " << pCell->custom_data[i_Oxy_i] << std::endl; + //std::cout << "oxygen custom data : SIGNAL" << get_single_signal( pCell, "custom:intra_oxy") << std::endl; + + + set_single_behavior( pCell , "custom:intra_oxy" , parameters.doubles("initial_internal_oxygen")); + + + pCell->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index]= get_single_signal( pCell, "custom:intra_oxy") * cell_volume; + pCell->phenotype.molecular.internalized_total_substrates[glucose_substrate_index]= get_single_signal( pCell, "custom:intra_glu") * cell_volume; + pCell->phenotype.molecular.internalized_total_substrates[lactate_substrate_index]= get_single_signal( pCell, "custom:intra_lac") * cell_volume; pCell->phenotype.intracellular->start(); - (*all_cells)[i]->phenotype.intracellular->set_parameter_value("Energy",pCell->custom_data[energy_vi]); + (*all_cells)[i]->phenotype.intracellular->set_parameter_value("Energy",get_single_signal( pCell, "custom:intra_energy")); } @@ -194,75 +205,45 @@ void update_intracellular() static int glucose_substrate_index = microenvironment.find_density_index( "glucose" ); static int lactate_substrate_index = microenvironment.find_density_index( "lactate"); - double retval; - double retval2; - double retval3; - #pragma omp parallel for for( int i=0; i < (*all_cells).size(); i++ ) { - // Custom Data Indices - static int i_Oxy_i = (*all_cells)[i]->custom_data.find_variable_index( "intra_oxy" ); - static int i_Glu_i = (*all_cells)[i]->custom_data.find_variable_index( "intra_glu" ); - static int i_Lac_i = (*all_cells)[i]->custom_data.find_variable_index( "intra_lac" ); - static int energy_vi = (*all_cells)[i]->custom_data.find_variable_index( "intra_energy" ); - if( (*all_cells)[i]->is_out_of_domain == false ) { // Cell Volume double cell_volume = (*all_cells)[i]->phenotype.volume.total; - // Intracellular Concentrations - double oxy_val_int = (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index]/cell_volume; - double glu_val_int = (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[glucose_substrate_index]/cell_volume; - double lac_val_int = (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[lactate_substrate_index]/cell_volume; - - - //std::cout << "Intracellular Oxygen : " <<(*all_cells)[i]->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index]/cell_volume << " Extracellular Oxygen : " << oxy_val << std::endl; - //std::cout << "Intracellular Glucose : " <<(*all_cells)[i]->phenotype.molecular.internalized_total_substrates[glucose_substrate_index]/cell_volume << " Extracellular Glucose : " << glu_val << std::endl; - //std::cout << "Intracellular Lactate : " <<(*all_cells)[i]->phenotype.molecular.internalized_total_substrates[lactate_substrate_index] << std::endl; - - - //std::cout << "main.cpp: oxy_val (from substrate)= " << oxy_val << std::endl; + // Get Intracellular Concentrations + double oxy_val_int = get_single_signal((*all_cells)[i], "intracellular oxygen"); + double glu_val_int = get_single_signal((*all_cells)[i], "intracellular glucose"); + double lac_val_int = get_single_signal((*all_cells)[i], "intracellular lactate"); // Update SBML (*all_cells)[i]->phenotype.intracellular->set_parameter_value("Oxygen",oxy_val_int); (*all_cells)[i]->phenotype.intracellular->set_parameter_value("Glucose",glu_val_int); (*all_cells)[i]->phenotype.intracellular->set_parameter_value("Lactate",lac_val_int); - - //std::cout << "SBML Oxygen : " <<(*all_cells)[i]->phenotype.intracellular->get_parameter_value("Oxygen") << std::endl; - + // SBML Simulation (*all_cells)[i]->phenotype.intracellular->update(); + // Phenotype Simulation (*all_cells)[i]->phenotype.intracellular->update_phenotype_parameters((*all_cells)[i]->phenotype); - - //std::cout << "Before Intracellular Oxygen : " <<(*all_cells)[i]->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index]/cell_volume << std::endl; - + // Internalized Chemical Update After SBML Simulation (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[oxygen_substrate_index] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Oxygen") * cell_volume; (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[glucose_substrate_index] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Glucose") * cell_volume; (*all_cells)[i]->phenotype.molecular.internalized_total_substrates[lactate_substrate_index] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Lactate") * cell_volume; - //std::cout << "SBML Energy : " <<(*all_cells)[i]->phenotype.intracellular->get_parameter_value("Energy") << std::endl; - /* if ( (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Energy") >100 ) - { - std::cout << "SBML Energy : " <<(*all_cells)[i]->phenotype.intracellular->get_parameter_value("Energy") << " - Cell position : " << (*all_cells)[i]->position << std::endl; - } */ - - //Save custom data - (*all_cells)[i]->custom_data[i_Oxy_i] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Oxygen"); - (*all_cells)[i]->custom_data[i_Glu_i] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Glucose"); - (*all_cells)[i]->custom_data[i_Lac_i] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Lactate"); - (*all_cells)[i]->custom_data[energy_vi] = (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Energy"); + //Save custom data + set_single_behavior( (*all_cells)[i] , "custom:intra_oxy" , (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Oxygen") ); + set_single_behavior( (*all_cells)[i] , "custom:intra_glu" , (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Glucose") ); + set_single_behavior( (*all_cells)[i] , "custom:intra_lac" , (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Lactate") ); + set_single_behavior( (*all_cells)[i] , "custom:intra_energy" , (*all_cells)[i]->phenotype.intracellular->get_parameter_value("Energy") ); + } } - - //std::cout< Date: Thu, 27 Jul 2023 22:37:49 -0400 Subject: [PATCH 2/2] PhyisiCell_rules.o typo is corrected --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aef666d52..00e0f1ade 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_contai PhysiCell_core_OBJECTS := PhysiCell_phenotype.o PhysiCell_cell_container.o PhysiCell_standard_models.o \ PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o PhysiCell_basic_signaling.o \ -PhysiCell_signal_behavior.o PhyisiCell_rules.o +PhysiCell_signal_behavior.o PhysiCell_rules.o PhysiCell_module_OBJECTS := PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o \ PhysiCell_pugixml.o PhysiCell_settings.o PhysiCell_geometry.o