Skip to content

Instantly share code, notes, and snippets.

@dosumis
Last active February 8, 2016 15:35
Show Gist options
  • Save dosumis/5a85f4ec9432fc972d91 to your computer and use it in GitHub Desktop.
Save dosumis/5a85f4ec9432fc972d91 to your computer and use it in GitHub Desktop.
Draft VFB neo4J expression schema
== Documentation of the VFB expression pattern schema ==
Aims:
* Represent expression curation in FlyBase in queryable graph form.
* Integrate expression curation from FlyBase with annoated images maintained in the VFB KB.
=== Schema
[source,cypher]
----
CREATE (ep:Class:Expression_pattern { label: "expression pattern of P{GMR10A06-GAL4}" }),
(ep)-[:SUBCLASSOF]->(:Class { label: 'expression pattern' }),
(ep)-[:expresses]->(:Class { label: 'P{GMR10A06-GAL4}' }),
(ep)<-[:INSTANCEOF]-(iep:Individual { label: 'GMR_10A06_AE_01_08-fA01b' }),
(ep)-[:overlaps { pubs: ['FBrf12343567']}]->(as1:Class { label: 'lateral horn - S1 to S3'}),
(as1)-[:SUBCLASSOF]->(:Class { label: 'lateral horn' }),
(as1)-[:exists_during]->(s1:Class { label: 'stage S1' }),
(as1)-[:exists_during]->(s2:Class { label: 'stage S2' }),
(as1)-[:exists_during]->(s3:Class { label: 'stage S3' }),
(sc:Individual:VFB { label: 'GMR_10A06_AE_01_08-fA01b image channel'} )-[:depicts]->(iep),
(i:Individual:VFB { short_form: 'VFBi_1234567' })-[:has_signal_channel]->(sc),
(i)-[:has_background_channel]->(bc:Individual { label: 'JFRC2010 image channel' }),
(bc)-[:depicts]->(ri:Individual { label: 'JFRC 2010' }),
(ri)-[:INSTANCEOF]->(ab:Class { label: 'adult brain'})
----
//graph
=== Use case Queries
1. Query for expression in specified anatomical structure, at specified stage. Return expressed transgenes and images.
Optionally limit images to specified template or template for a specified NS temporal/spatial region.
[source,cypher]
----
MATCH (fbbt:Class)<-[:SUBCLASSOF]-(fbex:Class)<-[o:overlaps]-(ep:Expression_pattern)-[:expresses]->(tg:Class),
(fbex)<-[:exists_during]->(stage:Class),
(ep)<-[:INSTANCEOF]-(ai:Individual)<-[:depicts]-(sc:Individual)
<-[:has_signal_channel]-(image:Individual)-[:has_background_channel]->(bc:Individual)
WHERE fbbt.label = 'lateral horn' AND stage.label = 'stage S1' AND bc.label = 'JFRC2010 image channel'
RETURN ai.label, tg.label, o.pubs, image.short_form
----
//table
Notes:
* Actual query will pull many more attributes
* Incomplete expansion of paths for stage querying. Need better examples of cases where we need this.
* Requires second queries or with clauses to pull pub miniref/micro-ref text for linking.
Benchmark:
Run full version of this query with appropriate indexes in place + LIMIT 25.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment