Skip to content

Commit

Permalink
Merge branch 'development' into make-output-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
drbergman authored Oct 11, 2024
2 parents cfe30a3 + 8c400bb commit c1bfa43
Show file tree
Hide file tree
Showing 70 changed files with 1,780 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
release:
types: [created]
types: [published]

jobs:

Expand Down
33 changes: 17 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ jobs:
{name: "Windows", os: "windows-latest", shell: "msys2", compiler: "g++"},
]
projects: [
{project: "template", name: "PhysiCell Template", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", compare_svgs: true, output_folder: "output"},
{project: "template_BM", name: "PhysiBoSS Template", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", compare_svgs: true, output_folder: "output"},
{project: "physiboss-cell-lines-sample", name: "PhysiBoSS Cell Lines", binary: "PhysiBoSS_Cell_Lines", max_time: 120, config: "config/PhysiCell_settings.xml", compare_svgs: true, output_folder: "output"},
{project: "physimess-sample", name: "PhysiMeSS Sample", binary: "project", config: "config/Fibre_Degradation/mymodel_matrix_degradation.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "physiboss-tutorial", name: "PhysiBoSS Tutorial", binary: "project", config: "config/cell_cycle/PhysiCell_settings.xml", max_time: 300, compare_svgs: true, output_folder: "output"},
{project: "worm-sample", name: "PhysiCell worm", binary: "worm", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: true, output_folder: "output"},
{project: "virus-macrophage-sample", name: "Virus Macrophage", binary: "virus-sample", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: true, output_folder: "output"},
{project: "mechano-sample", name: "PhysiCell Mechano", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: true, output_folder: "output"},
{project: "cancer-biorobots-sample", name: "PhysiCell Cancer Biorobots", binary: "cancer_biorobots", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "biorobots-sample", name: "PhysiCell Biorobots", binary: "biorobots", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "celltypes3-sample", name: "PhysiCell Celltypes3", binary: "celltypes3", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "custom-division-sample", name: "PhysiCell custom division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "interaction-sample", name: "PhysiCell interactions", binary: "interaction_demo", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "pred-prey-farmer", name: "PhysiCell prey predator", binary: "pred_prey", config: "config/PhysiCell_settings.xml", max_time: 120, compare_svgs: false, output_folder: "output"},
{project: "template", name: "PhysiCell Template - make output folder", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", compare_svgs: false, "output_folder": "test/create/output/folder"}
{project: "template", name: "PhysiCell Template", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", output_folder: "output"},
{project: "template_BM", name: "PhysiBoSS Template", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", output_folder: "output"},
{project: "physiboss-cell-lines-sample", name: "PhysiBoSS Cell Lines", binary: "PhysiBoSS_Cell_Lines", max_time: 120, config: "config/PhysiCell_settings.xml", output_folder: "output"},
{project: "physimess-sample", name: "PhysiMeSS Sample", binary: "project", config: "config/Fibre_Degradation/mymodel_matrix_degradation.xml", max_time: 120, output_folder: ""},
{project: "physiboss-tutorial", name: "PhysiBoSS Tutorial", binary: "project", config: "config/cell_cycle/PhysiCell_settings.xml", max_time: 300, output_folder: "output"},
{project: "worm-sample", name: "PhysiCell worm", binary: "worm", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: "output"},
{project: "virus-macrophage-sample", name: "Virus Macrophage", binary: "virus-sample", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: "output"},
{project: "mechano-sample", name: "PhysiCell Mechano", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: "output"},
{project: "cancer-biorobots-sample", name: "PhysiCell Cancer Biorobots", binary: "cancer_biorobots", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "biorobots-sample", name: "PhysiCell Biorobots", binary: "biorobots", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "celltypes3-sample", name: "PhysiCell Celltypes3", binary: "celltypes3", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "custom-division-sample", name: "PhysiCell custom division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "interaction-sample", name: "PhysiCell interactions", binary: "interaction_demo", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "pred-prey-farmer", name: "PhysiCell prey predator", binary: "pred_prey", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "rules-sample", name: "PhysiCell rules sample", binary: "rules_sample", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "asymmetric-division-sample", name: "PhysiCell asymmetric division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""}
]

name: Testing ${{ matrix.projects.name }} on ${{ matrix.os.name }}
Expand All @@ -54,7 +55,7 @@ jobs:

- name: Build ${{ matrix.projects.name }} project
run: |
make data-cleanup && make ${{ matrix.projects.project }} && make PHYSICELL_CPP=${{ matrix.os.compiler }}
make data-cleanup && make ${{ matrix.projects.project }} && make PHYSICELL_CPP=${{ matrix.os.compiler }} PROGRAM_NAME=${{ matrix.projects.binary }}
- name: Run ${{ matrix.projects.name }} project
run: |
Expand Down
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ list-projects:
@echo "Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample"
@echo " celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample"
@echo " worm-sample interaction-sample mechano-sample rules-sample physimess-sample custom-division-sample"
@echo " asymmetric-division-sample"
@echo ""
@echo "Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample"
@echo " cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion"
Expand Down Expand Up @@ -197,15 +198,23 @@ physimess-sample:
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp -r ./sample_projects/physimess/config/* ./config/


custom-division-sample:
cp ./sample_projects/custom_division/custom_modules/* ./custom_modules/
cp -r ./sample_projects/custom_division/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./sample_projects/custom_division/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./sample_projects/custom_division/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./sample_projects/custom_division/config/* ./config/
cp -r ./sample_projects/custom_division/config/* ./config/

asymmetric-division-sample:
cp -r ./sample_projects/asymmetric_division/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./sample_projects/asymmetric_division/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./sample_projects/asymmetric_division/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp -r ./sample_projects/asymmetric_division/config/* ./config/

# ---- intracellular projects
ode-energy-sample:
Expand Down
3 changes: 1 addition & 2 deletions addons/PhysiMeSS/PhysiMeSS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ void physimess_update_cell_velocity( Cell* pCell, Phenotype& phenotype, double d

void physimess_mechanics( double dt )
{
static double dt_tolerance = 0.001 * dt;
if(fabs(((PhysiCell_globals.current_time - last_update_time)) - dt) < dt_tolerance)
if ( PhysiCell_globals.current_time >= last_update_time + dt - 0.5 * diffusion_dt) // last_update_time + dt = next update time; - 0.5 * diffusion_dt will give the time step closest to the desired next time (assumign diffusion_dt is the smallest time step)
{
last_update_time = PhysiCell_globals.current_time;

Expand Down
4 changes: 2 additions & 2 deletions beta/download_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import stat
import shutil

physicell_version = "1.14.0"
physicell_version = "1.14.1"
repo_physicell = "MathCancer/PhysiCell"
physiboss_version = "v2.2.3"
repo_physiboss = "sysbio-curie/PhysiBoSS"
repo_physiboss = "PhysiBoSS/PhysiBoSS"
list_models = {
"physiboss-tutorial": "https://github.com/" + repo_physiboss + "/releases/download/" + physiboss_version + "/",
"physiboss-tutorial-invasion": "https://github.com/" + repo_physiboss + "/releases/download/" + physiboss_version + "/",
Expand Down
2 changes: 1 addition & 1 deletion config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@

<cell_rules>
<rulesets>
<ruleset protocol="CBHG" version="2.0" format="csv" enabled="true">
<ruleset protocol="CBHG" version="3.0" format="csv" enabled="true">
<folder>./config</folder>
<filename>cell_rules_v2.csv</filename>
</ruleset>
Expand Down
100 changes: 57 additions & 43 deletions core/PhysiCell_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Cell_Definition::Cell_Definition()
// are appropriately sized. Same on motiltiy.
phenotype.cell_interactions.sync_to_cell_definitions();
phenotype.cell_transformations.sync_to_cell_definitions();
phenotype.cycle.asymmetric_division.sync_to_cell_definitions();
phenotype.motility.sync_to_current_microenvironment();
phenotype.mechanics.sync_to_cell_definitions();

Expand Down Expand Up @@ -654,8 +655,8 @@ Cell* Cell::divide( )
// child->phenotype.integrity.damage = 0.0; // leave alone - damage is heritable
child->state.total_attack_time = 0.0;

if( this->functions.cell_division_function )
{ this->functions.cell_division_function( this, child); }
if( this->functions.cell_division_function )
{ this->functions.cell_division_function( this, child); }

return child;
}
Expand Down Expand Up @@ -1341,7 +1342,6 @@ void Cell::ingest_cell( Cell* pCell_to_eat )
pCell_to_eat->functions.update_phenotype = NULL;
pCell_to_eat->functions.contact_function = NULL;
pCell_to_eat->functions.cell_division_function = NULL;


// should set volume fuction to NULL too!
pCell_to_eat->functions.volume_update_function = NULL;
Expand Down Expand Up @@ -1794,7 +1794,7 @@ void display_cell_definitions( std::ostream& os )
os << std::endl;
os << "\t\t contact function: "; display_ptr_as_bool( pCF->contact_function , std::cout );
os << std::endl;
os << "\t\t cell division function: "; display_ptr_as_bool( pCF->cell_division_function , std::cout );
os << "\t\t cell division function: "; display_ptr_as_bool( pCF->cell_division_function , std::cout );
os << std::endl;

// summarize motility
Expand Down Expand Up @@ -2032,6 +2032,9 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node

// transformation
pCD->phenotype.cell_transformations.transformation_rates.assign(number_of_cell_defs,0.0);

// asymmetric division
pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.assign(number_of_cell_defs,0.0);
}
else
{
Expand Down Expand Up @@ -2070,6 +2073,7 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
// this requires that prebuild_cell_definition_index_maps was already run
pCD->phenotype.cell_interactions.sync_to_cell_definitions();
pCD->phenotype.cell_transformations.sync_to_cell_definitions();
pCD->phenotype.cycle.asymmetric_division.sync_to_cell_definitions();
pCD->phenotype.mechanics.sync_to_cell_definitions();

// set the reference phenotype
Expand Down Expand Up @@ -2218,11 +2222,49 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node

node = node.next_sibling( "duration" );
}

}



node = cd_node.child( "phenotype" );
node = node.child( "cycle" );
node = node.child( "standard_asymmetric_division" );
if( node && node.attribute("enabled").as_bool() )
{
Asymmetric_Division *pAD = &(pCD->phenotype.cycle.asymmetric_division);

// asymmetric division rates
pugi::xml_node node_adp = node.child( "asymmetric_division_probability");
while (node_adp)
{
// get the name of the target cell type
std::string target_name = node_adp.attribute("name").value();
// now find its index
auto search = cell_definition_indices_by_name.find(target_name);
// safety first!
if( search != cell_definition_indices_by_name.end() )
{
// if the target is found, set the appropriate rate
int target_index = search->second;

double asymmetric_division_probability = xml_get_my_double_value(node_adp);
pAD->asymmetric_division_probabilities[target_index] = asymmetric_division_probability;
}
else
{
std::cout << "Error: When processing the " << pCD->name << " cell definition: " << std::endl
<< "\tCould not find cell type " << target_name << " for asymmetric division." << std::endl
<< "\tRemove this cell type from the asymmetric division probabilities!" << std::endl << std::endl;
exit(-1);
}
node_adp = node_adp.next_sibling("asymmetric_division_probability");
}
std::cout << "Asymmetric division probabilities for " << pCD->name << ": ";
for (int i = 0; i < pAD->asymmetric_division_probabilities.size(); i++)
{
std::cout << pAD->asymmetric_division_probabilities[i] << " ";
}
std::cout << std::endl;
pCD->functions.cell_division_function = standard_asymmetric_division_function;
}
}

// here's what it ***should*** do:
Expand Down Expand Up @@ -2438,45 +2480,11 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
node = node.next_sibling( "duration" );
}


/*
if( node.child( "phase_durations" ) )
{ node = node.child( "phase_durations" ); }
if( node )
{
node = node.child( "duration");
while( node )
{
// which duration?
int start = node.attribute("index").as_int();
// fixed duration?
bool fixed = false;
if( node.attribute( "fixed_duration" ) )
{ fixed = node.attribute("fixed_duration").as_bool(); }
// actual value of the duration
double value = xml_get_my_double_value( node );
// set the transition rate
pCD->phenotype.cycle.data.exit_rate(start) = 1.0 / (value+1e-16);
// set it to fixed / non-fixed
pCD->phenotype.cycle.model().phase_links[start][0].fixed_duration = fixed;
node = node.next_sibling( "duration" );
}
}
*/


node = node.parent(); // phase_durations
node = node.parent(); // model
}

// node = node.parent();

model_node = model_node.next_sibling( "model" );
// death_model_index++;
}

}
Expand Down Expand Up @@ -2821,7 +2829,7 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
}
std::cout << std::endl;
}
}
}

