Case studies

Setup

For each case study, ensure that cellxgenedp (see the Bioconductor package landing page, or GitHub.io site) is installed (additional installation options are at https://mtmorgan.github.io/cellxgenedp/).

if (!"BiocManager" %in% rownames(installed.packages()))
    install.packages("BiocManager", repos = "https://CRAN.R-project.org")
BiocManager::install("cellxgenedp")

Load the package.

library(cellxgenedp)

Case study: authors & datasets

Challenge and solution

This case study arose from a question on the CZI Science Community Slack. A user asked

Hi! Is it possible to search CELLxGENE and identify all datasets by a specific author or set of authors?

Unfortunately, this is not possible from the CELLxGENE web site – authors are only associated with collections, and collections can only be sorted or filtered by title (or publication / tissue / disease / organism).

A cellxgenedp solution uses authors() to discover authors and their collections, and joins this information to datasets().

author_datasets <- left_join(
    authors(),
    datasets(),
    by = "collection_id",
    relationship = "many-to-many"
)
author_datasets
#> # A tibble: 57,821 × 36
#>    collection_id  family given consortium dataset_id dataset_version_id donor_id
#>    <chr>          <chr>  <chr> <chr>      <chr>      <chr>              <list>  
#>  1 db70986c-7d91… Traeu… K.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  2 db70986c-7d91… Munz   M.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  3 db70986c-7d91… Pauli  J.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  4 db70986c-7d91… Sachs  N.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  5 db70986c-7d91… Vafad… E.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  6 db70986c-7d91… Carri… T.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  7 db70986c-7d91… Maegd… L.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  8 db70986c-7d91… Kastn… P.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#>  9 db70986c-7d91… Heinig M.    <NA>       72955cdb-… 999a6b92-46ca-498… <chr>   
#> 10 2902f08c-f83c… Fan    X.    <NA>       1f1c5c14-… 2afef4bd-99af-41f… <chr>   
#> # ℹ 57,811 more rows
#> # ℹ 29 more variables: assay <list>, batch_condition <list>, cell_count <int>,
#> #   cell_type <list>, citation <chr>, default_embedding <chr>,
#> #   development_stage <list>, disease <list>, embeddings <list>,
#> #   explorer_url <chr>, feature_biotype <list>, feature_count <int>,
#> #   feature_reference <list>, is_primary_data <list>,
#> #   mean_genes_per_cell <dbl>, organism <list>, primary_cell_count <int>, …

author_datasets provides a convenient point from which to make basic queries, e.g., finding the authors contributing the most datasets.

author_datasets |>
    count(family, given, sort = TRUE)
#> # A tibble: 5,159 × 3
#>    family      given        n
#>    <chr>       <chr>    <int>
#>  1 Teichmann   Sarah A.   325
#>  2 Chen        Fei        258
#>  3 Murray      Evan       258
#>  4 Casper      Tamara     256
#>  5 Dee         Nick       256
#>  6 Keene       C. Dirk    248
#>  7 Hirschstein Daniel     241
#>  8 Macosko     Evan Z.    232
#>  9 Travaglini  Kyle J.    230
#> 10 Ding        Song-Lin   226
#> # ℹ 5,149 more rows

Perhaps one is interested in the most prolific authors based on ‘collections’, rather than ‘datasets’. The five most prolific authors by collection are

prolific_authors <-
    authors() |>
    count(family, given, sort = TRUE) |>
    slice(1:5)
prolific_authors
#> # A tibble: 5 × 3
#>   family    given          n
#>   <chr>     <chr>      <int>
#> 1 Teichmann Sarah A.      32
#> 2 Meyer     Kerstin B.    16
#> 3 Polanski  Krzysztof     16
#> 4 Regev     Aviv          15
#> 5 <NA>      <NA>          15

The datasets associated with authors are

right_join(
    author_datasets,
    prolific_authors,
    by = c("family", "given")
)
#> # A tibble: 824 × 37
#>    collection_id  family given consortium dataset_id dataset_version_id donor_id
#>    <chr>          <chr>  <chr> <chr>      <chr>      <chr>              <list>  
#>  1 a96133de-e951… Regev  Aviv  <NA>       ff4cfa86-… 39cb67d3-b63a-4b5… <chr>   
#>  2 a96133de-e951… Regev  Aviv  <NA>       f12ab0e6-… e092fcfd-0ec0-410… <chr>   
#>  3 a96133de-e951… Regev  Aviv  <NA>       ec423499-… f99b3096-1d0a-43e… <chr>   
#>  4 a96133de-e951… Regev  Aviv  <NA>       e2824739-… cb27eb27-e4d8-400… <chr>   
#>  5 a96133de-e951… Regev  Aviv  <NA>       e06e9bf3-… a20bdcca-a595-4e0… <chr>   
#>  6 a96133de-e951… Regev  Aviv  <NA>       d7476ae2-… 863fc5e4-bd4a-468… <chr>   
#>  7 a96133de-e951… Regev  Aviv  <NA>       cd6398a9-… b1b8eeb6-2c25-445… <chr>   
#>  8 a96133de-e951… Regev  Aviv  <NA>       c7d0def0-… d1e77b6f-5afe-42e… <chr>   
#>  9 a96133de-e951… Regev  Aviv  <NA>       aa6f371d-… 2a11a9f4-f96c-493… <chr>   
#> 10 a96133de-e951… Regev  Aviv  <NA>       a6c0143c-… e216d9f2-e114-49e… <chr>   
#> # ℹ 814 more rows
#> # ℹ 30 more variables: assay <list>, batch_condition <list>, cell_count <int>,
#> #   cell_type <list>, citation <chr>, default_embedding <chr>,
#> #   development_stage <list>, disease <list>, embeddings <list>,
#> #   explorer_url <chr>, feature_biotype <list>, feature_count <int>,
#> #   feature_reference <list>, is_primary_data <list>,
#> #   mean_genes_per_cell <dbl>, organism <list>, primary_cell_count <int>, …

Alternatively, one might be interested in specific authors. This is most easily accomplished with a simple filter on author_datasets, e.g.,

author_datasets |>
    filter(
        family %in% c("Teichmann", "Regev", "Haniffa")
    )
#> # A tibble: 573 × 36
#>    collection_id  family given consortium dataset_id dataset_version_id donor_id
#>    <chr>          <chr>  <chr> <chr>      <chr>      <chr>              <list>  
#>  1 a96133de-e951… Regev  Aviv  <NA>       ff4cfa86-… 39cb67d3-b63a-4b5… <chr>   
#>  2 a96133de-e951… Regev  Aviv  <NA>       f12ab0e6-… e092fcfd-0ec0-410… <chr>   
#>  3 a96133de-e951… Regev  Aviv  <NA>       ec423499-… f99b3096-1d0a-43e… <chr>   
#>  4 a96133de-e951… Regev  Aviv  <NA>       e2824739-… cb27eb27-e4d8-400… <chr>   
#>  5 a96133de-e951… Regev  Aviv  <NA>       e06e9bf3-… a20bdcca-a595-4e0… <chr>   
#>  6 a96133de-e951… Regev  Aviv  <NA>       d7476ae2-… 863fc5e4-bd4a-468… <chr>   
#>  7 a96133de-e951… Regev  Aviv  <NA>       cd6398a9-… b1b8eeb6-2c25-445… <chr>   
#>  8 a96133de-e951… Regev  Aviv  <NA>       c7d0def0-… d1e77b6f-5afe-42e… <chr>   
#>  9 a96133de-e951… Regev  Aviv  <NA>       aa6f371d-… 2a11a9f4-f96c-493… <chr>   
#> 10 a96133de-e951… Regev  Aviv  <NA>       a6c0143c-… e216d9f2-e114-49e… <chr>   
#> # ℹ 563 more rows
#> # ℹ 29 more variables: assay <list>, batch_condition <list>, cell_count <int>,
#> #   cell_type <list>, citation <chr>, default_embedding <chr>,
#> #   development_stage <list>, disease <list>, embeddings <list>,
#> #   explorer_url <chr>, feature_biotype <list>, feature_count <int>,
#> #   feature_reference <list>, is_primary_data <list>,
#> #   mean_genes_per_cell <dbl>, organism <list>, primary_cell_count <int>, …

or more carefully by constructing at data.frame of family and given names, and performing a join with author_datasets

authors_of_interest <-
    tibble(
        family = c("Teichmann", "Regev", "Haniffa"),
        given = c("Sarah A.", "Aviv", "Muzlifah")
    )
right_join(
    author_datasets,
    authors_of_interest,
    by = c("family", "given")
)
#> # A tibble: 498 × 36
#>    collection_id  family given consortium dataset_id dataset_version_id donor_id
#>    <chr>          <chr>  <chr> <chr>      <chr>      <chr>              <list>  
#>  1 a96133de-e951… Regev  Aviv  <NA>       ff4cfa86-… 39cb67d3-b63a-4b5… <chr>   
#>  2 a96133de-e951… Regev  Aviv  <NA>       f12ab0e6-… e092fcfd-0ec0-410… <chr>   
#>  3 a96133de-e951… Regev  Aviv  <NA>       ec423499-… f99b3096-1d0a-43e… <chr>   
#>  4 a96133de-e951… Regev  Aviv  <NA>       e2824739-… cb27eb27-e4d8-400… <chr>   
#>  5 a96133de-e951… Regev  Aviv  <NA>       e06e9bf3-… a20bdcca-a595-4e0… <chr>   
#>  6 a96133de-e951… Regev  Aviv  <NA>       d7476ae2-… 863fc5e4-bd4a-468… <chr>   
#>  7 a96133de-e951… Regev  Aviv  <NA>       cd6398a9-… b1b8eeb6-2c25-445… <chr>   
#>  8 a96133de-e951… Regev  Aviv  <NA>       c7d0def0-… d1e77b6f-5afe-42e… <chr>   
#>  9 a96133de-e951… Regev  Aviv  <NA>       aa6f371d-… 2a11a9f4-f96c-493… <chr>   
#> 10 a96133de-e951… Regev  Aviv  <NA>       a6c0143c-… e216d9f2-e114-49e… <chr>   
#> # ℹ 488 more rows
#> # ℹ 29 more variables: assay <list>, batch_condition <list>, cell_count <int>,
#> #   cell_type <list>, citation <chr>, default_embedding <chr>,
#> #   development_stage <list>, disease <list>, embeddings <list>,
#> #   explorer_url <chr>, feature_biotype <list>, feature_count <int>,
#> #   feature_reference <list>, is_primary_data <list>,
#> #   mean_genes_per_cell <dbl>, organism <list>, primary_cell_count <int>, …

Areas of interest

There are several interesting questions that suggest themselves, and several areas where some additional work is required.

It might be interesting to identify authors working on similar disease, or other areas of interest. The disease column in the author_datasets table is a list.

author_datasets |>
    select(family, given, dataset_id, disease)
#> # A tibble: 57,821 × 4
#>    family       given dataset_id                           disease   
#>    <chr>        <chr> <chr>                                <list>    
#>  1 Traeuble     K.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  2 Munz         M.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  3 Pauli        J.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  4 Sachs        N.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  5 Vafadarnejad E.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  6 Carrillo-Roa T.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  7 Maegdefessel L.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  8 Kastner      P.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#>  9 Heinig       M.    72955cdb-bd92-4135-aa52-21f33f9640db <list [1]>
#> 10 Fan          X.    1f1c5c14-5949-4c81-b28e-b272e271b672 <list [1]>
#> # ℹ 57,811 more rows

This is because a single dataset may involve more than one disease. Furthermore, each entry in the list contains two elements, the label and ontology_term_id of the disease. There are two approaches to working with this data.

One approach to working with this data uses facilities in cellxgenedp as outlined in an accompanying article. Discover possible diseases.

facets(db(), "disease")
#> # A tibble: 147 × 4
#>    facet   label                                        ontology_term_id     n
#>    <chr>   <chr>                                        <chr>            <int>
#>  1 disease normal                                       PATO:0000461      1422
#>  2 disease COVID-19                                     MONDO:0100096       66
#>  3 disease dementia                                     MONDO:0001627       50
#>  4 disease breast cancer                                MONDO:0007254       34
#>  5 disease myocardial infarction                        MONDO:0005068       29
#>  6 disease diabetic kidney disease                      MONDO:0005016       26
#>  7 disease Alzheimer disease                            MONDO:0004975       24
#>  8 disease autosomal dominant polycystic kidney disease MONDO:0004691       24
#>  9 disease nonpapillary renal cell carcinoma            MONDO:0007763       19
#> 10 disease colorectal cancer                            MONDO:0005575       17
#> # ℹ 137 more rows

Focus on COVID-19, and use facets_filter() to select relevant author-dataset combinations.

author_datasets |>
    filter(facets_filter(disease, "label", "COVID-19"))
#> # A tibble: 1,912 × 36
#>    collection_id  family given consortium dataset_id dataset_version_id donor_id
#>    <chr>          <chr>  <chr> <chr>      <chr>      <chr>              <list>  
#>  1 d0e9c47b-4ce7… Wyler  Eman… <NA>       ca421096-… 2750429a-1fb0-432… <chr>   
#>  2 d0e9c47b-4ce7… Wyler  Eman… <NA>       4b9e0a15-… e98b604e-c8fa-4df… <chr>   
#>  3 d0e9c47b-4ce7… Mösba… Kirs… <NA>       ca421096-… 2750429a-1fb0-432… <chr>   
#>  4 d0e9c47b-4ce7… Mösba… Kirs… <NA>       4b9e0a15-… e98b604e-c8fa-4df… <chr>   
#>  5 d0e9c47b-4ce7… Franke Vedr… <NA>       ca421096-… 2750429a-1fb0-432… <chr>   
#>  6 d0e9c47b-4ce7… Franke Vedr… <NA>       4b9e0a15-… e98b604e-c8fa-4df… <chr>   
#>  7 d0e9c47b-4ce7… Diag   Asija <NA>       ca421096-… 2750429a-1fb0-432… <chr>   
#>  8 d0e9c47b-4ce7… Diag   Asija <NA>       4b9e0a15-… e98b604e-c8fa-4df… <chr>   
#>  9 d0e9c47b-4ce7… Gottu… Lina… <NA>       ca421096-… 2750429a-1fb0-432… <chr>   
#> 10 d0e9c47b-4ce7… Gottu… Lina… <NA>       4b9e0a15-… e98b604e-c8fa-4df… <chr>   
#> # ℹ 1,902 more rows
#> # ℹ 29 more variables: assay <list>, batch_condition <list>, cell_count <int>,
#> #   cell_type <list>, citation <chr>, default_embedding <chr>,
#> #   development_stage <list>, disease <list>, embeddings <list>,
#> #   explorer_url <chr>, feature_biotype <list>, feature_count <int>,
#> #   feature_reference <list>, is_primary_data <list>,
#> #   mean_genes_per_cell <dbl>, organism <list>, primary_cell_count <int>, …

Authors contributing to these datasets are

author_datasets |>
    filter(facets_filter(disease, "label", "COVID-19")) |>
    count(family, given, sort = TRUE)
#> # A tibble: 836 × 3
#>    family       given           n
#>    <chr>        <chr>       <int>
#>  1 Farber       Donna L.       29
#>  2 Guo          Xinzheng V.    28
#>  3 Saqi         Anjali         28
#>  4 Baldwin      Matthew R.     27
#>  5 Chait        Michael        27
#>  6 Connors      Thomas J.      27
#>  7 Davis-Porada Julia          27
#>  8 Dogra        Pranay         27
#>  9 Gray         Joshua I.      27
#> 10 Idzikowski   Emma           27
#> # ℹ 826 more rows

A second approach is to follow the practices in R for Data Science, the disease column can be ‘unnested’ twice, the first time to expand the author_datasets table for each disease, and the second time to separate the two columns of each disease.

author_dataset_diseases <-
    author_datasets |>
    select(family, given, dataset_id, disease) |>
    tidyr::unnest_longer(disease) |>
    tidyr::unnest_wider(disease)
author_dataset_diseases
#> # A tibble: 74,420 × 5
#>    family       given dataset_id                          label ontology_term_id
#>    <chr>        <chr> <chr>                               <chr> <chr>           
#>  1 Traeuble     K.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  2 Munz         M.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  3 Pauli        J.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  4 Sachs        N.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  5 Vafadarnejad E.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  6 Carrillo-Roa T.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  7 Maegdefessel L.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  8 Kastner      P.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#>  9 Heinig       M.    72955cdb-bd92-4135-aa52-21f33f9640… athe… MONDO:0005311   
#> 10 Fan          X.    1f1c5c14-5949-4c81-b28e-b272e271b6… norm… PATO:0000461    
#> # ℹ 74,410 more rows

Author-dataset combinations associated with COVID-19, and contributors to these datasets, are

author_dataset_diseases |>
    filter(label == "COVID-19")

author_dataset_diseases |>
    filter(label == "COVID-19") |>
    count(family, given, sort = TRUE)

These computations are the same as the earlier iteration using functionality in cellxgenedp.

A further resource that might be of interest is the [OSLr][] package article illustrating how the ontologies used by CELLxGENE can be manipulated to, e.g., identify studies with terms that derive from a common term (e.g., all disease terms related to ‘carcinoma’).

Collaboration

TODO.

It might be interesting to know which authors have collaborated with one another. This can be computed from the author_datasets table, following approaches developed in the grantpubcite package to identify collaborations between projects in the NIH-funded ITCR program. See the graph visualization in the ITCR collaboration section for inspiration.

Duplicate collection-author combinations

Here are the authors

authors <- authors()
authors
#> # A tibble: 6,761 × 4
#>    collection_id                        family       given consortium
#>    <chr>                                <chr>        <chr> <chr>     
#>  1 db70986c-7d91-49fe-a399-a4730be394ac Traeuble     K.    <NA>      
#>  2 db70986c-7d91-49fe-a399-a4730be394ac Munz         M.    <NA>      
#>  3 db70986c-7d91-49fe-a399-a4730be394ac Pauli        J.    <NA>      
#>  4 db70986c-7d91-49fe-a399-a4730be394ac Sachs        N.    <NA>      
#>  5 db70986c-7d91-49fe-a399-a4730be394ac Vafadarnejad E.    <NA>      
#>  6 db70986c-7d91-49fe-a399-a4730be394ac Carrillo-Roa T.    <NA>      
#>  7 db70986c-7d91-49fe-a399-a4730be394ac Maegdefessel L.    <NA>      
#>  8 db70986c-7d91-49fe-a399-a4730be394ac Kastner      P.    <NA>      
#>  9 db70986c-7d91-49fe-a399-a4730be394ac Heinig       M.    <NA>      
#> 10 2902f08c-f83c-470e-a541-e463e25e5058 Fan          X.    <NA>      
#> # ℹ 6,751 more rows

There are 6761 collection-author combinations. We expect these to be distinct (each row identifying a unique collection-author combination). But this is not true

nrow(authors) == nrow(distinct(authors))
#> [1] FALSE

Duplicated data are

authors |> 
    count(collection_id, family, given, consortium, sort = TRUE) |>
    filter(n > 1)
#> # A tibble: 73 × 5
#>    collection_id                        family     given        consortium     n
#>    <chr>                                <chr>      <chr>        <chr>      <int>
#>  1 e5f58829-1a66-40b5-a624-9046778e74f5 Pisco      Angela Oliv… <NA>           4
#>  2 e5f58829-1a66-40b5-a624-9046778e74f5 Crasta     Sheela       <NA>           3
#>  3 e5f58829-1a66-40b5-a624-9046778e74f5 Swift      Michael      <NA>           3
#>  4 e5f58829-1a66-40b5-a624-9046778e74f5 Travaglini Kyle J.      <NA>           3
#>  5 e5f58829-1a66-40b5-a624-9046778e74f5 de Morree  Antoine      <NA>           3
#>  6 51544e44-293b-4c2b-8c26-560678423380 Betts      Michael R.   <NA>           2
#>  7 51544e44-293b-4c2b-8c26-560678423380 Faryabi    Robert B.    <NA>           2
#>  8 51544e44-293b-4c2b-8c26-560678423380 Fasolino   Maria        <NA>           2
#>  9 51544e44-293b-4c2b-8c26-560678423380 Feldman    Michael      <NA>           2
#> 10 51544e44-293b-4c2b-8c26-560678423380 Goldman    Naomi        <NA>           2
#> # ℹ 63 more rows

Discover details of the first duplicated collection, e5f58829-1a66-40b5-a624-9046778e74f5

duplicate_authors <-
    collections() |>
    filter(collection_id == "e5f58829-1a66-40b5-a624-9046778e74f5")
duplicate_authors
#> # A tibble: 1 × 18
#>   collection_id     collection_version_id collection_url consortia contact_email
#>   <chr>             <chr>                 <chr>          <list>    <chr>        
#> 1 e5f58829-1a66-40… 464b3442-4323-432b-a… https://cellx… <chr [2]> angela.pisco…
#> # ℹ 13 more variables: contact_name <chr>, curator_name <chr>,
#> #   description <chr>, doi <chr>, links <list>, name <chr>,
#> #   publisher_metadata <list>, revising_in <lgl>, revision_of <lgl>,
#> #   visibility <chr>, created_at <date>, published_at <date>, revised_at <date>

The author information comes from the publisher_metadata column

publisher_metadata <-
    duplicate_authors |>
    pull(publisher_metadata)

This is a ‘list-of-lists’, with relevant information as elements in the first list

names(publisher_metadata[[1]])
#> [1] "authors"         "is_preprint"     "journal"         "published_at"   
#> [5] "published_day"   "published_month" "published_year"

and relevant information in the authors field, of which there are 221

length(publisher_metadata[[1]][["authors"]])
#> [1] 221

Inspection shows that there are four authors with family name Pisco and given name Angela Oliveira: it appears that the data provided by CZI indeed includes duplicate author names.

From a pragmatic perspective, it might make sense to remove duplicate entries from authors before down-stream analysis.

deduplicated_authors <- distinct(authors)

Tools that I have found useful when working with list-of-lists style data rare listviewer::jsonedit() for visualization, and rjsoncons for filtering and querying these data using JSONpointer, JSONpath, or JMESpath expression (a more R-centric tool is the purrr package).

What is an ‘author’?

The combination of family and given name may refer to two (or more) different individuals (e.g., two individuals named ‘Martin Morgan’), or a single individual may be recorded under two different names (e.g., given name sometimes ‘Martin’ and sometimes ‘Martin T.’). It is not clear how this could be resolved; recording ORCID identifiers migth help with disambiguation.

Case study: using ontology to identify datasets

This case study was developed in response to the following Slack question:

CELLxGENE’s webpage is using different ontologies and displaying them in an easy to interogate manner (choosing amongst 3 possible coarseness for cell types, tissues and age) I was wondering if this simplified tree of the 3 subgroups for cell type, tissue and age categories was available somewhere?

As indicated in the question, CELLxGENE provides some access to ontologies through a hand-curated three-tiered classification of specific facets; the tiers can be retrieved from publicly available code, but one might want to develop a more flexible or principled approach.

CELLxGENE dataset facets like ‘disease’ and ‘cell type’ use terms from ontologies. Ontologies arrange terms in directed acyclic graphs, and use of ontologies can be useful to identify related datasets. For instance, one might be interesed in cancer-related datasets (derived from the ‘carcinoma’ term in the corresponding ontology) in general, rather than, e.g., ‘B-cell non-Hodgkins lymphoma’.

In exploring this question in R, I found myself developing the OLSr package to query and process ontologies from the EMBL-EBI Ontology Lookup Service. See the ‘Case Study: CELLxGENE Ontologies’ article in the OLSr package for full details.

Session information

#> R version 4.4.2 (2024-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] cellxgenedp_1.11.0          dplyr_1.1.4                
#>  [3] SingleCellExperiment_1.29.1 SummarizedExperiment_1.37.0
#>  [5] Biobase_2.67.0              GenomicRanges_1.59.1       
#>  [7] GenomeInfoDb_1.43.2         IRanges_2.41.2             
#>  [9] S4Vectors_0.45.2            BiocGenerics_0.53.3        
#> [11] generics_0.1.3              MatrixGenerics_1.19.0      
#> [13] matrixStats_1.4.1           zellkonverter_1.17.0       
#> [15] BiocStyle_2.35.0           
#> 
#> loaded via a namespace (and not attached):
#>  [1] dir.expiry_1.15.0       xfun_0.49               bslib_0.8.0            
#>  [4] htmlwidgets_1.6.4       rhdf5_2.51.0            lattice_0.22-6         
#>  [7] rhdf5filters_1.19.0     rjsoncons_1.3.1         vctrs_0.6.5            
#> [10] tools_4.4.2             curl_6.0.1              parallel_4.4.2         
#> [13] tibble_3.2.1            fansi_1.0.6             pkgconfig_2.0.3        
#> [16] Matrix_1.7-1            lifecycle_1.0.4         GenomeInfoDbData_1.2.13
#> [19] compiler_4.4.2          httpuv_1.6.15           htmltools_0.5.8.1      
#> [22] sys_3.4.3               buildtools_1.0.0        sass_0.4.9             
#> [25] yaml_2.3.10             tidyr_1.3.1             later_1.4.1            
#> [28] pillar_1.9.0            crayon_1.5.3            jquerylib_0.1.4        
#> [31] DT_0.33                 DelayedArray_0.33.3     cachem_1.1.0           
#> [34] abind_1.4-8             mime_0.12               basilisk_1.19.0        
#> [37] tidyselect_1.2.1        digest_0.6.37           purrr_1.0.2            
#> [40] maketools_1.3.1         fastmap_1.2.0           grid_4.4.2             
#> [43] cli_3.6.3               SparseArray_1.7.2       magrittr_2.0.3         
#> [46] S4Arrays_1.7.1          utf8_1.2.4              withr_3.0.2            
#> [49] promises_1.3.2          filelock_1.0.3          UCSC.utils_1.3.0       
#> [52] rmarkdown_2.29          XVector_0.47.0          httr_1.4.7             
#> [55] reticulate_1.40.0       png_0.1-8               HDF5Array_1.35.2       
#> [58] shiny_1.9.1             evaluate_1.0.1          knitr_1.49             
#> [61] basilisk.utils_1.19.0   rlang_1.1.4             Rcpp_1.0.13-1          
#> [64] xtable_1.8-4            glue_1.8.0              BiocManager_1.30.25    
#> [67] jsonlite_1.8.9          Rhdf5lib_1.29.0         R6_2.5.1               
#> [70] zlibbioc_1.52.0