Moldia / Lee_2023

All the code described in the Lee et al. (2023) paper
6 stars 6 forks source link

Issue running ISS_postprocessing notebook + cell boundary stain question #4

Open Boehmin opened 7 months ago

Boehmin commented 7 months ago

Hello,

First, I managed to run through the pre-processing and decoding notebook really smoothly. It was all well annotated so quite easy to follow along.

I'm trying to run the postprocessing notebook now and I've run into a few issues and one question. For context, I'm running this on our HPC which does not have internet access to download Cellpose models. Working with cellpose I have always had to consider this and point towards the model directory. Despite the notebook running stardist, it tries to download the models so this caused problems (maybe something to keep in mind for similar use cases?) - this was easy to solve for me in past Notebooks (I'm writing an issue to cellpose developers atm since there seems to be a bug...).

The issues I'm encountering otherwise are: The notebook says that necessary packages are imported, but I got error messages that csbdeep, stardist, tensorflow are missing. Is this deliberate due to local requirements? I have not played around with stardist as much as with cellpose, but I have the same error as with cellpose (it is trying to download models - again maybe something worth keeping in mind for annotation?).

Now my question: Have you come across the use case of cell boundary staining in your experiments? This would mean an additional auxilliary-"channel" which I believe is possible to implement in SpaceTX format? We segment muscle fibers so DAPI is only useful for other cell-types and skeletal muscle fibers require cell-boundary staining to identify. Initially I tried to add the cell boundary channel to the dataset definition, but this obviously did not work. Do you already have a solution/work in progress for such a use-case?

Thanks ever so much!

mgcizzu commented 7 months ago

Hi Ines, wow! thanks for the inputs. OK, let me figure this out. I suspect the errors you get with csbdeep etc are indeed a matter of local requirements.

About your question on the cell boundary staining, that's an interesting one. Is the boundary staining carried across all cycles of imaging or is it something you do at the end (ie: an antibody/lectin staining)? Either way, I would perhaps do the following: Register the boundary staining image to the ISS cycles using DAPI, segment on the boundary signal using whichever tool you like (but not using our pipeline). You can run cellpose, stardist or even ilastik (which I very often use when other methods fail), save the segmentation mask and pick the process up from our postprocessing notebook in the step of the anndata creation: ISS_postprocessing.annotated_objects.create_anndata_obj

In this step you just point to your segmentation mask, the decoded spots and (in theory) voila! Let me know if I can help in any way! Good luck! Marco

Boehmin commented 7 months ago

Hi Marco,

thank you for the suggestion, that was indeed what I was going to try next.

The boundary staining will only be done at the end, but what I initially tried was to have the "5th"-channel (in my case) just duplicated across every round. I`ll explain my setup:

  1. I image at a Nikon Ti2 CREST - 25X SIL (4 channels)
  2. Stitch and register the .nd2 tiles resulting from step 1 with our in house Fiji macro (based on BigStitcher) using DAPI
  3. Result from 3 are individual stitched tiles per channel per round that I have input into your workflow Here I thought I could just use my antibody staining (laminin in our case) and use it as channel 5 across every round.
  4. Here they describe the setup of an ISS experiment in starfish so in theory I would only have to define another auxilliary element if I am not mistaken? (that was my thought process) - I have not had time to try this yet, but would be interested in giving it a go if you think that makes sense :)

Thanks ever so much.

mgcizzu commented 5 months ago

Hi, I somehow missed all the github notifications from the last 2 months. Very sorry about that. Don't hesitate at poking me on whatsapp if you want a faster response. I think yours is a valid approach as well, but I think it's much easier if you ignore the starfish setup entirely regarding the membrane staining, and just post-analyse it at the end, as I suggested above. Or at least that's the way it makes more sense for me, because the membrane staining is not really part of the ISS data. I don't see any obvious advantage of implementing it directly in the starfish pipeline. But I have to admit I'm especially lazy when it comes to tinker with the starfish parameters... :) Good luck and keep me posted (thought I might ignore you once again, really sorry for that!). Marco