// secretion

Expand Down Expand Up @@ -2972,6 +2980,10 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
pugi::xml_node node_dr = node.child("attack_damage_rate");
pCI->attack_damage_rate = xml_get_my_double_value(node_dr);

// attack_duration
pugi::xml_node node_ad = node.child("attack_duration");
pCI->attack_duration = xml_get_my_double_value(node_ad);

// fusion_rates
pugi::xml_node node_fr = node.child( "fusion_rates");
if( node_fr )
Expand Down Expand Up @@ -3063,7 +3075,9 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
{ pCI->damage_repair_rate = xml_get_my_double_value( node_drr ); }
}

// intracellular
node = cd_node.child( "phenotype" );

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

bool is_out_of_domain;
bool is_movable;

void flag_for_division( void ); // done
void flag_for_removal( void ); // done

Expand Down
4 changes: 2 additions & 2 deletions core/PhysiCell_cell_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void Cell_Container::update_all_cells(double t, double phenotype_dt_ , double me
}
}

if( fabs(time_since_last_cycle-phenotype_dt_ ) < phenotype_dt_tolerance || !initialzed)
if( time_since_last_cycle > phenotype_dt_ - 0.5 * diffusion_dt_ || !initialzed )
{
// Reset the max_radius in each voxel. It will be filled in set_total_volume
// It might be better if we calculate it before mechanics each time
Expand Down Expand Up @@ -201,7 +201,7 @@ void Cell_Container::update_all_cells(double t, double phenotype_dt_ , double me
double time_since_last_mechanics= t- last_mechanics_time;

// if( time_since_last_mechanics>= mechanics_dt || !initialzed)
if( fabs(time_since_last_mechanics - mechanics_dt_) < mechanics_dt_tolerance || !initialzed)
if( time_since_last_mechanics > mechanics_dt_ - 0.5 * diffusion_dt_ || !initialzed )
{
if(!initialzed)
{
Expand Down
32 changes: 32 additions & 0 deletions core/PhysiCell_phenotype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,38 @@ double& Cell_Transformations::transformation_rate( std::string type_name )
return transformation_rates[n];
}

Asymmetric_Division::Asymmetric_Division()
{
asymmetric_division_probabilities = {0.0};
}

void Asymmetric_Division::sync_to_cell_definitions()
{
extern std::unordered_map<std::string,int> cell_definition_indices_by_name;
int number_of_cell_defs = cell_definition_indices_by_name.size();

if( asymmetric_division_probabilities.size() != number_of_cell_defs )
{ asymmetric_division_probabilities.resize( number_of_cell_defs, 0.0); }

return;
}

double Asymmetric_Division::probabilities_total( void )
{
double total = 0.0;
for( int i=0; i < asymmetric_division_probabilities.size(); i++ )
{ total += asymmetric_division_probabilities[i]; }
return total;
}

// ease of access
double& Asymmetric_Division::asymmetric_division_probability( std::string type_name )
{
extern std::unordered_map<std::string,int> cell_definition_indices_by_name;
int n = cell_definition_indices_by_name[type_name];
return asymmetric_division_probabilities[n];
}

// beta functionality in 1.10.3
Cell_Integrity::Cell_Integrity()
{
Expand Down
Loading

0 comments on commit c1bfa43

Please sign in to comment.