Skip to content

Extended asymmetric division function#1

Open
davidlzhou wants to merge 13 commits into
masterfrom
extended-asym-div
Open

Extended asymmetric division function#1
davidlzhou wants to merge 13 commits into
masterfrom
extended-asym-div

Conversation

@davidlzhou
Copy link
Copy Markdown
Owner

Additions to encode alternative asymmetric division functions, where daughter cells can both be different types from parent.

Implementation of extended asymmetric division, where cell type A can yield daughter cell types B and C through mitosis.

Will need to double-check robustness of pair hash function (collisions?), and add Studio support for this.
Copy link
Copy Markdown

@drbergman drbergman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks really great! A very promising start to this, and so much more than just a start. I think we're already at just the software polishing stage. So, really well done! I think the only outstanding concern not under the polish umbrella is if you've fully accounted for the ordering business. I think we either make synonyms (add extra keys to the behavior_to_int dicts so that no matter how the user inputs the rules, we process them correctly.

Otherwise, just a couple polishing details that will minorly improve the code.

Great job!!

Comment thread Makefile

This comment was marked as resolved.

Comment thread config/PhysiCell_settings.xml
Comment thread config/cell_rules.csv

This comment was marked as resolved.

Comment thread core/PhysiCell_cell.cpp
Comment thread core/PhysiCell_cell.cpp Outdated
Comment thread core/PhysiCell_signal_behavior.cpp Outdated
Comment thread core/PhysiCell_signal_behavior.cpp Outdated
Comment thread core/PhysiCell_standard_models.cpp Outdated
Comment thread core/PhysiCell_standard_models.cpp Outdated
Comment thread main.cpp

This comment was marked as resolved.

Copy link
Copy Markdown

@drbergman drbergman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice update here. I think you have a good hash function now. The Cantor function I suggested is not necessary. What you have here is perfect.

I do think (from my own testing) that we'll still need to set an equality for the unordered map. If there is a hash collision (two keys produce the same hash), equality is then checked to determine which value is being requested. Without defining our own equality, it will not see (3,5) and (5,3) as the same even though they have the same has.

Comment thread core/PhysiCell_phenotype.h
Comment thread core/PhysiCell_phenotype.h Outdated
Comment thread core/PhysiCell_signal_behavior.cpp Outdated
Comment thread core/PhysiCell_phenotype.h
@drbergman
Copy link
Copy Markdown

Great! changes look good! I think one final thing is to add a new sample project that demos this. Give it a name. Add it to Makefile and sample_projects/Makefile-default. Let's make sure that we have cells that have the config use both orders (lower index cell type first and higher index cell type first), and have cells that do the same but for rules. Also, sym div into a new cell type (A -> B+B).

Copy link
Copy Markdown

@drbergman drbergman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! A couple bugs to address and some cleaning up. I'm happy to help directly on the code. I realize I'm probably driving you crazy with all these comments!

Comment thread .gitignore Outdated
!user_projects/empty.txt
Studio.zip
/studio
.vscode/settings.json No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with adding .vscode here (don't need to specify just the settings.json).

However, let's not touch the custom_modules or output folders since those are kind of part of the main repo

<number_of_cells type="int" units="none" description="initial number of cells (for each cell type)">0</number_of_cells>
<number_of_cells type="int" units="none" description="initial number of cells (for each cell type)">5</number_of_cells>
</user_parameters>
</PhysiCell_settings> No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to undo all these changes

Comment thread core/PhysiCell_cell.cpp Outdated
auto first_search = cell_definition_indices_by_name.find(first_target_name);
auto second_search = cell_definition_indices_by_name.find(second_target_name);
// safety first!
if( first_search != cell_definition_indices_by_name.end() || second_search != cell_definition_indices_by_name.end() )
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic here needs to be fixed. Also, a nice trick is to put the error in the if block and then what you currently have in the if block can just go after that error-handling block without the extra indentation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need && instead of ||, but if you take my suggestion about flipping then just be careful to negate correctly :)

Comment thread core/PhysiCell_cell.cpp Outdated
node_eadp = node_eadp.next_sibling("extended_asymmetric_division_probability");
}
std::cout << "Extended asymmetric division probabilities for " << pCD->name << ": ";
for (int i = 0; i < pEAD->asymmetric_division_probabilities.size(); i++)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this line

Comment thread core/PhysiCell_cell.cpp Outdated
for (int i = 0; i < pEAD->asymmetric_division_probabilities.size(); i++)
for (auto it = pEAD->asymmetric_division_probabilities.begin(); it != pEAD->asymmetric_division_probabilities.end(); ++it)
{
std::cout << it->first.first << " " << it->first.second << ": " << it->second << " ";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this print statement would look kinda cluttered...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share a screenshot if you like it? I'd think we'd want something like
Extended asymmetric division probabilities for rgc:

  • rgc + rgc : 0.2
  • rgc + neuron : 0.1
    ...

Something Like that. Or just get rid of this altogether. We print too much stuff at the top of simulations as it is

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an issue we run into here is that we'd have to get the daughter cell type names from the IDs, but if one of the daughter types haven't been processed/created yet, cell_definitions_by_index[ID] won't find the correct cell definition and cause seg fault.

Maybe just get rid?

Comment thread core/PhysiCell_signal_behavior.cpp Outdated
for( int j = i; j < n; j++ )
{ extended_asym_index_to_upper_triangle.push_back( std::make_pair(i,j) ); }
};
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up

Comment thread core/PhysiCell_standard_models.cpp Outdated
{
if (it->first.first != parent_type) // only convert if the parent is not already the correct type
{ pCell_daughter->convert_to_cell_definition( *cell_definitions_by_index[it->first.first] ); }
if (it->first.second != pCell_daughter->type) // only convert if the daughter is not already the correct type
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check against the parent type as above

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flipped!

@@ -0,0 +1 @@
1.14.2 No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file

@@ -0,0 +1,249 @@
<PhysiCell_settings version="devel-version">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need a backup in the sample project. Delete file

Comment on lines +1 to +3
type0,time,increases,extended asymmetric division to type1 and type2,0.5,600,256,0
type0,time,decreases,extended asymmetric division to type1 and type2,0.0,1200,256,0
type0,time,increases,extended asymmetric division to type3 and type4,0.5,1200,256,0 No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also show off symmetric division (1 -> 1 + 1 AND 1 -> 2 + 2) and show that the order doesn't matter (1 -> 4 + 3)

It would be kinda cute to arrange 10 cells in the upper triangular pattern and use the cells.csv to get them to show off each of the possible asymmetric div outcomes. I can help with the csv to make that happen. Let me know

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that sounds like a cool demo! If the initial 10 cells are of the same type though, how should we have them follow different division fates?

Also definitely feel free to directly edit the files! I completely understand that is sometimes easier than getting someone else to properly understand and implement code ideas :)

@drbergman
Copy link
Copy Markdown

Feel free to close, David. I cannot. See here: #2 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants