cypher query snippets to help inspect metadata visually
You can use Neo4j Cypher queries in a web browser window together with the HCA Ingest Service Graph Validation Suite to generate diagrams of experimental design or inspect HCA metadata.
Pre-requisites and installation
You need to have the
- HCA Ingest Service Graph Validation Suite installed,
- docker engine,
- a web browser.
Usage
- Start
docker
(if not already running), then start theingest-graph-validator
back-end:
ingest-graph-validator init
- Load (
hydrate
) an HCA metadata spreadsheet or a submission from Ingest. For details, see:
ingest-graph-validator hydrate --help
-
Go to http://localhost:7474 in a browser to open the neo4j front-end.
-
IMPORTANT For optimal visual experience in the Neo4j Browser, turn autocomplete off by going to the bottom of the settings menu and unticking
Connect result nodes
.
Copy and paste the cypher
snippets below one-by-one into the Neo4j Browser command line. Please, note that snippets 5. and 6. may crash your browser with some rich datasets with a large number of nodes or relationships. If that happens, just refresh the browser window, re-connect to the neo4j server and use snippets 1-5, or make a custom query for that dataset. You can download the results as a CSV from the Table, Text, and Code views or download the graph as an SVG or PNG from the Graph view by clicking the download icon in the upper right corner of the user interface. For further help, see the Neo4j Browser User Interface Guide.
1 Check if the desired project has been loaded:
// Check project short name.
// Returns textual result.
MATCH (n:project)
RETURN n.`project_core.project_short_name` AS `project short name`
2 Make a sub-graph that displays protocol links
// Inspect protocol links visually
MATCH protocols=()-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:PROTOCOLS]->(:protocol)
RETURN protocols
3 Inspect the biomaterials:
// From donor_organism to biomaterials (down 2 levels).
MATCH p=(:donor_organism)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:biomaterial)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:biomaterial)
RETURN p
4 The following snippet is to visualise part of the experimental design in the metadata.It is useful for datasets with too many nodes and relationships to visualise at once.
// Partial experimental design.
MATCH expdesign=(:biomaterial)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:biomaterial)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:sequence_file)
RETURN expdesign
5 Experimental design graph
// Experimental design
// related to biomaterials.
// IMPORTANT: For optimal visual experience in the neo4j browser,
// turn autocomplete off by going to the
// bottom of the settings menu and unticking
// 'Connect result nodes'.
MATCH expdesign=(:donor_organism)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:biomaterial)-[:DUMMY_EXPERIMENTAL_DESIGN *2..8]-()
RETURN expdesign
6 Experimental design of project
// Project experimental design
// without protocols.
// IMPORTANT: For optimal visual experience in the neo4j browser,
// turn autocomplete off by going to the
// bottom of the settings menu and unticking
// 'Connect result nodes'.
MATCH p=(:project)<-[:PROJECTS]-(:donor_organism)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:process)-[:DUMMY_EXPERIMENTAL_DESIGN]->(:biomaterial)-[:DUMMY_EXPERIMENTAL_DESIGN *]-()
RETURN p