Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add scRNAseq queries to VFB _JSON schema ( and from there to XMI) #112

Closed
Clare72 opened this issue Oct 18, 2022 · 6 comments
Closed

add scRNAseq queries to VFB _JSON schema ( and from there to XMI) #112

Clare72 opened this issue Oct 18, 2022 · 6 comments
Assignees

Comments

@Clare72
Copy link
Contributor

Clare72 commented Oct 18, 2022

query for genes in a cluster
MATCH (c:Cluster)-[e:expresses]->(g:Gene) WHERE c.short_form="FBlc0004872" RETURN g.label, labels(g), e.expression_level[0], e.expression_extent[0] ORDER BY e.expression_extent[0] DESCENDING

query for clusters of a cell type
MATCH (ds:DataSet)<-[:has_source]-(c:Cluster)-[:composed_primarily_of]->(a:Anatomy:Class)-[:SUBCLASSOF*..]->(b:Anatomy:Class) WHERE (a.short_form="FBbt_00058207") OR (b.short_form="FBbt_00058207") RETURN c.label, a.label, ds.label

@dosumis dosumis changed the title add queries to xmi add scRNAseq queries to VFB _JSON schema ( and from there to XMI) Oct 18, 2022
@dosumis
Copy link
Member

dosumis commented Oct 19, 2022

Tables to support

image

To consider:

  • How does this fit with the SOLR caching model for queries?
  • Better to show cell type in expression report (could be in header, but probably easier to achieve in table for now).

@dosumis
Copy link
Member

dosumis commented Oct 19, 2022

The genes expressed in cluster query will never explode - at most it would have rows in the thousands, so it could be precached in SOLR - indexed on cluster ID.

OTOH - the query for clusters of a cell type could grow large and the query with an OR and no-limits transitive traversing of subClassOf is already a bit slow if you choose a high level class ('cell' takes 2 seconds). An alternative is to use an OWL prequery and index rows on anatomy class id (MATCH (ds:DataSet)<-[:has_source]-(c:Cluster)-[:composed_primarily_of]->(a:Anatomy:Class))

@Robbie1977
Copy link
Contributor

MATCH (ds:scRNAseq_DataSet:Individual)<-[:has_source]-(c:Cluster)-[:composed_primarily_of]->(a:Anatomy:Class) RETURN c.label, a.label, ds.label
7ms

@Robbie1977
Copy link
Contributor

Robbie1977 commented Nov 15, 2022

anat_image_query

MATCH (primary:Individual) WHERE primary.short_form in ['FBlc0003977']  
WITH primary 
OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary   OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class)  
WITH CASE WHEN channel IS NULL THEN [] ELSE collect ({ channel: { short_form: channel.short_form, label: coalesce(channel.label,''), iri: channel.iri, types: labels(channel), unique_facets: apoc.coll.sort(coalesce(channel.uniqueFacets, [])), symbol: coalesce(([]+channel.symbol)[0], '')} , imaging_technique: { short_form: technique.short_form, label: coalesce(technique.label,''), iri: technique.iri, types: labels(technique), unique_facets: apoc.coll.sort(coalesce(technique.uniqueFacets, [])), symbol: coalesce(([]+technique.symbol)[0], '')} ,image: { template_channel : { short_form: template.short_form, label: coalesce(template.label,''), iri: template.iri, types: labels(template), unique_facets: apoc.coll.sort(coalesce(template.uniqueFacets, [])), symbol: coalesce(([]+template.symbol)[0], '')} , template_anatomy: { short_form: template_anat.short_form, label: coalesce(template_anat.label,''), iri: template_anat.iri, types: labels(template_anat), unique_facets: apoc.coll.sort(coalesce(template_anat.uniqueFacets, [])), symbol: coalesce(([]+template_anat.symbol)[0], '')} ,image_folder: COALESCE(([]+irw.folder)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary 
OPTIONAL MATCH (primary)-[:INSTANCEOF]->(typ:Class)  
WITH CASE WHEN typ is null THEN [] ELSE collect ({ short_form: typ.short_form, label: coalesce(typ.label,''), iri: typ.iri, types: labels(typ), unique_facets: apoc.coll.sort(coalesce(typ.uniqueFacets, [])), symbol: coalesce(([]+typ.symbol)[0], '')} ) END AS types,primary,channel_image RETURN { core : { short_form: primary.short_form, label: coalesce(primary.label,''), iri: primary.iri, types: labels(primary), unique_facets: apoc.coll.sort(coalesce(primary.uniqueFacets, [])), symbol: coalesce(([]+primary.symbol)[0], '')} , description : coalesce(primary.description, []), comment : coalesce(primary.comment, []) } AS term, 'c15d2fd' AS version , channel_image, types

@dosumis
Copy link
Member

dosumis commented Nov 15, 2022

Plan:

Cache SOLR documents with sufficient info per line.

<Some standard dataset query here>-(c:Cluster)-[:composed_primarily_of]->(a:Anatomy:Class:Cell) RETURN < some standard return clause here>

Query on site then runs OWLERY query for all subclasses of query term --> SOLR query.

Subclauses:

  • We don't currently show dataset information in any results tables, so it may be overkill to use a standard dataset query.
  • New subcluster query needs standard return clause. Use core (min) for anatomy and cluster.

TODO: Write a new function in QueryLibraryCore that starts from the anatomical class:

dosumis added a commit that referenced this issue Nov 15, 2022
Fixes one of 2 queries in #112
Robbie1977 added a commit to VirtualFlyBrain/geppetto-vfb that referenced this issue Nov 28, 2022
Robbie1977 added a commit to VirtualFlyBrain/geppetto-vfb that referenced this issue Nov 29, 2022
@dosumis
Copy link
Member

dosumis commented Jul 13, 2024

@Robbie1977 @Clare72 Can this be closed? I believe the queries it described as live?

@Clare72 Clare72 closed this as completed Jul 15, 2024
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

No branches or pull requests

3 participants