Skip to content

Commit

Permalink
updated XML input and output. way better.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathCancer committed Jul 16, 2024
1 parent d5809c3 commit 9a7d006
Show file tree
Hide file tree
Showing 7 changed files with 2,040 additions and 140 deletions.
54 changes: 54 additions & 0 deletions config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">0.1</speed>
Expand Down Expand Up @@ -274,6 +275,9 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>

<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -291,6 +295,8 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>

<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -310,6 +316,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">1.0</sample>
Expand Down Expand Up @@ -385,6 +395,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">1.0</speed>
Expand Down Expand Up @@ -445,6 +456,8 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0.01</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>
<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0.0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -462,6 +475,7 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1.0</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>
<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0.0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -481,6 +495,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">0.0</sample>
Expand Down Expand Up @@ -556,6 +574,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">1.0</speed>
Expand Down Expand Up @@ -616,6 +635,8 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0.01</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>
<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0.0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -633,6 +654,8 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1.0</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>

<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0.0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -652,6 +675,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">0.0</sample>
Expand Down Expand Up @@ -727,6 +754,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">1.0</speed>
Expand Down Expand Up @@ -787,6 +815,8 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0.01</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>
<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0.0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -804,6 +834,8 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1.0</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>

<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0.0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -823,6 +855,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">0.0</sample>
Expand Down Expand Up @@ -898,6 +934,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">0.1</speed>
Expand Down Expand Up @@ -958,6 +995,8 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>
<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0.0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -975,6 +1014,8 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1.0</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>

<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0.0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -994,6 +1035,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">0.0</sample>
Expand Down Expand Up @@ -1069,6 +1114,7 @@
<attachment_elastic_constant units="1/min">0.01</attachment_elastic_constant>
<attachment_rate units="1/min">0.0</attachment_rate>
<detachment_rate units="1/min">0.0</detachment_rate>
<maximum_number_of_attachments units="none">6</maximum_number_of_attachments>
</mechanics>
<motility>
<speed units="micron/min">0.01</speed>
Expand Down Expand Up @@ -1129,6 +1175,8 @@
</secretion>
<cell_interactions>
<dead_phagocytosis_rate units="1/min">0</dead_phagocytosis_rate>
<apoptotic_phagocytosis_rate units="1/min">0</apoptotic_phagocytosis_rate>
<necrotic_phagocytosis_rate units="1/min">0</necrotic_phagocytosis_rate>
<live_phagocytosis_rates>
<phagocytosis_rate name="malignant epithelial cell" units="1/min">0.0</phagocytosis_rate>
<phagocytosis_rate name="M0 macrophage" units="1/min">0.0</phagocytosis_rate>
Expand All @@ -1146,6 +1194,8 @@
<attack_rate name="exhausted T cell" units="1/min">0.0</attack_rate>
</attack_rates>
<attack_damage_rate units="1/min">1.0</attack_damage_rate>
<attack_duration units="min">0.1</attack_duration>

<fusion_rates>
<fusion_rate name="malignant epithelial cell" units="1/min">0.0</fusion_rate>
<fusion_rate name="M0 macrophage" units="1/min">0.0</fusion_rate>
Expand All @@ -1165,6 +1215,10 @@
<transformation_rate name="exhausted T cell" units="1/min">0.0</transformation_rate>
</transformation_rates>
</cell_transformations>
<cell_integrity>
<damage_rate units="1/min">0.0</damage_rate>
<damage_repair_rate units="1/min">0.0</damage_repair_rate>
</cell_integrity>
</phenotype>
<custom_data>
<sample conserved="false" units="dimensionless" description="">0.0</sample>
Expand Down
40 changes: 35 additions & 5 deletions core/PhysiCell_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Cell_State::Cell_State()
number_of_nuclei = 1;

// damage = 0.0;
total_attack_time = 0.0;
// total_attack_time = 0.0;

contact_with_basement_membrane = false;

Expand Down Expand Up @@ -357,7 +357,7 @@ void Cell::advance_bundled_phenotype_functions( double dt_ )
phenotype.geometry.update( this, phenotype, dt_ );

// update integrity
phenotype.integrity.advance_damage( dt_ );
phenotype.cell_integrity.advance_damage( dt_ );

// check for new death events
if( phenotype.death.check_for_death( dt_ ) == true )
Expand Down Expand Up @@ -648,8 +648,10 @@ Cell* Cell::divide( )

// changes for new phenotyp March 2022
// state.damage = 0.0;
// phenotype.integrity.damage = 0.0; // leave alone - damage is heritable
state.total_attack_time = 0;
// child->state.damage = 0.0;
// child->phenotype.integrity.damage = 0.0; // leave alone - damage is heritable
child->state.total_attack_time = 0.0;

