MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / main

Function main

examples/python/bindings/drug_discovery.py:35–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def main():
36 print("=== GraphLite SDK Drug Discovery Example ===\n")
37
38 # Step 1: Open database
39 print("1. Opening database...")
40 db_path = "./drug_discovery_python_db"
41
42 # Clean up old database if exists
43 if os.path.exists(db_path):
44 shutil.rmtree(db_path)
45
46 try:
47 db = GraphLite(db_path)
48 print(" ✓ Database opened\n")
49
50 # Step 2: Create session
51 print("2. Creating session...")
52 session = db.create_session("researcher")
53 print(" ✓ Session created\n")
54
55 # Step 3: Setup schema and graph
56 print("3. Setting up schema and graph...")
57 db.execute(session, "CREATE SCHEMA IF NOT EXISTS /drug_discovery")
58 db.execute(session, "SESSION SET SCHEMA /drug_discovery")
59 db.execute(session, "CREATE GRAPH IF NOT EXISTS pharma_research")
60 db.execute(session, "SESSION SET GRAPH pharma_research")
61 print(" ✓ Schema and graph configured\n")
62
63 # Step 4: Insert data
64 print("4. Inserting pharmaceutical data...")
65
66 # Insert Proteins (Disease Targets)
67 print(" → Inserting target proteins...")
68 db.execute(session, """INSERT
69 (:Protein {
70 id: 'TP53',
71 name: 'Tumor Protein P53',
72 disease: 'Cancer',
73 function: 'Tumor suppressor',
74 gene_location: '17p13.1'
75 }),
76 (:Protein {
77 id: 'EGFR',
78 name: 'Epidermal Growth Factor Receptor',
79 disease: 'Cancer',
80 function: 'Cell growth and division',
81 gene_location: '7p11.2'
82 }),
83 (:Protein {
84 id: 'ACE2',
85 name: 'Angiotensin-Converting Enzyme 2',
86 disease: 'Hypertension',
87 function: 'Blood pressure regulation',
88 gene_location: 'Xp22.2'
89 }),
90 (:Protein {
91 id: 'BACE1',
92 name: 'Beta-Secretase 1',

Callers 1

drug_discovery.pyFile · 0.70

Calls 7

create_sessionMethod · 0.95
executeMethod · 0.95
queryMethod · 0.95
close_sessionMethod · 0.95
closeMethod · 0.95
GraphLiteClass · 0.90
existsMethod · 0.45

Tested by

no test coverage detected