// examples.cypher: the six queries of VERA's graph API (GET /api/v1/reference-graph/*) that its documentation numbers, // written as Cypher, so the answers can be compared. Read-only. The API also follows reference links (ids a node names // in its own properties, such as a protein's gene in xrefs); in Neo4j those are properties, not edges, so these queries // follow edges only. // 1. A test, a gene and a protein by name (the API's /search?q=ApoB ranks its hits; this query matches exact names, not // the API's ranked search). MATCH (n) WHERE n.pref_label = 'Apolipoprotein B [Mass/volume] in Serum or Plasma' OR (n:Gene AND n.pref_label = 'APOB') OR n.id = 'uniprot:P04114' RETURN labels(n)[0] AS kind, n.id AS id, n.pref_label AS name, count { (n)--() } AS edges ORDER BY kind; // 2. The ApoB test and its provenance (/node?id=loinc:1884-6). MATCH (b:Biomarker {id: 'loinc:1884-6'}) RETURN b.id AS id, b.pref_label AS name, b.source AS source, b.source_release AS release, b.licence AS licence, count { (b)--() } AS edges; // 3. The ApoB protein's pathways (/neighbourhood?id=uniprot:P04114&depth=1, edges only): 20 pathways, 27 edges (Reactome // lists some pairs more than once, with different evidence). MATCH (:Protein {id: 'uniprot:P04114'})-[r:PARTICIPATES_IN]->(w:Pathway) RETURN w.id AS pathway, w.pref_label AS name, count(r) AS edges ORDER BY pathway; // 4. APOE to Alzheimer disease (/paths?from=ensembl:ENSG00000130203&to=mondo:0004975): a shortest path over edges of any // type, with highest_submission_review_status of each edge on it (ClinVar's own words, on the edges that carry the // property; null on every other edge). MATCH p = shortestPath((:Gene {id: 'ensembl:ENSG00000130203'})-[*..4]-(:Disease {id: 'mondo:0004975'})) RETURN [n IN nodes(p) | n.id] AS nodes, [r IN relationships(p) | type(r)] AS edges, [r IN relationships(p) | r.highest_submission_review_status] AS review_status; // 5. CYP2C19 *2/*2 to clopidogrel, through CPIC's guideline (/paths?from=cpic.diplotype:CYP2C19*2/*2&to=clinpgx:guideline/PA166251443&links=edges // asks the API for the path to the guideline; this query goes one step on, to the medicine the guideline's recommendation is for). MATCH p = (:Diplotype {id: 'cpic.diplotype:CYP2C19*2/*2'})-[:PREDICTS]->(:MetabolizerPhenotype)-[:HAS_GUIDELINE]->(:PgxGuideline)-[r:RECOMMENDATION_FOR]->(:Drug {id: 'drugbank:DB00758'}) RETURN [n IN nodes(p) | coalesce(n.pref_label, n.id)] AS chain, r.cpic_level AS cpic_level; // 6. The ApoB test to the ApoB protein, one step (/paths?from=loinc:1884-6&to=uniprot:P04114): the test-to-analyte // row, a hand-made row, with who signed it for the build and when (/node?id=loinc:1884-6 lists the same edge). MATCH (:Biomarker {id: 'loinc:1884-6'})-[r:HAS_ANALYTE]->(a:Protein {id: 'uniprot:P04114'}) RETURN a.id AS analyte, r.role AS role, r.review_status AS review_status, r.reviewed_by AS reviewed_by, r.reviewed_at AS reviewed_at;