Skip to content

Commit a4626e7

Browse files
committed
added instructions on initial query
1 parent c9f4a1e commit a4626e7

1 file changed

Lines changed: 47 additions & 12 deletions

File tree

‎notebooks/setting_up_ui.ipynb‎

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"source": [
8383
"node_schema = []\n",
8484
"node_pattern = \"(?P<directory>.+)/(?P<label>.+)\\.(?P<entity>.+)\\.csv\"\n",
85-
"for filename in glob(\"csv/*.nodes.csv\"):\n",
85+
"for filename in glob(\"csv_jakleen/*.nodes.csv\"):\n",
8686
" match = re.match(node_pattern, filename).groupdict()\n",
8787
" label = match[\"label\"].replace(\"_\", \" \")\n",
8888
" df = pd.read_csv(filename)\n",
@@ -185,7 +185,7 @@
185185
"edge_schema = []\n",
186186
"edge_pattern = \"(?P<directory>.+)/(?P<source_type>.+)\\.(?P<relation>.+)\\.(?P<target_type>.+)\\.(?P<entity>.+)\\.csv\"\n",
187187
"\n",
188-
"for filename in glob(\"csv/*.edges.csv\"):\n",
188+
"for filename in glob(\"csv_jakleen/*.edges.csv\"):\n",
189189
" match = re.match(edge_pattern, filename).groupdict()\n",
190190
" entity = match[\"entity\"]\n",
191191
" source_type = match[\"source_type\"]\n",
@@ -223,6 +223,26 @@
223223
" "
224224
]
225225
},
226+
{
227+
"cell_type": "code",
228+
"execution_count": 4,
229+
"metadata": {},
230+
"outputs": [
231+
{
232+
"data": {
233+
"text/plain": [
234+
"2"
235+
]
236+
},
237+
"execution_count": 4,
238+
"metadata": {},
239+
"output_type": "execute_result"
240+
}
241+
],
242+
"source": [
243+
"len(edge_schema)"
244+
]
245+
},
226246
{
227247
"attachments": {},
228248
"cell_type": "markdown",
@@ -242,11 +262,26 @@
242262
},
243263
{
244264
"cell_type": "code",
245-
"execution_count": 4,
265+
"execution_count": null,
246266
"metadata": {},
247267
"outputs": [],
248268
"source": [
249-
"title = \"Enrichr-KG\"\n",
269+
"# First you need to modify this based on your dataset. \n",
270+
"# This will be the initial query that the users will see when visiting your site\n",
271+
"initial_query = {\n",
272+
"\t\"start\": \"Gene\",\n",
273+
"\t\"start_term\": \"APOE\",\n",
274+
"\t\"start_field\": \"label\"\n",
275+
"}"
276+
]
277+
},
278+
{
279+
"cell_type": "code",
280+
"execution_count": 5,
281+
"metadata": {},
282+
"outputs": [],
283+
"source": [
284+
"title = \"Demo-KG\"\n",
250285
"icon = \"https://minio.dev.maayanlab.cloud/enrichr-kg/enrichr-kg.png\"\n",
251286
"rest = {\n",
252287
" \"header\": {\n",
@@ -273,11 +308,7 @@
273308
"\t\t\t\t\"component\": \"KnowledgeGraph\",\n",
274309
"\t\t\t\t\"props\": {\n",
275310
"\t\t\t\t\t\"init_function\": \"initialize_kg\",\n",
276-
"\t\t\t\t\t\"initial_query\": {\n",
277-
"\t\t\t\t\t\t\"start\": \"Gene\",\n",
278-
"\t\t\t\t\t\t\"start_term\": \"APOE\",\n",
279-
"\t\t\t\t\t\t\"start_field\": \"label\"\n",
280-
"\t\t\t\t\t},\n",
311+
"\t\t\t\t\t\"initial_query\": initial_query,\n",
281312
"\t\t\t\t\t\"subheader\": {\n",
282313
"\t\t\t\t\t\t\"url_field\": \"filter\",\n",
283314
"\t\t\t\t\t\t\"query_field\": \"relation\"\n",
@@ -356,7 +387,7 @@
356387
},
357388
{
358389
"cell_type": "code",
359-
"execution_count": 5,
390+
"execution_count": 6,
360391
"metadata": {},
361392
"outputs": [],
362393
"source": [
@@ -366,7 +397,7 @@
366397
" **rest\n",
367398
"}\n",
368399
"\n",
369-
"with open(\"../schema.json\", 'w') as o:\n",
400+
"with open(\"../schema_sample.json\", 'w') as o:\n",
370401
" o.write(json.dumps(schema, indent=4))"
371402
]
372403
},
@@ -480,7 +511,11 @@
480511
"docker-compose up\n",
481512
"```\n",
482513
"you can check http://localhost:3000 again\n",
483-
"\n"
514+
"\n",
515+
"```\n",
516+
"# push to dockerhub\n",
517+
"docker-compose push kg\n",
518+
"```"
484519
]
485520
},
486521
{

0 commit comments

Comments
 (0)