chanzuckerberg / cellxgene-ontology-guide

MIT License
2 stars 0 forks source link

feat(cog): given a term label, get the term ID #206

Open atarashansky opened 2 months ago

atarashansky commented 2 months ago

Need

I'm building an API for fetching CellGuide marker genes. I would like for it to be flexible enough to handle both cell type IDs and labels as possible inputs. I cannot currently support term labels as inputs since I have no convenient way of mapping it back to the term ID.

Approach

ontology_parser.get_term_id(label: str) --> possible may need ontology name if the same label is present in multiple ontologies, alternatively fetch all IDs indexed by ontology type, e.g. {"CL": "ID1", "UBERON": "ID2"}

Describe alternatives you've considered I would need to interface with the ontology file directly to construct a mapping but that seems ugly compared to using the ontology parser.

nayib-jose-gloria commented 2 months ago

engineering estimate: about 1 day to implement x 1 engineer

brianraymor commented 2 months ago

@atarashansky @niknak33 - It's trivial to implement such a feature even across our set of ontologies (although your case is specific to CL)

Nonetheless, could you tell us more about the scenario and the API flow? For example, how are you imagining that a user identifies a CL label as an input?

If we're blueskying more broadly (besides cut-n-paste from CELLxGENE UX), then possibilities include:

  1. Return a list of all terms + labels
  2. Support RegEx requests for labels because I know that I want some kind of endothelial cell, but I'm not sure what it's called
atarashansky commented 2 months ago

Users can identify a CL label as an input by copying the name of a CellGuide page's title. Perhaps it would be easier for them to use that rather than copy and pasting the CL ID.

There's also a developer POV - sometimes I find myself needing to quickly get the CL ID for a particular label of interest. Usually, I use CellGuide for this, but it's annoying to have to context switch outside my python environment to open up CellGuide for this info. It would be convenient to be able to use the ontology parser for this.

kaloster commented 3 weeks ago

+1

I'd like to build a feature in Explorer that presents cell type info whenever a user clicks on a cell label under standard categories - however there's no CL ID available in Explorer at the moment that I can use to that end

brianraymor commented 3 weeks ago

The CXG converter could also consume+store the cell_type_ontology_term_id for the cell_type label that's available in the H5AD.

atarashansky commented 3 weeks ago

True - though this feature doesn't seem like a big lift and there have been a number of asks for it. Would it be possible to add into COG?