Extended asymmetric division function#1
Conversation
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.
drbergman
left a comment
There was a problem hiding this comment.
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!!
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
drbergman
left a comment
There was a problem hiding this comment.
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.
|
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 |
drbergman
left a comment
There was a problem hiding this comment.
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!
| !user_projects/empty.txt | ||
| Studio.zip | ||
| /studio | ||
| .vscode/settings.json No newline at end of file |
There was a problem hiding this comment.
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 |
| 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() ) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think we need && instead of ||, but if you take my suggestion about flipping then just be careful to negate correctly :)
| 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++) |
| 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 << " "; |
There was a problem hiding this comment.
I feel like this print statement would look kinda cluttered...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
| for( int j = i; j < n; j++ ) | ||
| { extended_asym_index_to_upper_triangle.push_back( std::make_pair(i,j) ); } | ||
| }; | ||
| */ |
| { | ||
| 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 |
There was a problem hiding this comment.
Need to check against the parent type as above
| @@ -0,0 +1 @@ | |||
| 1.14.2 No newline at end of file | |||
| @@ -0,0 +1,249 @@ | |||
| <PhysiCell_settings version="devel-version"> | |||
There was a problem hiding this comment.
Don't need a backup in the sample project. Delete file
| 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
|
Feel free to close, David. I cannot. See here: #2 (comment) |
Additions to encode alternative asymmetric division functions, where daughter cells can both be different types from parent.