return child;
Expand Down Expand Up @@ -1408,7 +1410,7 @@ void Cell::attack_cell( Cell* pCell_to_attack , double dt )
{
// std::cout << this->type_name << " attacks " << pCell_to_attack->type_name << std::endl;
//
pCell_to_attack->phenotype.integrity.damage += phenotype.cell_interactions.attack_damage_rate * dt;
pCell_to_attack->phenotype.cell_integrity.damage += phenotype.cell_interactions.attack_damage_rate * dt;
pCell_to_attack->state.total_attack_time += dt;
}
return;
Expand Down Expand Up @@ -2589,7 +2591,6 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
node_mech = node.child( "maximum_number_of_attachments" );
if ( node_mech )
{ pM->maximum_number_of_attachments = xml_get_my_int_value( node_mech ); }

}

// motility
Expand Down Expand Up @@ -2836,6 +2837,19 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
pugi::xml_node node_dpr = node.child("dead_phagocytosis_rate");
pCI->dead_phagocytosis_rate = xml_get_my_double_value(node_dpr);

pCI->apoptotic_phagocytosis_rate = pCI->dead_phagocytosis_rate;
pCI->necrotic_phagocytosis_rate = pCI->dead_phagocytosis_rate;

// if specific apoptotic rate is specified, overwrite
pugi::xml_node node_apr = node.child("apoptotic_phagocytosis_rate");
if( node_apr )
{ pCI->apoptotic_phagocytosis_rate = xml_get_my_double_value(node_apr); }

// if specific necrotic rate is specified, overwrite
pugi::xml_node node_npr = node.child("necrotic_phagocytosis_rate");
if( node_npr )
{ pCI->necrotic_phagocytosis_rate = xml_get_my_double_value(node_npr); }

// live phagocytosis rates
pugi::xml_node node_lpcr = node.child( "live_phagocytosis_rates");
if( node_lpcr )
Expand Down Expand Up @@ -2967,7 +2981,23 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
node_tr = node_tr.next_sibling( "transformation_rate" );
}

}
}

// cell integrity
node = cd_node.child( "phenotype" );
node = node.child( "cell_integrity" );
if( node )
{
Cell_Integrity *pCI = &(pCD->phenotype.cell_integrity);

pugi::xml_node node_dr = node.child("damage_rate");
if( node_dr )
{ pCI->damage_rate = xml_get_my_double_value( node_dr ); }

pugi::xml_node node_drr = node.child("damage_repair_rate");
if( node_drr )
{ pCI->damage_repair_rate = xml_get_my_double_value( node_drr ); }
}

// intracellular
node = cd_node.child( "phenotype" );
Expand Down
2 changes: 1 addition & 1 deletion core/PhysiCell_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Cell_State
int number_of_nuclei;

// double damage;
double total_attack_time;
double total_attack_time; // now in interactions
bool contact_with_basement_membrane; // not implemented yet

Cell_State();
Expand Down
6 changes: 3 additions & 3 deletions core/PhysiCell_phenotype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ Phenotype& Phenotype::operator=(const Phenotype &p ) {

molecular = p.molecular;

integrity = p.integrity;
cell_integrity = p.cell_integrity;

delete intracellular;

Expand Down Expand Up @@ -1357,7 +1357,7 @@ double& Cell_Transformations::transformation_rate( std::string type_name )
}

// beta functionality in 1.10.3
Integrity::Integrity()
Cell_Integrity::Cell_Integrity()
{
damage = 0;
damage_rate = 0.0;
Expand All @@ -1377,7 +1377,7 @@ Integrity::Integrity()
return;
}

void Integrity::advance_damage( double dt )
void Cell_Integrity::advance_damage( double dt )
{
double temp1;
double temp2;
Expand Down
6 changes: 3 additions & 3 deletions core/PhysiCell_phenotype.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ class Cell_Transformations
};

// pre-beta functionality in 1.10.3
class Integrity
class Cell_Integrity
{
private:
public:
Expand All @@ -738,7 +738,7 @@ class Integrity
// mitochondrial? spindle? other?
*/

Integrity();
Cell_Integrity();

void advance_damage( double dt );
};
Expand All @@ -760,7 +760,7 @@ class Phenotype

Molecular molecular;

Integrity integrity;
Cell_Integrity cell_integrity;

// We need it to be a pointer to allow polymorphism
// then this object could be a MaBoSSIntracellular, or a RoadRunnerIntracellular
Expand Down
Loading

0 comments on commit 9a7d006

Please sign in to comment.