Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getter functions for lists of dying and dividing cells #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

josephabrams
Copy link

I realize there are other ways to figure this out, but it might be very convenient to access the list of cells that are going to divide or die in C++ code. These are (I think) relatively safe getters that pass back a reference to the cell_containers private members:
cells_ready_to_divide and cells_ready_to_die, I realize these getters have some redundancy, but I wasn't sure which version would be the preferred. My main motivation is that these functions allow me to easily check the safety of cell addons that aren't inheriting the Cell class. It also makes it easier to code custom functions that track generations or customize post-death cell actions outside of using a "phenotype" approach.

@MathCancer
Copy link
Owner

Hi, this is really cool!

Could you provide some brief documentation on when it's best (and safe) to use this function, and the use cases?

@josephabrams
Copy link
Author

Both versions of the function, read what cells have been flagged for division (or death) in a cell container. These variables are private, but they can be used to trigger/track division or death-based events. They can also be used for lineage tracking. To safely trigger such an event you would want to be sure that you store the vector of cells that are flagged for death or flagged for division after all flags have been updated. Then after division or death occurs, you have a list of what cells have died or been newly created on this time step. My use case is: when I have custom code that will break if divisions or death occurs, I can check for these flags as a safety feature, or more easily change the custom code to adapt to changes in the number of active/valid cells.

@drbergman
Copy link
Contributor

Is your custom code in custom_modules? Or is it custom additions to update_all_cells? The main concern about adding these functions in to core PhysiCell is where in the code others would make use of them. These lists quickly become stale/cleared:

  1. advance_bundled_phenotype_functions parallel iterates over all cells
    ...
    a. Some are flagged for death
    b. all cells advance cycle (and thus some are flagged for division)
  2. the division list is processed serially
  3. the death list is processed serially
  4. the lists are cleared

You would (likely) have to make use of these lists after 1 (since that's done in parallel) and then before 4. I believe the only functions that we expect a user to be changing in that window would be cycle entry and exit functions. If you could provide some insight on where in this flow your functions are used, that would help in assessing if they make sense to include in core PhysiCell.

@josephabrams
Copy link
Author

I thought I would be able to put it into a custom_phenotype function, but it seems I made a mistake in the order.

@drbergman
Copy link
Contributor

Ah I see. Yeah, the phenotype functions are run in parallel and prior to what I labeled above as 'a' within advance_bundled_phenotype_functions. If I'm reading this correctly, you have not yet tested this in your own custom phenotype functions/in your own project? If not, it is encouraged to experiment in your own project by editing the core features of PhysiCell. It might be difficult to do it right, but you can definitely make changes to your own stuff. If after running it with your own work for a bit, you think others could benefit, that would be the time to open a PR. If you can't figure out how to get some feature working in the core code, that would be a time to open an Issue or bring it up in Slack. Slack is probably better for that.

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.

None yet

3 participants