Skip to content

Commit bb5d298

Browse files
fix: update notebook with suggestions given by ruff tool.
1 parent f09c7bd commit bb5d298

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

notebooks/quickstart_demo.ipynb

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,11 @@
129129
"# 1. Standard library imports\n",
130130
"import sys\n",
131131
"\n",
132-
"sys.path.append(\"/home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph\")\n",
132+
"sys.path.append('/home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph')\n",
133133
"\n",
134134
"from pathlib import Path\n",
135135
"\n",
136136
"# 2. Related third party imports\n",
137-
"import pronto\n",
138-
"\n",
139137
"# 3. Local application/library specific imports\n",
140138
"from ontograph.downloader import PoochDownloaderAdapter\n",
141139
"from ontograph.ontology_query import OntologyQueries\n",
@@ -158,7 +156,7 @@
158156
"metadata": {},
159157
"outputs": [],
160158
"source": [
161-
"cache_dir = Path(\"../data/out\")"
159+
"cache_dir = Path('../data/out')"
162160
]
163161
},
164162
{
@@ -224,7 +222,7 @@
224222
"metadata": {},
225223
"outputs": [],
226224
"source": [
227-
"for index, ontology in enumerate(onto_registry.list_available_ontologies()):\n",
225+
"for ontology in onto_registry.list_available_ontologies():\n",
228226
" print(ontology)"
229227
]
230228
},
@@ -243,7 +241,7 @@
243241
"source": [
244242
"# This function looks if the given ontology has a link with a given extension\n",
245243
"\n",
246-
"print(\"Link: {}\".format(onto_registry.get_download_url(\"chebi\", \"obo\")))"
244+
"print('Link: {}'.format(onto_registry.get_download_url('chebi', 'obo')))"
247245
]
248246
},
249247
{
@@ -259,7 +257,7 @@
259257
"metadata": {},
260258
"outputs": [],
261259
"source": [
262-
"print(onto_registry.get_available_formats(ontology_id=\"chebi\"))"
260+
"print(onto_registry.get_available_formats(ontology_id='chebi'))"
263261
]
264262
},
265263
{
@@ -303,18 +301,18 @@
303301
"source": [
304302
"# Put the ontologies and their formats as a dictionary\n",
305303
"resources = [\n",
306-
" {\"name_id\": \"chebi\", \"format\": \"owl\"},\n",
307-
" {\"name_id\": \"go\", \"format\": \"obo\"},\n",
308-
" {\"name_id\": \"ado\", \"format\": \"owl\"},\n",
304+
" {'name_id': 'chebi', 'format': 'owl'},\n",
305+
" {'name_id': 'go', 'format': 'obo'},\n",
306+
" {'name_id': 'ado', 'format': 'owl'},\n",
309307
"]\n",
310308
"\n",
311309
"# Use the downloader, it has a cache in case you have already downloaded the ontologies.\n",
312310
"batch_results = downloader.fetch_batch(resources)\n",
313311
"\n",
314312
"# Print all the paths where your ontologies are located\n",
315-
"print(\"Ontologies in cache:\")\n",
313+
"print('Ontologies in cache:')\n",
316314
"for ontology_name, ontology_path in batch_results.items():\n",
317-
" print(f\"\\t{ontology_name}: {ontology_path}\")"
315+
" print(f'\\t{ontology_name}: {ontology_path}')"
318316
]
319317
},
320318
{
@@ -353,13 +351,13 @@
353351
"metadata": {},
354352
"outputs": [],
355353
"source": [
356-
"name_id_go = \"go\"\n",
357-
"format_go = \"obo\"\n",
354+
"name_id_go = 'go'\n",
355+
"format_go = 'obo'\n",
358356
"\n",
359357
"gene_ontology = ontology_loader.load(name_id=name_id_go, format=format_go)\n",
360358
"\n",
361-
"print(f\"Loaded ontology: {name_id_go}.{format_go}\")\n",
362-
"print(f\"Number of terms: {len(gene_ontology.terms())}\")"
359+
"print(f'Loaded ontology: {name_id_go}.{format_go}')\n",
360+
"print(f'Number of terms: {len(gene_ontology.terms())}')"
363361
]
364362
},
365363
{
@@ -377,7 +375,7 @@
377375
"source": [
378376
"# term_id = \"GO:0008150\" # biological_process\n",
379377
"# term_id = \"GO:0160266\" # anestrus phase\n",
380-
"term_id = \"GO:0070360\" # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host"
378+
"term_id = 'GO:0070360' # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host"
381379
]
382380
},
383381
{
@@ -389,9 +387,9 @@
389387
"queries = OntologyQueries(gene_ontology)\n",
390388
"\n",
391389
"# Print term relations\n",
392-
"print(f\"Term: {term_id}\")\n",
393-
"print(f\" Parents : {queries.parents(term_id)}\")\n",
394-
"print(f\" Children : {queries.children(term_id)}\")\n",
390+
"print(f'Term: {term_id}')\n",
391+
"print(f' Parents : {queries.parents(term_id)}')\n",
392+
"print(f' Children : {queries.children(term_id)}')\n",
395393
"\n",
396394
"\n",
397395
"# print(f\" Ancestors : {queries.ancestors(term_id)}\")\n",

0 commit comments

Comments
 (0)