Open dganguli opened 6 years ago
One particular place in the code that needs 3D support is here: https://github.com/chanzuckerberg/starfish/blob/master/starfish/assign.py
The goal of this function is to assign 'spots' to 'cells'. The algorithm is a 2D point in polygon method based on ray tracing. This algorithm does not generalize readily to 3D data. What should the proper 3D implementation be?
Do you actually need point in polygon for assignment in 3D? It assumes that your polygon perfectly represents the cell which it hardly will so lots of transcripts that strictly do not meet the point-in-polygon requirements will be left out.
I have several examples of FISSEQ (2000-4000 amplicons per cell) with z-stack 30 steps (can share one FOV to the example data for this package if desirable). My current reasoning is however that affinity propagation clustering solves this better than point-in-polygon in 3D as well as 2D since for cases where the provided polygon is not a perfect description of the cell transcripts will be correctly assigned and also given a probability of membership to that cell.
The reason for why the probability of membership is important is because cross-linking of amplicons to tissue is not always perfect resulting in transcripts "floating around" in the tissue. If using strict point-in-polygon algorithm you will get high Poisson shot noise in your counts per cell making the analysis of low-expressing genes difficult. Being able to give different weight to transcripts based on the probability of membership is desirable.
Affinity propagation clustering: http://www.psi.toronto.edu/affinitypropagation/FreyDueckScience07.pdf http://scikit-learn.org/stable/modules/generated/sklearn.cluster.AffinityPropagation.html
Now a point in polygon for 3D could be nice for other reasons and probably easiest to start with one for convex polyhedrons only.
@dganguli can you break this up into issues for specific algorithms?
After consultation with @shanaxel42 and @ttung, proposing the following...
Let's make sure that we support 3D where underlying algorithms support 3D, but we shouldn't develop new 3D algorithms.
Practically, as of 0.1.9, that means the following...
Target assignment and segmentation need 3D support, but we should NOT try to upgrade the 2D spot finders.
Then we close this issue :D
Which spotfinders are 2D and are the underlying algorithms also 2D-only?
LocalMaxPeakFinder, which wraps the 2D skimage.feature.peak_local_max
Thanks to @ttung for diving in and noting that I was wrong about LocalMaxPeakFinder (silly me for relying on our docs).
Details here: https://github.com/spacetx/starfish/issues/1679
note from @ttung : waiting for skimage release
We want Starfish to natively and seamlessly support 3D images. There are several TODOs in the code where this transition has not been made yet.