-
Notifications
You must be signed in to change notification settings - Fork 6
/
queries.txt
95 lines (60 loc) · 2.4 KB
/
queries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Get mappings distance 2 filtering by either source or datsource target
MATCH path= shortestPath( (ft:Term)-[m:MAPPING*1..2]-(tt:Term))
WHERE ft.curie = 'EFO:0004230'
WITH tt,path, extract ( r in m | r.sourcePrefix) as source
MATCH (tt)-[HAS_SOURCE]-(td)
WHERE 'KEGG' in td.prefix and 'efo' in source
UNWIND source as source1
RETURN tt.curie, tt.label,collect (distinct td.prefix), collect (distinct source1), length(path) as dist
ORDER BY dist
# old experimental stuff below
CREATE CONSTRAINT ON (i:Identifier) ASSERT i.term IS UNIQUE
CREATE CONSTRAINT ON (i:Uri) ASSERT i.term IS UNIQUE
CREATE CONSTRAINT ON (i:Cui) ASSERT i.term IS UNIQUE
CREATE CONSTRAINT ON (i:PrefixedCui) ASSERT i.term IS UNIQUE
CREATE CONSTRAINT ON (i:Datasource) ASSERT i.prefix IS UNIQUE
CREATE INDEX ON :Datasource(source)
CREATE INDEX ON :MAPPING(sourceName)
CREATE INDEX ON :MAPPING(scope)
Queries
Get direct xrefs for a term (show sources)
Match (u:Uri)-[r1:XREF]->(x:PrefixedCui)<-[r2:XREF]-(u1:Uri)
Where u.term = 'http://www.ebi.ac.uk/efo/EFO_0000349'
Return u1.term, collect (distinct r1.sourcePrefix) + collect(distinct r2.sourcePrefix)
Get derived xrefs (1 hop) - high score
term -> xref -> term -> xref
Get derived xrefs (4 hops) - low score
Get lexical mappings
- search zooma, get best hits, get high score mappings for those
Mapping project
1. Take HP, hit Zooma with each label, get ORDO hits.
2. Take HP, hit Zooma, with each id hit, get mappings to ordo.
MATCH (c:Identifier)-[*1..5]-(m:Uri)
WHERE c.term = 'HP:0000819'
WITH m as mappedUri
MATCH (mappedUri)-[:DATASOURCE]->(d:Datasource { prefix : 'ordo'})
WITH mappedUri as ordoUri
MATCH (ordoUri)-[ATLID]->(ordoP:PrefixedCui)
RETURN distinct ordoP.term
MATCH (source:Uri)-[DATASOURCE]->(d:Datasource { prefix : 'efo'})
WITH source
MATCH path = allShortestPaths ( (c:Identifier)-[:ALTID|:XREF*..10]-(source) )
WHERE c.term = 'DOID_4467'
RETURN distinct source.term , length(path) as dist
ORDER BY dist
// find a Uri
MATCH (i:Identifier)-[*0..1]-(u:Uri)
WHERE i.term = 'EFO_0000001'
RETURN u.term
// Use case
Given set of ids
1. Get all mappings (don't map to own datasource)
x1 mapped to y1 (1 sources)
x1 mapped to y2 (2 sources)
x1 mapped to z3 (2 sources) (inferred) (show)
2. Get mappings to ontology (e..g HP)
x1 mapped to y1 (1 sources)
x1 mapped to y2 (2 sources)
x1 mapped to z3 (2 sources) (inferred) (show)
3. Need ability to validate
4. Ability to add new mapping