nadeemlab / SPT

Spatial profiling toolbox for spatial characterization of tumor immune microenvironment in multiplex images
https://oncopathtk.org
Other
21 stars 2 forks source link

`PhenotypeCriteria` should not use `list` data structures #205

Closed CarlinLiao closed 1 year ago

CarlinLiao commented 1 year ago

Presently PhenotypeCriteria is defined as follows:

https://github.com/nadeemlab/SPT/blob/dda3cbdd392afdacd4d9ff9e2bcf1a79d5dd17df/spatialprofilingtoolbox/db/exchange_data_formats/metrics.py#L43-L46

Ideally, the markers should instead be held in a data structure that

  1. is in a fixed order
  2. is unmutuable and hashable
  3. doesn't allow for duplicate markers

tuple[str,...] accomplishes the 1 and 2, while a set[str] does 3. A frozen set would handle 1 and 3. For all of them, we might have to create a custom data structure. Maybe we drop criterion 3 and just use tuple for 1 and 2.

jimmymathews commented 1 year ago

I will close because although this seems desirable (to pre-empt possible bugs related to duplicate markers), it is not very urgent considering that there seem to be no functional issues cause by this list. If you come up with an adequate data type, feel free to reopen and implement.