Skip to content

scRNAseq: term info and queries for Samples, Assays and Clusterings; stage and tissue columns; strain stocks - #136

Merged
Robbie1977 merged 3 commits into
mainfrom
scrnaseq-entity-term-info
Nov 5, 2026
Merged

Robbie1977 merged 3 commits into
mainfrom
scrnaseq-entity-term-info

Conversation

@Clare72

@Clare72 Clare72 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

vfb-scRNAseq (the 17 VFBseq_ datasets that replace the FBlc loads) adds Sample, Assay and Clustering individuals. It also links Samples to FlyBase stocks, strains and genetic entities. Until now none of these had term info or queries. Three commits: term info, FindStocks for strains, then the queries with stage and tissue columns.

What changed

Term info

  • Sample, Assay and Clustering pages are built by term_info_fallback when Solr has no document. A new ScRNAseqEntityTermInfoQueryIndexer reuses the indexer's Cluster query on any VFBseq_ Individual. A Clustering's page doesn't list its Samples inline; SamplesInClustering lists them.
  • Related-individual links fall back to the end of the IRI when there's no short_form, so the links aren't dead.
  • Licence records with no licence node are dropped (_real_licenses). Stock pages showed an empty Licence row.

New queries (registered in ha_api.QUERY_TYPE_MAP; reference entry 31a–i)

  • ClustersInClustering, SamplesInClustering, AssaysInClustering.
  • ClusteringsWithSample, which includes other Datasets that reuse the Sample.
  • ClusteringsInDataset, SamplesInDataset, AssaysInDataset.
  • ScRNAseqSamplesFrom and ScRNAseqClustersFrom, on nodes labelled hasScRNAseqSample (stocks, strains, alleles, splits). They follow BAO is derived from and GENO has_genotype.

Existing queries

  • anatScRNAseqQuery shows cell counts.
  • scRNAdatasetData: the count now uses the same pattern as the rows, Clusters with a cell type. It used to count every Individual from the Dataset, including Samples, Assays and Clusterings.
  • Stage and tissue columns: stage and tissue are curated on Samples. A Cluster has its own stage only where it was determined from its expression (Calderon 2022: 129 clusters), and it never has its own tissue. The columns keep the two apart:
    • Clusterings tables: "Sample stages", "Sample tissues".
    • Clusters within one Clustering: "Cluster stage (from expression)".
    • Cluster tables that span Clusterings (anatScRNAseqQuery, expressionCluster, scRNAdatasetData, ScRNAseqClustersFrom): all three columns.
    • Collapsing: sample stages collapse along FBdv substage_of to the narrowest stage covering each period. They never go above embryonic, larval, prepupal, pupal, pharate adult or adult stage. For example, Davie's eight adult ages show as adult stage.
    • Speed: Sample stages and tissues are fetched once per Clustering rather than per row. The cluster-stage edge is matched by type as well as short form, listing both existence_overlaps and existence overlaps. With this, gene → clusters stays at 0.3–0.6 s; an untyped match took 14 s.
  • FindStocks for strains: it now handles FlyBase strains (FBsn) and lists the stock-centre stocks derived from the strain. FlyBase links them through strainprop derived_stock_strain_<centre>.

Testing

  • New offline tests:
    • test_stage_collapse.py (stage collapsing);
    • test_stage_columns.py (turning raw query output into the stage and tissue columns, with the pdb lookups stubbed);
    • test_licenses.py (dropping null licences).
  • New live tests:
    • test_scrnaseq_clustering.py (the 9 queries, their columns, limits and schemas);
    • test_stage_columns.py:
      • rows match headers in the three hand-built cluster tables;
      • a cluster's own stage shows;
      • FBdv substage_of ancestors resolve;
    • test_licenses.py: a stock page has no empty licence, and a dataset keeps its licence;
    • strain cases in test_flybase_stocks.py (DGRP-304; Canton-S at BDSC and Kyoto; DGRP-28, whose stock is gone).
  • Updated: test_term_info_fallback.py.
  • Ran test_scrnaseq_clustering, test_stage_columns, test_stage_collapse, test_licenses, test_transcriptomics, test_term_info_fallback, test_term_info_parity and test_flybase_stocks: 175 passed.
  • Live tests ran against current pdb. That doesn't have the new data yet (Clustering → Sample links, strains, stock labels); to be checked again after the next data release.

term_info_fallback builds their pages when Solr has none, reusing the
indexer's Cluster query on any VFBseq_ Individual; a Clustering's page
leaves its Samples to a query. Related-individual links fall back to the
IRI's tail when the relation has no short_form. Licence records with no
licence node are dropped, so stock pages lose an empty Licence row.
A strain page lists the centre stocks derived from it: Chado links them by
strainprop derived_stock_strain_<centre> ("@fbst...:name@"), with no
stock-strain table. vfb-scRNAseq Samples now link strains (DGRP lines,
Canton-S).
Nine queries: a Clustering's Clusters, Samples and Assays; the Clusterings
using a Sample; a Dataset's Clusterings, Samples and Assays; and Samples and
Clusters from a stock, strain or genetic entity (hasScRNAseqSample).
Cluster rows give the filtered gene count; anatScRNAseqQuery gives cell
counts; scRNAdatasetData's count matches its rows (Clusters with a cell
type, not every Individual).

Stage and tissue are curated on Samples; a Cluster has its own stage only
when determined from its expression. Tables show them apart: "Cluster stage
(from expression)", and the stages / tissues of the Samples of the
cluster's Clustering, fetched once per Clustering. Sample stages collapse
along FBdv substage_of, never above embryonic, larval, prepupal, pupal,
pharate adult or adult stage. The stage edge is matched by type (both
existence_overlaps and `existence overlaps`) as well as id: untyped, it
expands every expresses edge (gene -> clusters 0.2 s -> 14 s).

@Robbie1977 Robbie1977 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed, looks good.

@Robbie1977
Robbie1977 merged commit afb5dd0 into main Nov 5, 2026
6 checks passed
@Clare72
Clare72 deleted the scrnaseq-entity-term-info branch November 5, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants