From 6b5ab13728aec8b1f7226dc3a585f15ee58d64d3 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Fri, 12 Jul 2024 14:53:38 +0100 Subject: [PATCH 01/14] Cell Type added to Get JSON for dataset scRNAseq query --- model/vfb.xmi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index b376b40a1..890856b5c 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -636,7 +636,7 @@ xsi:type="gep_2:SimpleQuery" name="Get JSON for dataset scRNAseq query" description="Get JSON for dataset scRNAseq query" - query=""statement": "MATCH (c:Individual)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, 'Get JSON for dataset scRNAseq query' AS query, 'ma3c0d68' AS version, pubs", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (c:Individual:Cluster)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id MATCH (a:Class:Anatomy)<-[:composed_primarily_of]-(c) WITH *, { short_form: a.short_form, label: coalesce(a.label,''), iri: a.iri, types: labels(a), unique_facets: apoc.coll.sort(coalesce(a.uniqueFacets, [])), symbol: coalesce(([]+a.symbol)[0], '')} AS anatomy OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c, anatomy RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, anatomy, 'Get JSON for dataset scRNAseq query' AS query, 'm20240712' AS version, pubs", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (c:Individual)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id RETURN count(c) as count", "parameters" : { "id" : "$ID" }"/> Date: Fri, 12 Jul 2024 13:53:56 +0000 Subject: [PATCH 02/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 228 ++++++++++++------------- model/query.md | 2 +- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index 86878119f..b8a6a88ff 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "7362a328", + "id": "2631db26", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c8ae0258", + "id": "13d84eda", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "70753d0b", + "id": "643c5036", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14c68f91", + "id": "a43d7bdf", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "727e9aa2", + "id": "fb4877d3", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e493b50", + "id": "6a5624de", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "b200fad3", + "id": "346f9cc7", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad0afcc1", + "id": "403bf72f", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "1ff5dff8", + "id": "a7be4032", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee339c9e", + "id": "5e8dbe66", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "730f4acd", + "id": "2f691e1f", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "936f6cf5", + "id": "6947a65f", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "ee161e67", + "id": "51595764", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f7829d59", + "id": "d0c088bf", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "86ff79cb", + "id": "946e56f3", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7b942ed", + "id": "684be4c6", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "b8d2864f", + "id": "f12d2f4c", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cb9e3d39", + "id": "4872b9ed", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "b7f1c2ec", + "id": "07c749d3", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99d1cf8c", + "id": "a9abf5e0", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "ebb1e79a", + "id": "e6cf2bd7", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce420e89", + "id": "3b374b61", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "ff70d3a8", + "id": "5726bdde", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ced136e8", + "id": "2db23ba8", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "115ef15a", + "id": "4f7ef20d", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55e8f7cc", + "id": "4f2afbdc", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "eed6585c", + "id": "c56c3d9a", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83102695", + "id": "ae217d3f", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "472cee67", + "id": "2adfaf6d", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b85cc01", + "id": "b7d68e48", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "917c2249", + "id": "a5d22ad3", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9f975457", + "id": "67daebb0", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "23a141d3", + "id": "8f625bf5", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fad13469", + "id": "c5809555", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "2b4a2d1d", + "id": "06accf48", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "548b80b1", + "id": "27388c53", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "938fd24a", + "id": "f778924c", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9a2dfdde", + "id": "f184e4f5", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "02cbf7db", + "id": "c347f5e4", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "884e1451", + "id": "eb3c60a3", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "4af45a38", + "id": "23823f16", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7e65f2a", + "id": "7ae161f8", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "30c281e9", + "id": "953a74a5", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10b634bf", + "id": "9c8e0bec", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "4e33fe80", + "id": "a3cbf6d4", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "04b64ced", + "id": "27269356", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "18a7a569", + "id": "f3d429cb", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ec37709", + "id": "39c4165d", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "9fc22648", + "id": "199c34a2", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5df8f7fd", + "id": "5baaa2aa", "metadata": {}, "outputs": [], "source": [ @@ -891,8 +891,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (c:Individual)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, 'Get JSON for dataset scRNAseq query' AS query, 'ma3c0d68' AS version, pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for dataset scRNAseq query', 'description': 'Get JSON for dataset scRNAseq query', 'query': '\"statement\": \"MATCH (c:Individual)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') }) AS pubs, c RETURN { core : { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, \\'Get JSON for dataset scRNAseq query\\' AS query, \\'ma3c0d68\\' AS version, pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (c:Individual:Cluster)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id MATCH (a:Class:Anatomy)<-[:composed_primarily_of]-(c) WITH *, { short_form: a.short_form, label: coalesce(a.label,''), iri: a.iri, types: labels(a), unique_facets: apoc.coll.sort(coalesce(a.uniqueFacets, [])), symbol: coalesce(([]+a.symbol)[0], '')} AS anatomy OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c, anatomy RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, anatomy, 'Get JSON for dataset scRNAseq query' AS query, 'm20240712' AS version, pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for dataset scRNAseq query', 'description': 'Get JSON for dataset scRNAseq query', 'query': '\"statement\": \"MATCH (c:Individual:Cluster)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id MATCH (a:Class:Anatomy)<-[:composed_primarily_of]-(c) WITH *, { short_form: a.short_form, label: coalesce(a.label,\\'\\'), iri: a.iri, types: labels(a), unique_facets: apoc.coll.sort(coalesce(a.uniqueFacets, [])), symbol: coalesce(([]+a.symbol)[0], \\'\\')} AS anatomy OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') }) AS pubs, c, anatomy RETURN { core : { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, anatomy, \\'Get JSON for dataset scRNAseq query\\' AS query, \\'m20240712\\' AS version, pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "9b8476d3", + "id": "e33edade", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f71dcff8", + "id": "faee1ebc", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "3e2be0dd", + "id": "fe9489a5", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25a6f973", + "id": "e28dff5d", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "2e2e3c69", + "id": "edd18c57", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1166fabc", + "id": "46f299c6", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "c131a259", + "id": "b9d23170", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a5f9e34", + "id": "dbc890ad", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "9d41f04f", + "id": "167686e7", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "618d6de6", + "id": "1bda8ea1", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "a0c22812", + "id": "de6c945f", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55a0cb81", + "id": "793a0046", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "0d449d3b", + "id": "d9335cd6", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3266310b", + "id": "ff750f1a", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "0dff97ce", + "id": "29180e03", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90e25398", + "id": "70b354cf", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "fd1c92ab", + "id": "49e2f326", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e750e824", + "id": "61f46908", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "9bd9db63", + "id": "d94c2dc5", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f0b7b7d8", + "id": "f33f9a3f", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "360c1a44", + "id": "b33543f3", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a9d4163", + "id": "0312ec01", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "4134900a", + "id": "e787de9b", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28b8fa00", + "id": "de7ead75", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "fc011142", + "id": "2a95d12d", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f2a910c9", + "id": "86ab1d09", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "2a87a91f", + "id": "fe57416d", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44679424", + "id": "933c1a4f", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "8f7cbd6a", + "id": "b35ac301", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1cda3c7", + "id": "951373e0", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "637bdf9d", + "id": "0085f4b5", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63c355fe", + "id": "acd4b640", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "d9aae04f", + "id": "e9590e4e", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e395237c", + "id": "e5a4f5f9", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "492d5993", + "id": "9cec7321", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b37505c6", + "id": "454046cd", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "80a4c711", + "id": "ae7714d0", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "174cfb6f", + "id": "5382b692", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "8579c3d6", + "id": "7f1edaa4", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0aa8654", + "id": "4a427143", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "f0bedb74", + "id": "cf9ab4bc", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db17c8d3", + "id": "01d171bd", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "faed0313", + "id": "81626b6e", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36bd197c", + "id": "f5b1d17d", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "d6eed1b2", + "id": "5f7aa8a8", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1dd64bac", + "id": "97e3cc5c", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "7285b49b", + "id": "0fbfbd0c", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34167ccd", + "id": "5bb5d679", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "c04ba414", + "id": "30d396b2", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc22fdc3", + "id": "24492e00", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "272a8739", + "id": "eb80516d", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be9a1d3b", + "id": "771823bc", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "1946f3a2", + "id": "fc27a2a0", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e2f244be", + "id": "5c9afc8c", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "1a0a0310", + "id": "df8bb076", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e1b62b88", + "id": "5072c7cc", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "0543075b", + "id": "a56c9278", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e7743c9", + "id": "64ce57cf", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "ab0bce79", + "id": "44fc222d", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "512bcb71", + "id": "4cfc9707", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "605ad660", + "id": "13138b24", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb6ab551", + "id": "6275edbc", "metadata": {}, "outputs": [], "source": [ diff --git a/model/query.md b/model/query.md index 019fbab1a..32b9049ce 100644 --- a/model/query.md +++ b/model/query.md @@ -565,7 +565,7 @@ Query: ``` Description: Get JSON for dataset scRNAseq query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (c:Individual)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, 'Get JSON for dataset scRNAseq query' AS query, 'ma3c0d68' AS version, pubs", "parameters" : { "id" : "$ID" } + "statement": "MATCH (c:Individual:Cluster)-[:has_source]->(ds:scRNAseq_DataSet) WHERE ds.short_form = $id MATCH (a:Class:Anatomy)<-[:composed_primarily_of]-(c) WITH *, { short_form: a.short_form, label: coalesce(a.label,''), iri: a.iri, types: labels(a), unique_facets: apoc.coll.sort(coalesce(a.uniqueFacets, [])), symbol: coalesce(([]+a.symbol)[0], '')} AS anatomy OPTIONAL MATCH (ds)-[:has_reference]->(p:pub) WITH COLLECT({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') }) AS pubs, c, anatomy RETURN { core : { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , description : coalesce(c.description, []), comment : coalesce(c.comment, []) } AS term, anatomy, 'Get JSON for dataset scRNAseq query' AS query, 'm20240712' AS version, pubs", "parameters" : { "id" : "$ID" } ``` ## Query Name: Process Images From a6e441cc1ac17e43cc775ec1dfe009e0199923fc Mon Sep 17 00:00:00 2001 From: Clare Pilgrim <38460997+Clare72@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:29:23 +0100 Subject: [PATCH 03/14] Update vfb.xmi update to 'Clusters' rather than 'data' in scRNAseq dataset description --- model/vfb.xmi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index 890856b5c..0d9b0dbe2 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -1329,8 +1329,8 @@ Date: Fri, 12 Jul 2024 14:29:40 +0000 Subject: [PATCH 04/14] Update README with XMI structure and query breakdowns --- model/README.md | 2 +- model/queries_execution_notebook.ipynb | 224 ++++++++++++------------- model/query.md | 4 +- 3 files changed, 115 insertions(+), 115 deletions(-) diff --git a/model/README.md b/model/README.md index 147ec39a1..d077672f8 100644 --- a/model/README.md +++ b/model/README.md @@ -124,7 +124,7 @@ ## clusterExpression: Genes expressed in $NAME - Step: cluster_expression_query (DataSource Index: 0, Query Index: 21) -## scRNAdatasetData: List all data for $NAME +## scRNAdatasetData: List all Clusters for $NAME - Step: dataset_scRNAseq_query (DataSource Index: 0, Query Index: 23) ## expressionCluster: scRNAseq clusters expressing $NAME diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index b8a6a88ff..3113f4368 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "2631db26", + "id": "4ad6ad2b", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13d84eda", + "id": "117ea1fd", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "643c5036", + "id": "8be88044", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a43d7bdf", + "id": "dc730208", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "fb4877d3", + "id": "54a618bd", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a5624de", + "id": "dd2e0eba", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "346f9cc7", + "id": "20175ae9", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "403bf72f", + "id": "cc6b5325", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "a7be4032", + "id": "d672381e", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e8dbe66", + "id": "16c5c2b5", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "2f691e1f", + "id": "8138d056", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6947a65f", + "id": "c318b07a", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "51595764", + "id": "b2d297e0", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d0c088bf", + "id": "0af7ec04", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "946e56f3", + "id": "0c86d832", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "684be4c6", + "id": "88d7253c", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "f12d2f4c", + "id": "5ca4643d", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4872b9ed", + "id": "28c13f0c", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "07c749d3", + "id": "116c15b5", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9abf5e0", + "id": "ebfae8f4", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "e6cf2bd7", + "id": "c659ae55", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3b374b61", + "id": "90179206", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "5726bdde", + "id": "91fc1054", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2db23ba8", + "id": "40649d2d", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "4f7ef20d", + "id": "ca83d8ea", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4f2afbdc", + "id": "d3138eaa", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "c56c3d9a", + "id": "06796b07", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ae217d3f", + "id": "cc38ddff", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "2adfaf6d", + "id": "13f12e40", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7d68e48", + "id": "41a6625d", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "a5d22ad3", + "id": "c4e2269a", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67daebb0", + "id": "a1e7ae7e", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "8f625bf5", + "id": "2cfebb2f", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c5809555", + "id": "ebd8c797", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "06accf48", + "id": "4436c22d", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27388c53", + "id": "8c91ab7a", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "f778924c", + "id": "6553e40d", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f184e4f5", + "id": "20e8c355", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "c347f5e4", + "id": "7935beb1", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eb3c60a3", + "id": "9db3ad39", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "23823f16", + "id": "f83239ac", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7ae161f8", + "id": "9325256c", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "953a74a5", + "id": "ea64644b", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c8e0bec", + "id": "01f4972d", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "a3cbf6d4", + "id": "ecbb1531", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27269356", + "id": "df23a4d1", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "f3d429cb", + "id": "07dfb9c9", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39c4165d", + "id": "1390ed3e", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "199c34a2", + "id": "68b32676", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5baaa2aa", + "id": "c9690b64", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "e33edade", + "id": "4693ab81", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "faee1ebc", + "id": "c488e442", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "fe9489a5", + "id": "b5e4246d", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e28dff5d", + "id": "01abc8a4", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "edd18c57", + "id": "46fa58ec", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "46f299c6", + "id": "e45cfb80", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "b9d23170", + "id": "180893eb", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbc890ad", + "id": "c9a7ebe4", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "167686e7", + "id": "71e7fdf8", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1bda8ea1", + "id": "01eca20b", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "de6c945f", + "id": "bc89647a", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "793a0046", + "id": "9fe03b13", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "d9335cd6", + "id": "fa3f4101", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff750f1a", + "id": "0cf86173", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "29180e03", + "id": "d4c80e53", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "70b354cf", + "id": "d7f980e4", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "49e2f326", + "id": "cd4b47a2", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "61f46908", + "id": "c554671a", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "d94c2dc5", + "id": "35d2b175", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f33f9a3f", + "id": "947f3c10", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "b33543f3", + "id": "93b47165", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0312ec01", + "id": "da2a72bf", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "e787de9b", + "id": "e3641534", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "de7ead75", + "id": "06ee407c", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "2a95d12d", + "id": "691a580c", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86ab1d09", + "id": "a506e8fd", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "fe57416d", + "id": "fbf3c426", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "933c1a4f", + "id": "7ac1ab6a", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "b35ac301", + "id": "1194e8aa", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "951373e0", + "id": "11f906f0", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "0085f4b5", + "id": "e79851e0", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "acd4b640", + "id": "e5d7a0b7", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "e9590e4e", + "id": "f5de8b75", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5a4f5f9", + "id": "c4fe8758", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "9cec7321", + "id": "901601bd", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "454046cd", + "id": "a104dd95", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "ae7714d0", + "id": "1bcf6abe", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5382b692", + "id": "fea3b03e", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "7f1edaa4", + "id": "90fc07bd", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a427143", + "id": "dffa9900", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "cf9ab4bc", + "id": "5cb5ef9b", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01d171bd", + "id": "26e8e330", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "81626b6e", + "id": "94058f72", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f5b1d17d", + "id": "b5e257b3", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "5f7aa8a8", + "id": "b406b74d", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97e3cc5c", + "id": "96eb194c", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "0fbfbd0c", + "id": "dcac6c81", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5bb5d679", + "id": "d0bf1487", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "30d396b2", + "id": "1509c8d4", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24492e00", + "id": "bee1fbe2", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "eb80516d", + "id": "ac6d2e89", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "771823bc", + "id": "d8dad338", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "fc27a2a0", + "id": "be741a04", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c9afc8c", + "id": "d333b700", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "df8bb076", + "id": "f956c98e", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5072c7cc", + "id": "47c6f1f1", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "a56c9278", + "id": "cacb50d9", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64ce57cf", + "id": "ec07e35d", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "44fc222d", + "id": "4e752dbd", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4cfc9707", + "id": "4a0533a9", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "13138b24", + "id": "8e519b39", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6275edbc", + "id": "fdb32790", "metadata": {}, "outputs": [], "source": [ diff --git a/model/query.md b/model/query.md index 32b9049ce..e6ca9e290 100644 --- a/model/query.md +++ b/model/query.md @@ -1088,9 +1088,9 @@ Query: ``` No query provided ``` -## Query Name: Show all data for a scRNAseq dataset +## Query Name: Show all Clusters for a scRNAseq dataset ID: scRNAdatasetData -Description: List all data for $NAME +Description: List all Clusters for $NAME Type: gep_2:CompoundRefQuery Query: ``` No query provided From 48f3dbb636b747085c554a40cb2e1c4837ff60fa Mon Sep 17 00:00:00 2001 From: Rob Court Date: Fri, 12 Jul 2024 17:32:08 +0100 Subject: [PATCH 05/14] Query updates from https://github.com/VirtualFlyBrain/VFB_json_schema/actions/runs/9910991408/job/27382655418 --- model/vfb.xmi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index 0d9b0dbe2..46551bd7d 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -689,7 +689,7 @@ name="Get JSON for Class" description="Get JSON for Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -699,7 +699,7 @@ name="Get JSON for Neuron Class" description="Get JSON for Neuron Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -709,7 +709,7 @@ name="Get JSON for Split Class" description="Get JSON for Split Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -719,7 +719,7 @@ name="Get JSON for Individual" description="Get JSON for Individual:Anatomy" runForCount="false" - query=""statement": "MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, xrefs 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,dataset_license,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, '89ca20c' AS version , dataset_license, parents, relationships, xrefs, channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'fe226a6' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Individual {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -739,7 +739,7 @@ name="Get JSON for Template" description="Get JSON for Template" runForCount="false" - query=""statement": "MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH { index: coalesce(apoc.convert.toInteger(irw.index), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: ([]+pd.irw.folder)[0], center: coalesce (pd.irw.center, []), index: [] + coalesce (pd.irw.index, []) }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, '89ca20c' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'fe226a6' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Template {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -749,7 +749,7 @@ name="Get JSON for pub" description="Fetches JSON for pub." runForCount="false" - query=""statement": "MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, '89ca20c' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'fe226a6' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:pub:Individual {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -759,7 +759,7 @@ name="Get JSON for DataSet" description="Get JSON for DataSet" runForCount="false" - query=""statement": "MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, '89ca20c' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'fe226a6' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:DataSet {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -769,7 +769,7 @@ name="Get JSON for License" description="Get JSON for License" runForCount="false" - query=""statement": "MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, '89ca20c' AS version ", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'fe226a6' AS version ", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:License {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> From 12e327bee3eeffe989535b5e3a8a0b16ccb85032 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 12 Jul 2024 16:32:25 +0000 Subject: [PATCH 06/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 256 ++++++++++++------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index 3113f4368..129802778 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4ad6ad2b", + "id": "6f1a6b7e", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "117ea1fd", + "id": "e0830ba3", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "8be88044", + "id": "72353799", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc730208", + "id": "4a3d7230", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "54a618bd", + "id": "b3f422ab", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd2e0eba", + "id": "e2e90c88", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "20175ae9", + "id": "fedf2cd7", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cc6b5325", + "id": "c1420625", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "d672381e", + "id": "79ed3e65", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16c5c2b5", + "id": "d5feefe9", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "8138d056", + "id": "4689dce9", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c318b07a", + "id": "01768b85", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "b2d297e0", + "id": "7010708c", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0af7ec04", + "id": "3418f179", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "0c86d832", + "id": "66b70fe3", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "88d7253c", + "id": "22d59adf", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "5ca4643d", + "id": "30e1dfb9", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28c13f0c", + "id": "6100374e", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "116c15b5", + "id": "4a1b0915", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebfae8f4", + "id": "3794e299", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "c659ae55", + "id": "8bff13eb", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90179206", + "id": "21e37840", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "91fc1054", + "id": "9ed723d3", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40649d2d", + "id": "7403ac50", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "ca83d8ea", + "id": "340e406d", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d3138eaa", + "id": "f66c6076", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "06796b07", + "id": "b8320890", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cc38ddff", + "id": "c9e087d3", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "13f12e40", + "id": "ee06a504", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41a6625d", + "id": "fc260850", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "c4e2269a", + "id": "338ddacc", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1e7ae7e", + "id": "aac1b1a1", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "2cfebb2f", + "id": "0e99833b", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebd8c797", + "id": "1a6314a4", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "4436c22d", + "id": "5cc23b3e", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c91ab7a", + "id": "7fd24734", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "6553e40d", + "id": "20487588", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20e8c355", + "id": "85cbab04", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "7935beb1", + "id": "9482809a", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9db3ad39", + "id": "00f26544", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "f83239ac", + "id": "751caa47", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9325256c", + "id": "700784ef", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "ea64644b", + "id": "58c439cd", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01f4972d", + "id": "26e7dc95", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "ecbb1531", + "id": "920cd923", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df23a4d1", + "id": "0ff8660d", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "07dfb9c9", + "id": "1b70bce3", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1390ed3e", + "id": "27bd6be4", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "68b32676", + "id": "89a4e721", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9690b64", + "id": "c95e857c", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "4693ab81", + "id": "a67c689f", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c488e442", + "id": "e8888914", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "b5e4246d", + "id": "32e0b63e", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01abc8a4", + "id": "3d26cb6c", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "46fa58ec", + "id": "e7ffe048", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e45cfb80", + "id": "30b3fda2", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "180893eb", + "id": "9b8a6fed", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9a7ebe4", + "id": "4d096d88", "metadata": {}, "outputs": [], "source": [ @@ -1039,8 +1039,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Class', 'description': 'Get JSON for Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn 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, \\'Get JSON for Class\\' AS query, \\'89ca20c\\' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Class', 'description': 'Get JSON for Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, \\'Get JSON for Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "71e7fdf8", + "id": "5e6eeb80", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01eca20b", + "id": "0452b46f", "metadata": {}, "outputs": [], "source": [ @@ -1076,8 +1076,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Neuron Class', 'description': 'Get JSON for Neuron Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], \\'\\')} ) END AS targeting_splits,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Neuron Class\\' AS query, \\'89ca20c\\' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Neuron Class', 'description': 'Get JSON for Neuron Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], \\'\\')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Neuron Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "bc89647a", + "id": "ee519e9a", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fe03b13", + "id": "66d60c3f", "metadata": {}, "outputs": [], "source": [ @@ -1113,8 +1113,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, '89ca20c' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Split Class', 'description': 'Get JSON for Split Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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 anatomy_channel_image ,primary,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,\\'\\'), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], \\'\\')} ) END AS target_neurons,primary,parents,relationships,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Split Class\\' AS query, \\'89ca20c\\' AS version , parents, relationships, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Split Class', 'description': 'Get JSON for Split Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,\\'\\'), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], \\'\\')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Split Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "fa3f4101", + "id": "0129da70", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0cf86173", + "id": "0bd691ca", "metadata": {}, "outputs": [], "source": [ @@ -1150,8 +1150,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, xrefs 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,dataset_license,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, '89ca20c' AS version , dataset_license, parents, relationships, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Individual', 'description': 'Get JSON for Individual:Anatomy', 'query': '\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, xrefs 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,dataset_license,parents,relationships,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,dataset_license,parents,relationships,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,dataset_license,parents,relationships,xrefs,channel_image,pub_syn 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, \\'Get JSON for Individual\\' AS query, \\'89ca20c\\' AS version , dataset_license, parents, relationships, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'fe226a6' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Individual', 'description': 'Get JSON for Individual:Anatomy', 'query': '\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, \\'Get JSON for Individual\\' AS query, \\'fe226a6\\' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "d4c80e53", + "id": "a856109e", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d7f980e4", + "id": "30375dc8", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "cd4b47a2", + "id": "ae133e26", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c554671a", + "id": "fe205f0f", "metadata": {}, "outputs": [], "source": [ @@ -1224,8 +1224,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH { index: coalesce(apoc.convert.toInteger(irw.index), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: ([]+pd.irw.folder)[0], center: coalesce (pd.irw.center, []), index: [] + coalesce (pd.irw.index, []) }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r {type:'Related'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, '89ca20c' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Template', 'description': 'Get JSON for Template', 'query': '\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH { index: coalesce(apoc.convert.toInteger(irw.index), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], \\'\\'), image_folder: coalesce(([]+irw.folder)[0],\\'\\'), 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], \\'\\')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN [\\'FBbi_00000224\\',\\'FBbi_00000251\\'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,\\'\\'), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], \\'\\')} , folder: ([]+pd.irw.folder)[0], center: coalesce (pd.irw.center, []), index: [] + coalesce (pd.irw.index, []) }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r {type:\\'Related\\'}]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r) } , object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, \\'Get JSON for Template\\' AS query, \\'89ca20c\\' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'fe226a6' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Template', 'description': 'Get JSON for Template', 'query': '\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], \\'\\'), image_folder: coalesce(([]+irw.folder)[0],\\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), 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], \\'\\')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN [\\'FBbi_00000224\\',\\'FBbi_00000251\\'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,\\'\\'), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], \\'\\')} , folder: COALESCE(([]+pd.irw.folder)[0], \\'\\'), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+pd.irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+pd.irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+pd.irw.wlz)[0], \\'\\'), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type=\\'Related\\') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, \\'Get JSON for Template\\' AS query, \\'fe226a6\\' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "35d2b175", + "id": "d23b5e5b", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "947f3c10", + "id": "8ec1eaeb", "metadata": {}, "outputs": [], "source": [ @@ -1261,8 +1261,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, '89ca20c' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for pub', 'description': 'Fetches JSON for pub.', 'query': '\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary 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, \\'Get JSON for pub\\' AS query, \\'89ca20c\\' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], \\'\\') ,PubMed: coalesce(([]+primary.PMID)[0], \\'\\'), FlyBase: coalesce(([]+primary.FlyBase)[0], \\'\\'), DOI: coalesce(([]+primary.DOI)[0], \\'\\') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'fe226a6' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for pub', 'description': 'Fetches JSON for pub.', 'query': '\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary 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, \\'Get JSON for pub\\' AS query, \\'fe226a6\\' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], \\'\\') ,PubMed: coalesce(([]+primary.PMID)[0], \\'\\'), FlyBase: coalesce(([]+primary.FlyBase)[0], \\'\\'), DOI: coalesce(([]+primary.DOI)[0], \\'\\') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "93b47165", + "id": "abb38481", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "da2a72bf", + "id": "085ff683", "metadata": {}, "outputs": [], "source": [ @@ -1298,8 +1298,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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 anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(([]+s.homepage)[0], ''), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(([]+s.link_icon_url)[0], ''), link_postfix: coalesce(([]+s.link_postfix)[0], '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, '89ca20c' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for DataSet', 'description': 'Get JSON for DataSet', 'query': '\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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 anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(([]+s.homepage)[0], \\'\\'), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(([]+s.link_icon_url)[0], \\'\\'), link_postfix: coalesce(([]+s.link_postfix)[0], \\'\\')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], \\'\\'), 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, \\'Get JSON for DataSet\\' AS query, \\'89ca20c\\' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'fe226a6' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for DataSet', 'description': 'Get JSON for DataSet', 'query': '\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], \\'\\'), 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, \\'Get JSON for DataSet\\' AS query, \\'fe226a6\\' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "e3641534", + "id": "84306904", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06ee407c", + "id": "970d11b2", "metadata": {}, "outputs": [], "source": [ @@ -1335,8 +1335,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, '89ca20c' AS version \", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for License', 'description': 'Get JSON for License', 'query': '\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], \\'\\'), link : coalesce(([]+primary.license_url)[0], \\'\\'), 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, \\'Get JSON for License\\' AS query, \\'89ca20c\\' AS version \", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'fe226a6' AS version \", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for License', 'description': 'Get JSON for License', 'query': '\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], \\'\\'), link : coalesce(([]+primary.license_url)[0], \\'\\'), 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, \\'Get JSON for License\\' AS query, \\'fe226a6\\' AS version \", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "691a580c", + "id": "dd707811", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a506e8fd", + "id": "07a319ec", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "fbf3c426", + "id": "4318211c", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7ac1ab6a", + "id": "b6c1b37a", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "1194e8aa", + "id": "6757c7cd", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11f906f0", + "id": "6188ac73", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "e79851e0", + "id": "fef57891", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5d7a0b7", + "id": "ff2df30e", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "f5de8b75", + "id": "b21f6e47", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c4fe8758", + "id": "07458624", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "901601bd", + "id": "8e6b6ad7", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a104dd95", + "id": "2865b677", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "1bcf6abe", + "id": "68cb9027", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fea3b03e", + "id": "855d55b7", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "90fc07bd", + "id": "f3fc2bd8", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dffa9900", + "id": "3cdbcf31", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "5cb5ef9b", + "id": "4446e157", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26e8e330", + "id": "4ffb59b6", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "94058f72", + "id": "61cbd98b", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b5e257b3", + "id": "2a17b61e", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "b406b74d", + "id": "e3d25ed1", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "96eb194c", + "id": "021a8072", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "dcac6c81", + "id": "18ec3471", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d0bf1487", + "id": "ce109d71", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "1509c8d4", + "id": "94aea2d2", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bee1fbe2", + "id": "62c0809d", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "ac6d2e89", + "id": "c4db9f53", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8dad338", + "id": "27d8b953", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "be741a04", + "id": "83eb3b92", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d333b700", + "id": "fc6a310b", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "f956c98e", + "id": "f557c2c2", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47c6f1f1", + "id": "6ecf58c5", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "cacb50d9", + "id": "e7feea91", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec07e35d", + "id": "c6c8b7d0", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "4e752dbd", + "id": "0b1e89eb", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a0533a9", + "id": "4e5cf7cb", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "8e519b39", + "id": "a82cda67", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fdb32790", + "id": "5acf9816", "metadata": {}, "outputs": [], "source": [ From d555db910596dc54ca5fadf8b1678ba8706247ec Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 12 Jul 2024 17:57:40 +0000 Subject: [PATCH 07/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 224 ++++++++++++------------- 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index 129802778..410c09655 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "6f1a6b7e", + "id": "643d2fa8", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0830ba3", + "id": "7b4481d0", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "72353799", + "id": "5d4ddbad", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a3d7230", + "id": "52be3986", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "b3f422ab", + "id": "6317bf39", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e2e90c88", + "id": "037d46bf", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "fedf2cd7", + "id": "af22f1b9", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1420625", + "id": "c504605b", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "79ed3e65", + "id": "ca3a6271", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5feefe9", + "id": "c20c70b2", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "4689dce9", + "id": "58b7681e", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01768b85", + "id": "bb413189", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "7010708c", + "id": "616f9b15", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3418f179", + "id": "006bc33a", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "66b70fe3", + "id": "2f5c59f5", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22d59adf", + "id": "b3052d5e", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "30e1dfb9", + "id": "70edb5a5", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6100374e", + "id": "29600e8c", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "4a1b0915", + "id": "2c97d4bc", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3794e299", + "id": "e30fb0be", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "8bff13eb", + "id": "e0bb90f3", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21e37840", + "id": "e189f036", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "9ed723d3", + "id": "ac49ed4b", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7403ac50", + "id": "7d4129a3", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "340e406d", + "id": "009aff39", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f66c6076", + "id": "b996c009", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "b8320890", + "id": "f60c2c72", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9e087d3", + "id": "7a4a5bc4", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "ee06a504", + "id": "31a8a116", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc260850", + "id": "ffc22482", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "338ddacc", + "id": "b45944bb", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aac1b1a1", + "id": "7b0ae4b4", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "0e99833b", + "id": "621acca8", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1a6314a4", + "id": "c565c353", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "5cc23b3e", + "id": "d71ea8a9", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fd24734", + "id": "969afc0c", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "20487588", + "id": "df8fc52e", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85cbab04", + "id": "b38ff982", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "9482809a", + "id": "e47b34eb", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "00f26544", + "id": "638d5cde", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "751caa47", + "id": "33990bac", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "700784ef", + "id": "2687d522", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "58c439cd", + "id": "28aa05be", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26e7dc95", + "id": "a3f828ee", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "920cd923", + "id": "33685a24", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ff8660d", + "id": "1af92cea", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "1b70bce3", + "id": "398dd5cf", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27bd6be4", + "id": "5aba6b36", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "89a4e721", + "id": "ef610210", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c95e857c", + "id": "87b37bc1", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "a67c689f", + "id": "001b99da", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8888914", + "id": "4b17d3f5", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "32e0b63e", + "id": "3b6bbb1a", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d26cb6c", + "id": "a961a44c", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "e7ffe048", + "id": "05d661b1", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30b3fda2", + "id": "ac13bab6", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "9b8a6fed", + "id": "5a07c5a7", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d096d88", + "id": "cc438d8c", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "5e6eeb80", + "id": "649209c5", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0452b46f", + "id": "d3d49991", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "ee519e9a", + "id": "11c58c88", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66d60c3f", + "id": "da945960", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "0129da70", + "id": "7630bc1d", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bd691ca", + "id": "92a86d41", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "a856109e", + "id": "599aa7a5", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30375dc8", + "id": "525fd42d", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "ae133e26", + "id": "fa06918b", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fe205f0f", + "id": "761c3aef", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "d23b5e5b", + "id": "48c0d26c", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ec1eaeb", + "id": "a4e02eaa", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "abb38481", + "id": "cd4d2679", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "085ff683", + "id": "171f17bb", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "84306904", + "id": "6ed29d26", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "970d11b2", + "id": "022e8af8", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "dd707811", + "id": "406e2546", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07a319ec", + "id": "2268d12e", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "4318211c", + "id": "427dd394", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b6c1b37a", + "id": "f0931848", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "6757c7cd", + "id": "9b86874a", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6188ac73", + "id": "dbc86d4a", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "fef57891", + "id": "28e5b31f", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff2df30e", + "id": "b18b2762", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "b21f6e47", + "id": "431ed4a8", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07458624", + "id": "d7304205", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "8e6b6ad7", + "id": "ab4666de", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2865b677", + "id": "7964b9b5", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "68cb9027", + "id": "ae525033", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "855d55b7", + "id": "38a211bf", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "f3fc2bd8", + "id": "9a9ca82f", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3cdbcf31", + "id": "26b914d8", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "4446e157", + "id": "59e3869c", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ffb59b6", + "id": "994d05a2", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "61cbd98b", + "id": "cdab20f4", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2a17b61e", + "id": "54729eab", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "e3d25ed1", + "id": "61ced6da", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "021a8072", + "id": "b5c47277", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "18ec3471", + "id": "6b113ac5", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce109d71", + "id": "a11528ba", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "94aea2d2", + "id": "a783efbb", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "62c0809d", + "id": "9788482c", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "c4db9f53", + "id": "90a92bf0", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27d8b953", + "id": "2b6acd0b", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "83eb3b92", + "id": "0b9b7ada", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc6a310b", + "id": "7583068e", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "f557c2c2", + "id": "ae28c917", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ecf58c5", + "id": "c6c015f8", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "e7feea91", + "id": "41c4452b", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6c8b7d0", + "id": "4fa2a7f0", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "0b1e89eb", + "id": "6983ede2", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e5cf7cb", + "id": "85159e26", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "a82cda67", + "id": "cd91f681", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5acf9816", + "id": "fbc75292", "metadata": {}, "outputs": [], "source": [ From 78603cace9e0ed83ac197190a22960aed4390813 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Sun, 14 Jul 2024 13:26:11 +0100 Subject: [PATCH 08/14] Fixed pubs from latest version:fe226a6 --- model/vfb.xmi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index 46551bd7d..f41296faa 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -348,7 +348,7 @@ name="Test Query for Exp from Anatomy" description="Get JSON for anat_2_ep query" returnType="//@libraries.3/@types.1" - query=""statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS}" + query=""statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS}" countQuery=""statement": "MATCH (anat:Class) WHERE anat.short_form IN $ids OPTIONAL MATCH (ep:Class)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat) RETURN count(ep) as count", "parameters" : { "ids" : $ARRAY_ID_RESULTS}"/> Date: Sun, 14 Jul 2024 12:26:29 +0000 Subject: [PATCH 09/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 236 ++++++++++++------------- model/query.md | 6 +- 2 files changed, 121 insertions(+), 121 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index 129802778..8c5933c1c 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "6f1a6b7e", + "id": "c5a279d0", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0830ba3", + "id": "1be0e707", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "72353799", + "id": "87775a4e", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a3d7230", + "id": "c49a1e1d", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "b3f422ab", + "id": "4dd93b03", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e2e90c88", + "id": "5e3984de", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "fedf2cd7", + "id": "9de4ffbc", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1420625", + "id": "8a25e36e", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "79ed3e65", + "id": "17bf597a", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5feefe9", + "id": "f13b535b", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "4689dce9", + "id": "0c64b615", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01768b85", + "id": "a58aaf11", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "7010708c", + "id": "5407537f", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3418f179", + "id": "51c5ac79", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "66b70fe3", + "id": "46ec94a4", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22d59adf", + "id": "89e789bc", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "30e1dfb9", + "id": "2b985041", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6100374e", + "id": "495f8dea", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "4a1b0915", + "id": "c858cb46", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3794e299", + "id": "a108f3e8", "metadata": {}, "outputs": [], "source": [ @@ -336,8 +336,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Test Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'de64597\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Test Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "8bff13eb", + "id": "505d902b", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21e37840", + "id": "2c1c7243", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "9ed723d3", + "id": "375e35dd", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7403ac50", + "id": "b528b4c0", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "340e406d", + "id": "0892e9b3", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f66c6076", + "id": "47473003", "metadata": {}, "outputs": [], "source": [ @@ -447,8 +447,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'de64597\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "b8320890", + "id": "db1681b0", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9e087d3", + "id": "a998a619", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "ee06a504", + "id": "4d68acb7", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc260850", + "id": "f05608e3", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "338ddacc", + "id": "a5a552af", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aac1b1a1", + "id": "1b865721", "metadata": {}, "outputs": [], "source": [ @@ -558,8 +558,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'de64597\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "0e99833b", + "id": "86432811", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1a6314a4", + "id": "df773827", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "5cc23b3e", + "id": "acfe35bf", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fd24734", + "id": "bdeb5ac8", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "20487588", + "id": "04598224", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85cbab04", + "id": "f8c96668", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "9482809a", + "id": "ed6d6ea0", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "00f26544", + "id": "abc56899", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "751caa47", + "id": "ac504e20", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "700784ef", + "id": "34dec0c1", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "58c439cd", + "id": "a749d514", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26e7dc95", + "id": "ce775d10", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "920cd923", + "id": "2e998489", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ff8660d", + "id": "f03f7a9e", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "1b70bce3", + "id": "4ade13d1", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27bd6be4", + "id": "6d05045d", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "89a4e721", + "id": "8e81b198", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c95e857c", + "id": "ea9cda21", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "a67c689f", + "id": "e0cae77a", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8888914", + "id": "f1504f52", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "32e0b63e", + "id": "69757fd9", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d26cb6c", + "id": "13f71791", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "e7ffe048", + "id": "59dfc02d", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30b3fda2", + "id": "7c87ad1c", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "9b8a6fed", + "id": "26b028f1", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d096d88", + "id": "415e1ab1", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "5e6eeb80", + "id": "e37df224", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0452b46f", + "id": "02809450", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "ee519e9a", + "id": "089d1bd8", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66d60c3f", + "id": "87eea20e", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "0129da70", + "id": "df6a7c36", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bd691ca", + "id": "20df8b1c", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "a856109e", + "id": "b311ef61", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30375dc8", + "id": "8949a474", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "ae133e26", + "id": "5d0f9b29", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fe205f0f", + "id": "3c87a066", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "d23b5e5b", + "id": "c7fc2cef", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ec1eaeb", + "id": "7c34e61f", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "abb38481", + "id": "0fe320f0", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "085ff683", + "id": "b7b08e8a", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "84306904", + "id": "b18fb314", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "970d11b2", + "id": "6bccb753", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "dd707811", + "id": "a320111a", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07a319ec", + "id": "90b1e9ea", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "4318211c", + "id": "6f29b65f", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b6c1b37a", + "id": "b8866163", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "6757c7cd", + "id": "17494604", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6188ac73", + "id": "7fd2cb08", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "fef57891", + "id": "87312c81", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff2df30e", + "id": "a1ffe85e", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "b21f6e47", + "id": "7198c03f", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07458624", + "id": "daec03f7", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "8e6b6ad7", + "id": "59b996c9", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2865b677", + "id": "c0acc0a5", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "68cb9027", + "id": "36442bdd", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "855d55b7", + "id": "c78019a4", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "f3fc2bd8", + "id": "cce2dcea", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3cdbcf31", + "id": "49b122a1", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "4446e157", + "id": "c26fee52", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ffb59b6", + "id": "54fab673", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "61cbd98b", + "id": "59a86c71", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2a17b61e", + "id": "a6e49f78", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "e3d25ed1", + "id": "82d5c2fc", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "021a8072", + "id": "e386c52a", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "18ec3471", + "id": "f59879fd", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce109d71", + "id": "cfc4915d", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "94aea2d2", + "id": "79fc707e", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "62c0809d", + "id": "fde5457d", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "c4db9f53", + "id": "957b03a2", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27d8b953", + "id": "a314f66a", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "83eb3b92", + "id": "22f31f45", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc6a310b", + "id": "ec432f82", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "f557c2c2", + "id": "23287d79", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ecf58c5", + "id": "8f8e2576", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "e7feea91", + "id": "1036c46f", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6c8b7d0", + "id": "e541cbc5", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "0b1e89eb", + "id": "7157987b", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e5cf7cb", + "id": "9fcede88", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "a82cda67", + "id": "edccd78a", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5acf9816", + "id": "49d27df3", "metadata": {}, "outputs": [], "source": [ diff --git a/model/query.md b/model/query.md index e6ca9e290..eef7c59a3 100644 --- a/model/query.md +++ b/model/query.md @@ -205,7 +205,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor @@ -277,7 +277,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor @@ -349,7 +349,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: []+p[0]}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'de64597' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor From 6d671c9124c58e93e4a1f058093032f26c18a637 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 14 Jul 2024 12:31:36 +0000 Subject: [PATCH 10/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 226 ++++++++++++------------- 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index f56e880ea..3ade43e97 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c5a279d0", + "id": "b036b2d9", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1be0e707", + "id": "c6e80a65", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "87775a4e", + "id": "01362bf5", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c49a1e1d", + "id": "0e75e854", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "4dd93b03", + "id": "c8c3c3b2", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e3984de", + "id": "334656ed", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "9de4ffbc", + "id": "33c6b1d6", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a25e36e", + "id": "465049bb", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "17bf597a", + "id": "c8a084a9", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f13b535b", + "id": "3204510c", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "0c64b615", + "id": "a03777be", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a58aaf11", + "id": "e3c23a9f", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "5407537f", + "id": "6ef1b59a", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51c5ac79", + "id": "45964d51", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "46ec94a4", + "id": "e13a5ca6", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89e789bc", + "id": "fd6a9232", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "2b985041", + "id": "670418c2", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "495f8dea", + "id": "88d573fe", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "c858cb46", + "id": "67fd0656", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a108f3e8", + "id": "d36d7261", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "505d902b", + "id": "7b68127d", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c1c7243", + "id": "8cda6cc8", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "375e35dd", + "id": "1523c8d6", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b528b4c0", + "id": "9ed6f7e4", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "0892e9b3", + "id": "2bed4636", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47473003", + "id": "2d6200eb", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "db1681b0", + "id": "48a9c0c2", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a998a619", + "id": "04628525", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "4d68acb7", + "id": "e45e5f95", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f05608e3", + "id": "a86c7772", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "a5a552af", + "id": "80c32a08", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b865721", + "id": "0d8754db", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "86432811", + "id": "705c167e", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df773827", + "id": "e5c19ad1", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "acfe35bf", + "id": "401e4e24", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bdeb5ac8", + "id": "b43edb23", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "04598224", + "id": "bc3fa389", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8c96668", + "id": "e231f1ce", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "ed6d6ea0", + "id": "bd1a2c83", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abc56899", + "id": "368227ff", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "ac504e20", + "id": "2a153804", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34dec0c1", + "id": "42718220", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "a749d514", + "id": "a591f8ca", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce775d10", + "id": "24559992", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "2e998489", + "id": "7638c6e7", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f03f7a9e", + "id": "4e98759f", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "4ade13d1", + "id": "ad6eab51", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6d05045d", + "id": "35035ea7", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "8e81b198", + "id": "d5930598", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea9cda21", + "id": "88eb4e0f", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "e0cae77a", + "id": "d4afc6ee", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1504f52", + "id": "addf5e3d", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "69757fd9", + "id": "1ffab6d3", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13f71791", + "id": "8ae10a71", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "59dfc02d", + "id": "059d9b94", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c87ad1c", + "id": "e45185b1", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "26b028f1", + "id": "a155b82c", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "415e1ab1", + "id": "bacecac9", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "e37df224", + "id": "791fc797", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02809450", + "id": "ce4b1e48", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "089d1bd8", + "id": "9d86dd79", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "87eea20e", + "id": "65c2ef23", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "df6a7c36", + "id": "85ddf9d4", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20df8b1c", + "id": "d53ae86c", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "b311ef61", + "id": "7a27e6c0", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8949a474", + "id": "f5906f7d", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "5d0f9b29", + "id": "aaf8aa14", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c87a066", + "id": "457f1d2e", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "c7fc2cef", + "id": "3f2ef6e3", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c34e61f", + "id": "6255cf4c", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "0fe320f0", + "id": "ebb8d1cf", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7b08e8a", + "id": "33892571", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "b18fb314", + "id": "165a7270", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bccb753", + "id": "34109a73", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "a320111a", + "id": "769148bd", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90b1e9ea", + "id": "e331bdb9", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "6f29b65f", + "id": "be456b52", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8866163", + "id": "7d8eb910", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "17494604", + "id": "2dbb8d14", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fd2cb08", + "id": "92a9e26a", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "87312c81", + "id": "d669ada8", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1ffe85e", + "id": "bbadecbf", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "7198c03f", + "id": "a7140066", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "daec03f7", + "id": "86563db7", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "59b996c9", + "id": "da23fd55", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0acc0a5", + "id": "74e5a646", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "36442bdd", + "id": "f22a5f70", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c78019a4", + "id": "b0915cd7", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "cce2dcea", + "id": "f4f62d18", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49b122a1", + "id": "55fcd9e8", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "c26fee52", + "id": "c43c86f3", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54fab673", + "id": "690c84be", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "59a86c71", + "id": "e0e98b92", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6e49f78", + "id": "f963385c", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "82d5c2fc", + "id": "9267196a", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e386c52a", + "id": "be4ccf8f", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "f59879fd", + "id": "89585e46", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cfc4915d", + "id": "5f5903bd", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "79fc707e", + "id": "df1d6e0a", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fde5457d", + "id": "41dd79ca", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "957b03a2", + "id": "2f785fc6", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a314f66a", + "id": "7c34ab58", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "22f31f45", + "id": "ac76a3f5", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec432f82", + "id": "dd18ad94", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "23287d79", + "id": "bb1eb9b2", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8f8e2576", + "id": "9a70b24a", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "1036c46f", + "id": "037c5bd1", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e541cbc5", + "id": "e9ac5fcd", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "7157987b", + "id": "b4cc2613", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fcede88", + "id": "4978666c", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "edccd78a", + "id": "1319bdc4", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49d27df3", + "id": "7ebcd1d6", "metadata": {}, "outputs": [], "source": [ @@ -1981,4 +1981,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} From e232b55d299d5d8ff53c0f3526aa202a3acd03a6 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Sun, 14 Jul 2024 13:44:13 +0100 Subject: [PATCH 11/14] latest queries from https://github.com/VirtualFlyBrain/VFB_json_schema/actions/runs/9928006125/job/27423700365 Resolves VirtualFlyBrain/VFB2#374 --- model/vfb.xmi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index f41296faa..8c0d1608a 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -689,7 +689,7 @@ name="Get JSON for Class" description="Get JSON for Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -699,7 +699,7 @@ name="Get JSON for Neuron Class" description="Get JSON for Neuron Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -709,7 +709,7 @@ name="Get JSON for Split Class" description="Get JSON for Split Class" runForCount="false" - query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Class {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -719,7 +719,7 @@ name="Get JSON for Individual" description="Get JSON for Individual:Anatomy" runForCount="false" - query=""statement": "MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'fe226a6' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'c58c844' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Individual {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -739,7 +739,7 @@ name="Get JSON for Template" description="Get JSON for Template" runForCount="false" - query=""statement": "MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'fe226a6' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'c58c844' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:Template {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -749,7 +749,7 @@ name="Get JSON for pub" description="Fetches JSON for pub." runForCount="false" - query=""statement": "MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'fe226a6' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'c58c844' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:pub:Individual {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -759,7 +759,7 @@ name="Get JSON for DataSet" description="Get JSON for DataSet" runForCount="false" - query=""statement": "MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'fe226a6' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'c58c844' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:DataSet {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> @@ -769,7 +769,7 @@ name="Get JSON for License" description="Get JSON for License" runForCount="false" - query=""statement": "MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'fe226a6' AS version ", "parameters" : { "id" : "$ID" }" + query=""statement": "MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'c58c844' AS version ", "parameters" : { "id" : "$ID" }" countQuery=""statement": "MATCH (primary:License {short_form: $id} ) RETURN count(primary) as count", "parameters" : { "id" : "$ID" }"> From 7a76e5a9d8901a688f6c9afabaa5748ac8f011ff Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 14 Jul 2024 12:44:34 +0000 Subject: [PATCH 12/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 258 ++++++++++++------------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index f56e880ea..3b3216fec 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c5a279d0", + "id": "f7f78576", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1be0e707", + "id": "2c58181e", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "87775a4e", + "id": "3c8007bc", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c49a1e1d", + "id": "f52e06ca", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "4dd93b03", + "id": "1750a09d", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e3984de", + "id": "ad412cdb", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "9de4ffbc", + "id": "e6d6480d", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a25e36e", + "id": "3e1923e7", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "17bf597a", + "id": "adc25449", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f13b535b", + "id": "86b332a7", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "0c64b615", + "id": "ec9c7f61", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a58aaf11", + "id": "37925a0e", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "5407537f", + "id": "1c0283dc", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51c5ac79", + "id": "5e82f0d4", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "46ec94a4", + "id": "244cac72", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89e789bc", + "id": "71f9835d", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "2b985041", + "id": "5dcda79a", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "495f8dea", + "id": "03f8f8a0", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "c858cb46", + "id": "a252e4df", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a108f3e8", + "id": "e72ffd74", "metadata": {}, "outputs": [], "source": [ @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "505d902b", + "id": "ed299d7a", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c1c7243", + "id": "13353814", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "375e35dd", + "id": "be87241b", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b528b4c0", + "id": "45f52d84", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "0892e9b3", + "id": "1da02d4c", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47473003", + "id": "3e954a48", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "db1681b0", + "id": "aca38a2e", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a998a619", + "id": "ea7fb60d", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "4d68acb7", + "id": "f1e4af82", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f05608e3", + "id": "7f744c5c", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "a5a552af", + "id": "c4b2c920", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b865721", + "id": "761bc504", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "86432811", + "id": "478570cd", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df773827", + "id": "db0abdca", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "acfe35bf", + "id": "4712df29", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bdeb5ac8", + "id": "4394f461", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "04598224", + "id": "2dac5f58", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8c96668", + "id": "434a3c8f", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "ed6d6ea0", + "id": "fa49e29a", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abc56899", + "id": "38c0983a", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "ac504e20", + "id": "b5fcb622", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34dec0c1", + "id": "2312f9e9", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "a749d514", + "id": "961a5902", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce775d10", + "id": "6e494caf", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "2e998489", + "id": "b4f827b7", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f03f7a9e", + "id": "968b054b", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "4ade13d1", + "id": "7199e078", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6d05045d", + "id": "aab179f8", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "8e81b198", + "id": "90022a86", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea9cda21", + "id": "dce73477", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "e0cae77a", + "id": "6dfd33b6", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1504f52", + "id": "0649937f", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "69757fd9", + "id": "6ca2dd82", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13f71791", + "id": "b2d19338", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "59dfc02d", + "id": "975e3e4d", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c87ad1c", + "id": "e315bee8", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "26b028f1", + "id": "d0b10699", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "415e1ab1", + "id": "a0987e94", "metadata": {}, "outputs": [], "source": [ @@ -1039,8 +1039,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Class', 'description': 'Get JSON for Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, \\'Get JSON for Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, 'Get JSON for Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Class', 'description': 'Get JSON for Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn 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, \\'Get JSON for Class\\' AS query, \\'c58c844\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "e37df224", + "id": "ef5681fa", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02809450", + "id": "5d0748b2", "metadata": {}, "outputs": [], "source": [ @@ -1076,8 +1076,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Neuron Class', 'description': 'Get JSON for Neuron Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], \\'\\')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Neuron Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], '')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Neuron Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Neuron Class', 'description': 'Get JSON for Neuron Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(ep:Class)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(primary) WITH CASE WHEN ep IS NULL THEN [] ELSE COLLECT({ short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), unique_facets: apoc.coll.sort(coalesce(ep.uniqueFacets, [])), symbol: coalesce(([]+ep.symbol)[0], \\'\\')} ) END AS targeting_splits,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Neuron Class\\' AS query, \\'c58c844\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, targeting_splits\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "089d1bd8", + "id": "d342e9a3", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "87eea20e", + "id": "910b48a9", "metadata": {}, "outputs": [], "source": [ @@ -1113,8 +1113,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'fe226a6' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Split Class', 'description': 'Get JSON for Split Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,\\'\\'), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], \\'\\')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Split Class\\' AS query, \\'fe226a6\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: 'intersectional expression pattern'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,''), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], '')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, 'Get JSON for Split Class' AS query, 'c58c844' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Split Class', 'description': 'Get JSON for Split Class', 'query': '\"statement\": \"MATCH (primary:Class) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,parents,relationships,related_individuals CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary, parents, relationships, related_individuals, xrefs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn OPTIONAL MATCH (:Class { label: \\'intersectional expression pattern\\'})<-[:SUBCLASSOF]-(primary)<-[ar:part_of]-(anoni:Individual)-[:INSTANCEOF]->(n:Neuron) WITH CASE WHEN n IS NULL THEN [] ELSE COLLECT({ short_form: n.short_form, label: coalesce(n.label,\\'\\'), iri: n.iri, types: labels(n), unique_facets: apoc.coll.sort(coalesce(n.uniqueFacets, [])), symbol: coalesce(([]+n.symbol)[0], \\'\\')} ) END AS target_neurons,primary,parents,relationships,related_individuals,xrefs,anatomy_channel_image,pub_syn,def_pubs 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, \\'Get JSON for Split Class\\' AS query, \\'c58c844\\' AS version , parents, relationships, related_individuals, xrefs, anatomy_channel_image, pub_syn, def_pubs, target_neurons\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "df6a7c36", + "id": "159167c2", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20df8b1c", + "id": "f02c542a", "metadata": {}, "outputs": [], "source": [ @@ -1150,8 +1150,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'fe226a6' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Individual', 'description': 'Get JSON for Individual:Anatomy', 'query': '\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, \\'Get JSON for Individual\\' AS query, \\'fe226a6\\' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = 'syn' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } , synonym: { label: coalesce(([]+rp.value)[0], ''), scope: coalesce(rp.scope, ''), type: coalesce(([]+rp.has_synonym_type)[0],'') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = 'def' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, 'Get JSON for Individual' AS query, 'c58c844' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Individual', 'description': 'Get JSON for Individual:Anatomy', 'query': '\"statement\": \"MATCH (primary:Individual) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,dataset_license,parents OPTIONAL MATCH (o)<-[r:term_replaced_by]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,dataset_license,parents,relationships OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, dataset_license, parents, relationships, related_individuals OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,dataset_license,parents,relationships,related_individuals OPTIONAL MATCH (primary)<-[:depicts]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(template_anat:Individual) WITH template, channel, template_anat, irw, primary, dataset_license, parents, relationships, related_individuals, xrefs 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }}) END AS channel_image,primary,dataset_license,parents,relationships,related_individuals,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) where rp.typ = \\'syn\\' WITH CASE WHEN p is null THEN [] ELSE collect({ pub: { core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } , synonym: { label: coalesce(([]+rp.value)[0], \\'\\'), scope: coalesce(rp.scope, \\'\\'), type: coalesce(([]+rp.has_synonym_type)[0],\\'\\') } }) END AS pub_syn,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WHERE rp.typ = \\'def\\' WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS def_pubs,primary,dataset_license,parents,relationships,related_individuals,xrefs,channel_image,pub_syn 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, \\'Get JSON for Individual\\' AS query, \\'c58c844\\' AS version , dataset_license, parents, relationships, related_individuals, xrefs, channel_image, pub_syn, def_pubs\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "b311ef61", + "id": "417bd6fc", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8949a474", + "id": "e6a4e70d", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "5d0f9b29", + "id": "f0fd9be6", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c87a066", + "id": "c72166af", "metadata": {}, "outputs": [], "source": [ @@ -1224,8 +1224,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'fe226a6' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for Template', 'description': 'Get JSON for Template', 'query': '\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], \\'\\'), image_folder: coalesce(([]+irw.folder)[0],\\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), 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], \\'\\')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN [\\'FBbi_00000224\\',\\'FBbi_00000251\\'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,\\'\\'), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], \\'\\')} , folder: COALESCE(([]+pd.irw.folder)[0], \\'\\'), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+pd.irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+pd.irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+pd.irw.wlz)[0], \\'\\'), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type=\\'Related\\') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, \\'Get JSON for Template\\' AS query, \\'fe226a6\\' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], ''), image_folder: coalesce(([]+irw.folder)[0],''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), 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], '')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN ['FBbi_00000224','FBbi_00000251'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,''), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], '')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,''), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], '')} , folder: COALESCE(([]+pd.irw.folder)[0], ''), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], ''), image_swc: COALESCE(([]+pd.irw.swc)[0], ''), image_obj: COALESCE(([]+pd.irw.obj)[0], ''), image_wlz: COALESCE(([]+pd.irw.wlz)[0], ''), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type='Related') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type='Related') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), '') }, object: { short_form: o.short_form, label: coalesce(o.label,''), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], '')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, 'Get JSON for Template' AS query, 'c58c844' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for Template', 'description': 'Get JSON for Template', 'query': '\"statement\": \"MATCH (primary:Template) WHERE primary.short_form in [$id] WITH primary MATCH (channel:Individual)<-[irw:in_register_with]-(channel:Individual)-[:depicts]->(primary) WITH {index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [], extent: ([]+irw.extent)[0], center: ([]+irw.center)[0], voxel: ([]+irw.voxel)[0], orientation: coalesce(([]+irw.orientation)[0], \\'\\'), image_folder: coalesce(([]+irw.folder)[0],\\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), 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], \\'\\')} } as template_channel,primary OPTIONAL MATCH (technique:Class)<-[:is_specified_output_of]-(channel:Individual)-[irw:in_register_with]->(template:Individual)-[:depicts]->(primary) WHERE technique.short_form IN [\\'FBbi_00000224\\',\\'FBbi_00000251\\'] AND exists(irw.index) WITH primary, template_channel, collect ({ channel: channel, irw: irw}) AS painted_domains UNWIND painted_domains AS pd OPTIONAL MATCH (channel:Individual { short_form: pd.channel.short_form})-[:depicts]-(ai:Individual)-[:INSTANCEOF]->(c:Class) WITH collect({ anatomical_type: { short_form: c.short_form, label: coalesce(c.label,\\'\\'), iri: c.iri, types: labels(c), unique_facets: apoc.coll.sort(coalesce(c.uniqueFacets, [])), symbol: coalesce(([]+c.symbol)[0], \\'\\')} , anatomical_individual: { short_form: ai.short_form, label: coalesce(ai.label,\\'\\'), iri: ai.iri, types: labels(ai), unique_facets: apoc.coll.sort(coalesce(ai.uniqueFacets, [])), symbol: coalesce(([]+ai.symbol)[0], \\'\\')} , folder: COALESCE(([]+pd.irw.folder)[0], \\'\\'), image_nrrd: COALESCE(([]+pd.irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+pd.irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+pd.irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+pd.irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+pd.irw.wlz)[0], \\'\\'), center: coalesce (pd.irw.center, []), index: coalesce(apoc.convert.toInteger(([]+pd.irw.index)[0]), []) + [] }) AS template_domains,primary,template_channel OPTIONAL MATCH (primary)-[:has_source]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary,template_channel,template_domains OPTIONAL MATCH (o:Class)<-[r:SUBCLASSOF|INSTANCEOF]-(primary) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} ) END AS parents ,primary,template_channel,template_domains,dataset_license OPTIONAL MATCH (o:Class)<-[r {}]-(primary) WHERE (r.type=\\'Related\\') AND ((not exists(r.hide_in_terminfo)) OR (not (r.hide_in_terminfo[0] = true))) WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS relationships ,primary,template_channel,template_domains,dataset_license,parents OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, template_channel, template_domains, dataset_license, parents, relationships OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,template_channel,template_domains,dataset_license,parents,relationships OPTIONAL MATCH (o:Individual)<-[r]-(primary) WHERE (r.type=\\'Related\\') OR r:term_replaced_by WITH CASE WHEN o IS NULL THEN [] ELSE COLLECT ({ relation: { label: r.label, iri: r.iri, type: type(r), database_cross_reference: coalesce(r.database_cross_reference, []), confidence_value: coalesce(toString(r.confidence_value[0]), \\'\\') }, object: { short_form: o.short_form, label: coalesce(o.label,\\'\\'), iri: o.iri, types: labels(o), unique_facets: apoc.coll.sort(coalesce(o.uniqueFacets, [])), symbol: coalesce(([]+o.symbol)[0], \\'\\')} }) END AS related_individuals ,primary,template_channel,template_domains,dataset_license,parents,relationships,xrefs 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, \\'Get JSON for Template\\' AS query, \\'c58c844\\' AS version , template_channel, template_domains, dataset_license, parents, relationships, xrefs, related_individuals\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "c7fc2cef", + "id": "18cc1cbc", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c34e61f", + "id": "df4bb3ef", "metadata": {}, "outputs": [], "source": [ @@ -1261,8 +1261,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'fe226a6' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for pub', 'description': 'Fetches JSON for pub.', 'query': '\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary 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, \\'Get JSON for pub\\' AS query, \\'fe226a6\\' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], \\'\\') ,PubMed: coalesce(([]+primary.PMID)[0], \\'\\'), FlyBase: coalesce(([]+primary.FlyBase)[0], \\'\\'), DOI: coalesce(([]+primary.DOI)[0], \\'\\') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], ''), core : { short_form: ds.short_form, label: coalesce(ds.label,''), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], '')} }, license: { icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }}) AS dataset_license,primary 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, 'Get JSON for pub' AS query, 'c58c844' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], '') ,PubMed: coalesce(([]+primary.PMID)[0], ''), FlyBase: coalesce(([]+primary.FlyBase)[0], ''), DOI: coalesce(([]+primary.DOI)[0], '') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for pub', 'description': 'Fetches JSON for pub.', 'query': '\"statement\": \"MATCH (primary:Individual:pub) WHERE primary.short_form in [$id] WITH primary OPTIONAL MATCH (primary)-[:has_reference]-(ds:DataSet)-[:has_license|license]->(l:License) WITH COLLECT ({ dataset: { link : coalesce(([]+ds.dataset_link)[0], \\'\\'), core : { short_form: ds.short_form, label: coalesce(ds.label,\\'\\'), iri: ds.iri, types: labels(ds), unique_facets: apoc.coll.sort(coalesce(ds.uniqueFacets, [])), symbol: coalesce(([]+ds.symbol)[0], \\'\\')} }, license: { icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }}) AS dataset_license,primary 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, \\'Get JSON for pub\\' AS query, \\'c58c844\\' AS version , dataset_license, {title: coalesce(([]+primary.title)[0], \\'\\') ,PubMed: coalesce(([]+primary.PMID)[0], \\'\\'), FlyBase: coalesce(([]+primary.FlyBase)[0], \\'\\'), DOI: coalesce(([]+primary.DOI)[0], \\'\\') }AS pub_specific_content\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "0fe320f0", + "id": "79294189", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7b08e8a", + "id": "cc80bc0a", "metadata": {}, "outputs": [], "source": [ @@ -1298,8 +1298,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix, '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'fe226a6' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for DataSet', 'description': 'Get JSON for DataSet', 'query': '\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix, \\'\\')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], \\'\\'), 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, \\'Get JSON for DataSet\\' AS query, \\'fe226a6\\' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], '')} , channel_image: { 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], ''), image_nrrd: COALESCE(([]+irw.nrrd)[0], ''), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], ''), image_swc: COALESCE(([]+irw.swc)[0], ''), image_obj: COALESCE(([]+irw.obj)[0], ''), image_wlz: COALESCE(([]+irw.wlz)[0], ''), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(primary.short_form, ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], ''), accession: coalesce(([]+dbx.accession)[0], ''), link_text: primary.label + ' on ' + s.label, homepage: coalesce(s.homepage[0], ''), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,''), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], '')} , icon: coalesce(s.link_icon_url[0], ''), link_postfix: coalesce(s.link_postfix[0], '')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], ''), link : coalesce(([]+l.license_url)[0], ''), core : { short_form: l.short_form, label: coalesce(l.label,''), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], '')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,''), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], '')} , PubMed: coalesce(([]+p.PMID)[0], ''), FlyBase: coalesce(([]+p.FlyBase)[0], ''), DOI: coalesce(([]+p.DOI)[0], '') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], ''), 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, 'Get JSON for DataSet' AS query, 'c58c844' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for DataSet', 'description': 'Get JSON for DataSet', 'query': '\"statement\": \"MATCH (primary:DataSet) WHERE primary.short_form in [$id] WITH primary CALL apoc.cypher.run(\\'WITH primary OPTIONAL MATCH (primary)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 10\\', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), unique_facets: apoc.coll.sort(coalesce(i.uniqueFacets, [])), symbol: coalesce(([]+i.symbol)[0], \\'\\')} , channel_image: { 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], \\'\\'), image_nrrd: COALESCE(([]+irw.nrrd)[0], \\'\\'), image_thumbnail: COALESCE(([]+irw.thumbnail)[0], \\'\\'), image_swc: COALESCE(([]+irw.swc)[0], \\'\\'), image_obj: COALESCE(([]+irw.obj)[0], \\'\\'), image_wlz: COALESCE(([]+irw.wlz)[0], \\'\\'), index: coalesce(apoc.convert.toInteger(([]+irw.index)[0]), []) + [] }} }) END AS anatomy_channel_image ,primary OPTIONAL MATCH (s:Site { short_form: apoc.convert.toList(primary.self_xref)[0] }) WITH CASE WHEN s IS NULL THEN [] ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(primary.short_form, \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) END AS self_xref, primary, anatomy_channel_image OPTIONAL MATCH (s:Site)<-[dbx:database_cross_reference]-(primary) WITH CASE WHEN s IS NULL THEN self_xref ELSE COLLECT({ link_base: coalesce(([]+s.link_base)[0], \\'\\'), accession: coalesce(([]+dbx.accession)[0], \\'\\'), link_text: primary.label + \\' on \\' + s.label, homepage: coalesce(s.homepage[0], \\'\\'), is_data_source: coalesce(s.is_data_source[0], false), site: { short_form: s.short_form, label: coalesce(s.label,\\'\\'), iri: s.iri, types: labels(s), unique_facets: apoc.coll.sort(coalesce(s.uniqueFacets, [])), symbol: coalesce(([]+s.symbol)[0], \\'\\')} , icon: coalesce(s.link_icon_url[0], \\'\\'), link_postfix: coalesce(s.link_postfix[0], \\'\\')}) + self_xref END AS xrefs,primary,anatomy_channel_image OPTIONAL MATCH (primary)-[:has_license|license]->(l:License) WITH collect ({ icon : coalesce(([]+l.license_logo)[0], \\'\\'), link : coalesce(([]+l.license_url)[0], \\'\\'), core : { short_form: l.short_form, label: coalesce(l.label,\\'\\'), iri: l.iri, types: labels(l), unique_facets: apoc.coll.sort(coalesce(l.uniqueFacets, [])), symbol: coalesce(([]+l.symbol)[0], \\'\\')} }) as license,primary,anatomy_channel_image,xrefs OPTIONAL MATCH (primary)-[rp:has_reference]->(p:pub) WITH CASE WHEN p is null THEN [] ELSE collect({ core: { short_form: p.short_form, label: coalesce(p.label,\\'\\'), iri: p.iri, types: labels(p), unique_facets: apoc.coll.sort(coalesce(p.uniqueFacets, [])), symbol: coalesce(([]+p.symbol)[0], \\'\\')} , PubMed: coalesce(([]+p.PMID)[0], \\'\\'), FlyBase: coalesce(([]+p.FlyBase)[0], \\'\\'), DOI: coalesce(([]+p.DOI)[0], \\'\\') } ) END AS pubs,primary,anatomy_channel_image,xrefs,license OPTIONAL MATCH (primary)<-[:has_source]-(i:Individual) WITH i, primary, anatomy_channel_image, xrefs, license, pubs OPTIONAL MATCH (i)-[:INSTANCEOF]-(c:Class) WITH DISTINCT { images: count(distinct i),types: count(distinct c) } as dataset_counts,primary,anatomy_channel_image,xrefs,license,pubs RETURN { link : coalesce(([]+primary.dataset_link)[0], \\'\\'), 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, \\'Get JSON for DataSet\\' AS query, \\'c58c844\\' AS version , anatomy_channel_image, xrefs, license, pubs, dataset_counts\", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "b18fb314", + "id": "4f80eeb2", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bccb753", + "id": "c696987b", "metadata": {}, "outputs": [], "source": [ @@ -1335,8 +1335,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'fe226a6' AS version \", \"parameters\" : { \"id\" : \"id\" }}\n", - "query_template = {'name': 'Get JSON for License', 'description': 'Get JSON for License', 'query': '\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], \\'\\'), link : coalesce(([]+primary.license_url)[0], \\'\\'), 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, \\'Get JSON for License\\' AS query, \\'fe226a6\\' AS version \", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], ''), link : coalesce(([]+primary.license_url)[0], ''), 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, 'Get JSON for License' AS query, 'c58c844' AS version \", \"parameters\" : { \"id\" : \"id\" }}\n", + "query_template = {'name': 'Get JSON for License', 'description': 'Get JSON for License', 'query': '\"statement\": \"MATCH (primary:License) WHERE primary.short_form in [$id] WITH primary RETURN { icon : coalesce(([]+primary.license_logo)[0], \\'\\'), link : coalesce(([]+primary.license_url)[0], \\'\\'), 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, \\'Get JSON for License\\' AS query, \\'c58c844\\' AS version \", \"parameters\" : { \"id\" : \"$ID\" }', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "a320111a", + "id": "36d1e736", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90b1e9ea", + "id": "7799d7e0", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "6f29b65f", + "id": "b9758071", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8866163", + "id": "5ac7db72", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "17494604", + "id": "b0ee6127", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fd2cb08", + "id": "23213ead", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "87312c81", + "id": "f0bbb7e4", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1ffe85e", + "id": "cdec8552", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "7198c03f", + "id": "754c840f", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "daec03f7", + "id": "0ec285ec", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "59b996c9", + "id": "a9fb08e7", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0acc0a5", + "id": "ec669c89", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "36442bdd", + "id": "444ed675", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c78019a4", + "id": "63d420b8", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "cce2dcea", + "id": "05c17428", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49b122a1", + "id": "40016174", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "c26fee52", + "id": "470ad13e", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54fab673", + "id": "b0f6718f", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "59a86c71", + "id": "d373be62", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6e49f78", + "id": "8ef3c6bc", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "82d5c2fc", + "id": "d6bec33a", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e386c52a", + "id": "80158612", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "f59879fd", + "id": "b0e63e0e", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cfc4915d", + "id": "af0a9359", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "79fc707e", + "id": "040a923d", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fde5457d", + "id": "7666028e", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "957b03a2", + "id": "63be27e0", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a314f66a", + "id": "7d06d761", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "22f31f45", + "id": "02f9abe9", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec432f82", + "id": "e5f17482", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "23287d79", + "id": "092d065f", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8f8e2576", + "id": "76229739", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "1036c46f", + "id": "eb2c048e", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e541cbc5", + "id": "81b75b9a", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "7157987b", + "id": "0e92ea0a", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fcede88", + "id": "ff2ffbc7", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "edccd78a", + "id": "0e0c1196", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49d27df3", + "id": "f977d1fa", "metadata": {}, "outputs": [], "source": [ @@ -1981,4 +1981,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} From 497663e34ab1c5c53c27e0e66f91573e83fc0e8e Mon Sep 17 00:00:00 2001 From: Rob Court Date: Sun, 14 Jul 2024 17:20:54 +0100 Subject: [PATCH 13/14] patch for non List field --- model/vfb.xmi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index 8c0d1608a..8933c4eee 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -348,7 +348,7 @@ name="Test Query for Exp from Anatomy" description="Get JSON for anat_2_ep query" returnType="//@libraries.3/@types.1" - query=""statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS}" + query=""statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS}" countQuery=""statement": "MATCH (anat:Class) WHERE anat.short_form IN $ids OPTIONAL MATCH (ep:Class)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat) RETURN count(ep) as count", "parameters" : { "ids" : $ARRAY_ID_RESULTS}"/> Date: Sun, 14 Jul 2024 16:21:13 +0000 Subject: [PATCH 14/14] Update README with XMI structure and query breakdowns --- model/queries_execution_notebook.ipynb | 236 ++++++++++++------------- model/query.md | 6 +- 2 files changed, 121 insertions(+), 121 deletions(-) diff --git a/model/queries_execution_notebook.ipynb b/model/queries_execution_notebook.ipynb index 3b3216fec..d84942a19 100644 --- a/model/queries_execution_notebook.ipynb +++ b/model/queries_execution_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "f7f78576", + "id": "be35de5a", "metadata": {}, "source": [ "# Query Execution Notebook" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c58181e", + "id": "0bc0eec1", "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "markdown", - "id": "3c8007bc", + "id": "b9e63956", "metadata": {}, "source": [ "## anatomy_query\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f52e06ca", + "id": "62ef69fc", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "1750a09d", + "id": "e84756cd", "metadata": {}, "source": [ "## anat_image_query\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad412cdb", + "id": "9b07502b", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "e6d6480d", + "id": "32c752e2", "metadata": {}, "source": [ "## Get other cluster members\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e1923e7", + "id": "cfd2bf55", "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "adc25449", + "id": "f9995af0", "metadata": {}, "source": [ "## Fetch all example individuals for Class\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86b332a7", + "id": "8ecb3bcb", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "ec9c7f61", + "id": "a9b1e773", "metadata": {}, "source": [ "## Find domain individuals for template id\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37925a0e", + "id": "766e5e60", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "1c0283dc", + "id": "6402e2a2", "metadata": {}, "source": [ "## Get cluster members\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e82f0d4", + "id": "bc2556f8", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "244cac72", + "id": "5d2282a2", "metadata": {}, "source": [ "## Find images for dataset\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "71f9835d", + "id": "29e38eff", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "5dcda79a", + "id": "a420db86", "metadata": {}, "source": [ "## Find images aligned to template id\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "03f8f8a0", + "id": "ae7d0d48", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "a252e4df", + "id": "c3ed67a5", "metadata": {}, "source": [ "## Test Query for Exp from Anatomy\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e72ffd74", + "id": "7cda1c51", "metadata": {}, "outputs": [], "source": [ @@ -336,8 +336,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Test Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Test Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(([]+pub.FlyBase)[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -353,7 +353,7 @@ }, { "cell_type": "markdown", - "id": "ed299d7a", + "id": "9b7aeb1d", "metadata": {}, "source": [ "## Query for Anatomy from Exp\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13353814", + "id": "8fa0c3ee", "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "markdown", - "id": "be87241b", + "id": "4e435325", "metadata": {}, "source": [ "## Test Query for Anatomy from Exp\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45f52d84", + "id": "28054007", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "1da02d4c", + "id": "d7213764", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e954a48", + "id": "4cc5ed44", "metadata": {}, "outputs": [], "source": [ @@ -447,8 +447,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(([]+pub.FlyBase)[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "aca38a2e", + "id": "806160f1", "metadata": {}, "source": [ "## template_2_datasets_query\n", @@ -474,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea7fb60d", + "id": "61a552e0", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "f1e4af82", + "id": "29b030ef", "metadata": {}, "source": [ "## test_all_datasets_query\n", @@ -511,7 +511,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f744c5c", + "id": "c6163015", "metadata": {}, "outputs": [], "source": [ @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "c4b2c920", + "id": "71d6bec0", "metadata": {}, "source": [ "## Query for Exp from Anatomy\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "761bc504", + "id": "8cfb20cc", "metadata": {}, "outputs": [], "source": [ @@ -558,8 +558,8 @@ "ids = ['ID1', 'ID2']\n", "\n", "# Query\n", - "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", - "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(pub.FlyBase[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", + "query = {\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : ids}}\n", + "query_template = {'name': 'Query for Exp from Anatomy', 'description': 'Get JSON for anat_2_ep query', 'query': '\"statement\": \"MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,\\'\\'), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], \\'\\')} , PubMed: coalesce(pub.PMID[0], \\'\\'), FlyBase: coalesce(([]+pub.FlyBase)[0], \\'\\'), DOI: coalesce(pub.DOI[0], \\'\\') }) as pubs CALL apoc.cypher.run(\\'WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5\\', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,\\'\\'), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], \\'\\')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], \\'\\')} ,image_folder: COALESCE(irw.folder[0], \\'\\'), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,\\'\\'), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], \\'\\')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,\\'\\'), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], \\'\\')} AS expression_pattern, \\'Get JSON for anat_2_ep query\\' AS query, \\'fe226a6\\' AS version , pubs, anatomy_channel_image\", \"parameters\" : { \"ids\" : $ARRAY_ID_RESULTS}', 'data_source_url': 'http://pdb.v4.virtualflybrain.org/db/neo4j/tx', 'data_source_type': 'neo4jDataSource'}\n", "\n", "# Execute the query (example for Neo4j)\n", "import requests\n", @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "478570cd", + "id": "c7fb4e07", "metadata": {}, "source": [ "## neuron_region_connectivity_query\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db0abdca", + "id": "20aefe4a", "metadata": {}, "outputs": [], "source": [ @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "4712df29", + "id": "9238d2c4", "metadata": {}, "source": [ "## neuron_neuron_connectivity_query\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4394f461", + "id": "775943cd", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "2dac5f58", + "id": "64ff9c19", "metadata": {}, "source": [ "## NBLAST_anat_image_query\n", @@ -659,7 +659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "434a3c8f", + "id": "9d22395c", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "fa49e29a", + "id": "5cbed346", "metadata": {}, "source": [ "## Fetch all entities for pub\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38c0983a", + "id": "64550344", "metadata": {}, "outputs": [], "source": [ @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "b5fcb622", + "id": "baab6bba", "metadata": {}, "source": [ "## NBLAST_anat_image_query_exp\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2312f9e9", + "id": "bd56edd2", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "961a5902", + "id": "683a77d4", "metadata": {}, "source": [ "## NB_anat_image_query\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e494caf", + "id": "9e7053f5", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "b4f827b7", + "id": "389ac5b8", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "968b054b", + "id": "2e9a5800", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "7199e078", + "id": "b63d6af9", "metadata": {}, "source": [ "## Get JSON for anat scRNAseq query\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aab179f8", + "id": "b5548d99", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "90022a86", + "id": "7a1eaed3", "metadata": {}, "source": [ "## Get JSON for dataset scRNAseq query\n", @@ -881,7 +881,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dce73477", + "id": "4d694ee2", "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "markdown", - "id": "6dfd33b6", + "id": "f332cb4a", "metadata": {}, "source": [ "## Get JSON for cluster expression query\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0649937f", + "id": "9e9b2fad", "metadata": {}, "outputs": [], "source": [ @@ -945,7 +945,7 @@ }, { "cell_type": "markdown", - "id": "6ca2dd82", + "id": "53c4d882", "metadata": {}, "source": [ "## Get term core info\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2d19338", + "id": "fb5081fa", "metadata": {}, "outputs": [], "source": [ @@ -982,7 +982,7 @@ }, { "cell_type": "markdown", - "id": "975e3e4d", + "id": "619e3081", "metadata": {}, "source": [ "## Get baseline term info\n", @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e315bee8", + "id": "fa98e90b", "metadata": {}, "outputs": [], "source": [ @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "d0b10699", + "id": "a01cd6ed", "metadata": {}, "source": [ "## Get JSON for Class\n", @@ -1029,7 +1029,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a0987e94", + "id": "271de81b", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "ef5681fa", + "id": "fd1d836a", "metadata": {}, "source": [ "## Get JSON for Neuron Class\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5d0748b2", + "id": "66bcc1ca", "metadata": {}, "outputs": [], "source": [ @@ -1093,7 +1093,7 @@ }, { "cell_type": "markdown", - "id": "d342e9a3", + "id": "feccb163", "metadata": {}, "source": [ "## Get JSON for Split Class\n", @@ -1103,7 +1103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "910b48a9", + "id": "41e595bf", "metadata": {}, "outputs": [], "source": [ @@ -1130,7 +1130,7 @@ }, { "cell_type": "markdown", - "id": "159167c2", + "id": "26d4c046", "metadata": {}, "source": [ "## Get JSON for Individual\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f02c542a", + "id": "5135666a", "metadata": {}, "outputs": [], "source": [ @@ -1167,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "417bd6fc", + "id": "d786128e", "metadata": {}, "source": [ "## Get JSON for Cluster\n", @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6a4e70d", + "id": "8001bf6f", "metadata": {}, "outputs": [], "source": [ @@ -1204,7 +1204,7 @@ }, { "cell_type": "markdown", - "id": "f0fd9be6", + "id": "ed51a87e", "metadata": {}, "source": [ "## Get JSON for Template\n", @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c72166af", + "id": "299b54d9", "metadata": {}, "outputs": [], "source": [ @@ -1241,7 +1241,7 @@ }, { "cell_type": "markdown", - "id": "18cc1cbc", + "id": "792603cf", "metadata": {}, "source": [ "## Get JSON for pub\n", @@ -1251,7 +1251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df4bb3ef", + "id": "96e1cd55", "metadata": {}, "outputs": [], "source": [ @@ -1278,7 +1278,7 @@ }, { "cell_type": "markdown", - "id": "79294189", + "id": "a8170f2a", "metadata": {}, "source": [ "## Get JSON for DataSet\n", @@ -1288,7 +1288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cc80bc0a", + "id": "7bc0690d", "metadata": {}, "outputs": [], "source": [ @@ -1315,7 +1315,7 @@ }, { "cell_type": "markdown", - "id": "4f80eeb2", + "id": "2b81ab03", "metadata": {}, "source": [ "## Get JSON for License\n", @@ -1325,7 +1325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c696987b", + "id": "3e6e1ec7", "metadata": {}, "outputs": [], "source": [ @@ -1352,7 +1352,7 @@ }, { "cell_type": "markdown", - "id": "36d1e736", + "id": "932d6bf2", "metadata": {}, "source": [ "## Owlery Part of\n", @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7799d7e0", + "id": "c72aa25c", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "b9758071", + "id": "ea2c5a95", "metadata": {}, "source": [ "## Owlery Neuron class with part here\n", @@ -1395,7 +1395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ac7db72", + "id": "a2ad71da", "metadata": {}, "outputs": [], "source": [ @@ -1418,7 +1418,7 @@ }, { "cell_type": "markdown", - "id": "b0ee6127", + "id": "2028a2da", "metadata": {}, "source": [ "## Owlery Neurons Synaptic\n", @@ -1428,7 +1428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23213ead", + "id": "8f56a78d", "metadata": {}, "outputs": [], "source": [ @@ -1451,7 +1451,7 @@ }, { "cell_type": "markdown", - "id": "f0bbb7e4", + "id": "6036dad0", "metadata": {}, "source": [ "## Owlery Neurons Presynaptic\n", @@ -1461,7 +1461,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdec8552", + "id": "0a84b7e9", "metadata": {}, "outputs": [], "source": [ @@ -1484,7 +1484,7 @@ }, { "cell_type": "markdown", - "id": "754c840f", + "id": "b810269f", "metadata": {}, "source": [ "## Owlery Neurons Postsynaptic\n", @@ -1494,7 +1494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ec285ec", + "id": "74123342", "metadata": {}, "outputs": [], "source": [ @@ -1517,7 +1517,7 @@ }, { "cell_type": "markdown", - "id": "a9fb08e7", + "id": "def179c4", "metadata": {}, "source": [ "## Owlery Neuron classes fasciculating here\n", @@ -1527,7 +1527,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec669c89", + "id": "90fe4d98", "metadata": {}, "outputs": [], "source": [ @@ -1550,7 +1550,7 @@ }, { "cell_type": "markdown", - "id": "444ed675", + "id": "2a9f3a1c", "metadata": {}, "source": [ "## Owlery tracts in\n", @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63d420b8", + "id": "c2a9cc04", "metadata": {}, "outputs": [], "source": [ @@ -1583,7 +1583,7 @@ }, { "cell_type": "markdown", - "id": "05c17428", + "id": "ba2fda89", "metadata": {}, "source": [ "## Owlery Subclasses of\n", @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40016174", + "id": "b254cc81", "metadata": {}, "outputs": [], "source": [ @@ -1616,7 +1616,7 @@ }, { "cell_type": "markdown", - "id": "470ad13e", + "id": "2aabb413", "metadata": {}, "source": [ "## Owlery Lineage Clones\n", @@ -1626,7 +1626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b0f6718f", + "id": "26a3d94f", "metadata": {}, "outputs": [], "source": [ @@ -1649,7 +1649,7 @@ }, { "cell_type": "markdown", - "id": "d373be62", + "id": "c477f572", "metadata": {}, "source": [ "## subClassOf cell that overlaps some X\n", @@ -1659,7 +1659,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ef3c6bc", + "id": "58302ecb", "metadata": {}, "outputs": [], "source": [ @@ -1682,7 +1682,7 @@ }, { "cell_type": "markdown", - "id": "d6bec33a", + "id": "d5b30ba0", "metadata": {}, "source": [ "## subClassOf overlaps some X\n", @@ -1692,7 +1692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "80158612", + "id": "c14dc922", "metadata": {}, "outputs": [], "source": [ @@ -1715,7 +1715,7 @@ }, { "cell_type": "markdown", - "id": "b0e63e0e", + "id": "6f41e045", "metadata": {}, "source": [ "## subClassOf cell overlaps some X\n", @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "af0a9359", + "id": "c22d62f8", "metadata": {}, "outputs": [], "source": [ @@ -1748,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "040a923d", + "id": "6bb80f8a", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here (clustered)\n", @@ -1758,7 +1758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7666028e", + "id": "a3abe9ed", "metadata": {}, "outputs": [], "source": [ @@ -1781,7 +1781,7 @@ }, { "cell_type": "markdown", - "id": "63be27e0", + "id": "2a616a5a", "metadata": {}, "source": [ "## Owlery Images of neurons with some part here\n", @@ -1791,7 +1791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d06d761", + "id": "8c62b1cd", "metadata": {}, "outputs": [], "source": [ @@ -1814,7 +1814,7 @@ }, { "cell_type": "markdown", - "id": "02f9abe9", + "id": "52b540c2", "metadata": {}, "source": [ "## Owlery individual parts\n", @@ -1824,7 +1824,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5f17482", + "id": "7be68e40", "metadata": {}, "outputs": [], "source": [ @@ -1847,7 +1847,7 @@ }, { "cell_type": "markdown", - "id": "092d065f", + "id": "26b3a5d7", "metadata": {}, "source": [ "## Get anat_query\n", @@ -1857,7 +1857,7 @@ { "cell_type": "code", "execution_count": null, - "id": "76229739", + "id": "1fbe1c79", "metadata": {}, "outputs": [], "source": [ @@ -1880,7 +1880,7 @@ }, { "cell_type": "markdown", - "id": "eb2c048e", + "id": "9987f181", "metadata": {}, "source": [ "## Get user NBLAST results\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81b75b9a", + "id": "5a8cb7cb", "metadata": {}, "outputs": [], "source": [ @@ -1913,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "0e92ea0a", + "id": "d36f86f8", "metadata": {}, "source": [ "## Get term info\n", @@ -1923,7 +1923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff2ffbc7", + "id": "39431399", "metadata": {}, "outputs": [], "source": [ @@ -1946,7 +1946,7 @@ }, { "cell_type": "markdown", - "id": "0e0c1196", + "id": "2983c1f5", "metadata": {}, "source": [ "## Get cached VFB_JSON for Term\n", @@ -1956,7 +1956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f977d1fa", + "id": "522b2b9a", "metadata": {}, "outputs": [], "source": [ diff --git a/model/query.md b/model/query.md index eef7c59a3..9a0f63277 100644 --- a/model/query.md +++ b/model/query.md @@ -205,7 +205,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor @@ -277,7 +277,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor @@ -349,7 +349,7 @@ Query: ``` Description: Get JSON for anat_2_ep query Type: gep_2:SimpleQuery Query: ``` - "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(pub.FlyBase[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} + "statement": "MATCH (ep:Class:Expression_pattern)<-[ar:overlaps|part_of]-(:Individual)-[:INSTANCEOF]->(anat:Class) WHERE anat.short_form in $ids WITH DISTINCT collect(DISTINCT ar.pub[0]) as pubs, anat, ep UNWIND pubs as p OPTIONAL MATCH (pub:pub { short_form: p}) WITH anat, ep, collect({ core: { short_form: pub.short_form, label: coalesce(pub.label,''), iri: pub.iri, types: labels(pub), symbol: coalesce(pub.`symbol`[0], '')} , PubMed: coalesce(pub.PMID[0], ''), FlyBase: coalesce(([]+pub.FlyBase)[0], ''), DOI: coalesce(pub.DOI[0], '') }) as pubs CALL apoc.cypher.run('WITH ep OPTIONAL MATCH (ep)<- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)<-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {ep:ep}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, anat, ep, pubs OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.`symbol`[0], '')} , channel_image: { 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), symbol: coalesce(template_anat.`symbol`[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,anat,ep,pubs RETURN { short_form: anat.short_form, label: coalesce(anat.label,''), iri: anat.iri, types: labels(anat), symbol: coalesce(anat.`symbol`[0], '')} as anatomy, { short_form: ep.short_form, label: coalesce(ep.label,''), iri: ep.iri, types: labels(ep), symbol: coalesce(ep.`symbol`[0], '')} AS expression_pattern, 'Get JSON for anat_2_ep query' AS query, 'fe226a6' AS version , pubs, anatomy_channel_image", "parameters" : { "ids" : $ARRAY_ID_RESULTS} ``` ## Query Name: vfb_query schema processor