Graph Algorithms - fhircat/CORD-19-on-FHIR GitHub Wiki

Data Loading

//load gene nodes
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "gene_id_names.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MERGE (g:BEntity:Gene {id:row.id})
SET g.name = row.name;

//load disease nodes
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "mesh-scr-disease.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MERGE (g:BEntity:Disease {id:row.id})
SET g.name = row.name;

//load disease nodes
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "mesh-descriptor-disease.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MERGE (g:BEntity:Disease {id:row.id})
SET g.name = row.name;

//load disease-disease cooccurrence relationships
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "query-result-disease-disease-count.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MATCH (origin:Disease {id: row.startId})
MATCH (destination:Disease {id: row.endId})
MERGE (origin)-[:COOCCURRENCE {count: toInteger(row.count)}]->(destination);

//load bentity-bentity cooccurrence relationships
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "query-result-disease-disease-count.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MATCH (origin:BEntity {id: row.startId})
MATCH (destination:BEntity {id: row.endId})
MERGE (origin)-[:COOCCURRENCE {count: toInteger(row.count)}]->(destination);

//load disease-gene cooccurrence relationships
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "query-result-disease-gene-count.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MATCH (origin:Disease {id: row.startId})
MATCH (destination:Gene {id: row.endId})
MERGE (origin)-[:COOCCURRENCE {count: toInteger(row.count)}]->(destination);

//load gene-gene cooccurrence relationships
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "query-result-gene-gene-count.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MATCH (origin:Gene {id: row.startId})
MATCH (destination:Gene {id: row.endId})
MERGE (origin)-[:COOCCURRENCE {count: toInteger(row.count)}]->(destination);

//load disease-disease cooccurrence relationships
WITH "https://raw.githubusercontent.com/fhircat/CORD-19-on-FHIR/master/cooccurrence/" AS base
WITH base + "query-result-disease-disease-count-11.csv" AS uri
LOAD CSV WITH HEADERS FROM uri AS row
MATCH (origin:Disease {id: row.startId})
MATCH (destination:Disease {id: row.endId})
MERGE (origin)-[:COOCCURRENCE {count: toInteger(row.count)}]->(destination);