meyer-lab / tHMM

A general Python framework for using hidden Markov models on binary trees or cell lineage trees.
https://asmlab.org
MIT License
10 stars 1 forks source link

importing the new lineage data #876

Closed Farnazmdi closed 2 years ago

Farnazmdi commented 2 years ago

@aarmey sorry, I can't understand how to work with the new data. I mean, I don't know what each variable mean and how to construct the lineage with those track ids. It would be very much helpful if you could help me figure that out through an example, I mean, how to find each cell's parent or children, whenever it was convenient for you. Thank you. image

aarmey commented 2 years ago

Can you point me to the file?

aarmey commented 2 years ago

Ok, an individual always has the same track ID. Images are taken every 30 mins, so you can get the lifetime (in hrs) of a cell by taking the first and last frame that a track ID appears in and calculating 0.5*(end - start).

All cells within a lineage have a unique lineage ID, so you can get all of the information for one lineage by filtering for a single lineage ID.

Cell division should lead to two new track IDs. For the first image in which the new cell appears, the parent track ID column will have the ID of the parent. I think cell death will just be reflected by a cell that ends with no children.

I don't know what the track and lineage IDs of -1 mean. We'll have to ask about that.

I would suggest looping over lineage IDs first. You can then subset the table to only that lineage. You can then create the first cell and see how long it lives. Remove that cell from the data table. If there are remaining rows, you then make that cell divide and take care of the two daughters. Remove those cells from the table. Eventually you've built that one lineage and can move on.

Farnazmdi commented 2 years ago

Thank you so much, it is ver helpful. I will start working on it.

Farnazmdi commented 2 years ago

I think I have it mostly set up, but there is still one problem. I can't distinguish when a cell dies or when the experiment ends.. I mean, when the cell has no children, it means either its lifetime is censored or it dies, but I am not sure how to distinguish this. The number of frames for each lineage doesn't seem to be the same...Maybe if I have that, I can check whether the last offsprings reached that frame or not, and if they did, it means their lifetime is censored, otherwise dead. I appreciate it if you have any suggestions about this. Thank you.

aarmey commented 2 years ago

It should be the same as before. We pick a cutoff time, and if cells made it past that frame we stop observing them and they lived. If there's an end without division before that frame they died.

"The number of frames for each lineage doesn't seem to be the same." I don't understand this point. Why would lineages always last the same amount of time?

Farnazmdi commented 2 years ago

Sorry, I meant the number of frames that each lineage has, is different from one another. I printed the number of frames for each lineage, and apparently, the maximum of them is 50, and more than half of the lineages have 50 frames. Should I assume that to be the end of the experiment and treat those cells in lineages that didn't reach this number of frames as cell death?

aarmey commented 2 years ago

It looks like the last frame in the dataset is numbered 49. If a cell is alive in frame 49, you can conclude you don't know its ultimate fate.

Farnazmdi commented 2 years ago

Thank you.