我有一个生成的csv文件,内容如下
GOID GOName
GO:0007190 activation of adenylate cyclase activity
DiseaseID DiseaseName
D058490 46 XY Disorders of Sex Development
D000172 Acromegaly
D049913 ACTH-Secreting,Pituitary Adenoma
D058186 Acute Kidney Injury
D000310 Adrenal Gland Neoplasms
D000312 Adrenal Hyperplasia Congenital
C537045 Albright's hereditary osteodystrophy
D000544 Alzheimer Disease
D019969 Amphetamine-Related Disorders
D000855 Anorexia
D000860 Anoxia
D001008 Anxiety Disorders
D001169 Arthritis Experimental
D001171 Arthritis Juvenile
D001172 Arthritis Rheumatoid
D001249 Asthma
D001254 Astrocytoma
等等。 我想通过疾病在GOID之间建立链接,以便一个疾病节点连接到两个或多个不同的GOID节点。
答案 0 :(得分:0)
CSV的关系如下所示:
goID,diseaseID
"GO:1234","D000456"
读取CSV并创建关系的命令如下所示:
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM "file:/D:/Relationships.csv" as line
MERGE (:Global {goID: line.goID})-[:RELATIONSHIP]->(:Disease {diseaseID: line.diseaseID})
加载数据后,您可以这样查询:
MATCH (g:Global {goID: "GO:0007190"})-[r:RELATIONSHIP]->(d:Disease)
return g, r, d
对于疾病具有多种全球状况的病例,您可以找到并建立如此关系:
match (d:Disease)
match (go1:GO)-[:RELATIONSHIP]->(d)
match (go2:GO)-[:RELATIONSHIP]->(d) where go2 <> go1
create (go1)-[:RELATIONSHIP]->(go2)
create (go2)-[:RELATIONSHIP]->(go1)
严格来说,您不需要双向关系,因此可以省略创建第二个关系。一个潜在的问题是,如果不止一种疾病将两种全球价值联系起来如果这是一个问题,那么在关系上设置“疾病”属性将有助于确定这些全局变量是如何相关的。