-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_knowledge_graph.py
58 lines (49 loc) · 1.43 KB
/
create_knowledge_graph.py
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
from biocypher import BioCypher, Resource
from cbioportal.adapters.node_field_classes import *
from cbioportal.adapters.edge_field_classes import *
from cbioportal.adapters.cbioportal_adapter import CBioPortalAdapter
# Instantiate the BioCypher interface
# You can use `config/biocypher_config.yaml` to configure the framework or
# supply settings via parameters below
bc = BioCypher()
node_types = [
MutationField,
MolecularProfileField,
# SampleListField,
# ClinicalAttributesField,
GeneField,
# GenePanelField,
# CancerTypeField,
StudyField,
PatientField,
SampleField,
]
edge_types = [
# SampleListToStudyField,
# StudyToClinicalDataField,
# MolecularProfiletoStudyField,
# DiseaseDiseaseAssociationField,
# StudyDiseaseAssociationField,
# studyPatientAssociationField,
# samplePatientAssociationField,
mutationToMolecularProfileField,
mutationToSampleField,
mutationToGeneField,
mutationToStudyField,
mutationToPatientField
]
# Create a protein adapter instance
adapter = CBioPortalAdapter(
node_types=node_types,
edge_types=edge_types,
limit=None
)
# adapter.get_data_from_api("test")
# quit()
# Create a knowledge graph from the adapter
bc.write_nodes(adapter.get_nodes())
bc.write_edges(adapter.get_edges())
# Write admin import statement
bc.write_import_call()
# Print summary
bc.summary()