|
120 | 120 | }, |
121 | 121 | { |
122 | 122 | "cell_type": "code", |
123 | | - "execution_count": 45, |
| 123 | + "execution_count": null, |
124 | 124 | "metadata": {}, |
125 | 125 | "outputs": [], |
126 | 126 | "source": [ |
|
135 | 135 | "import pronto\n", |
136 | 136 | "\n", |
137 | 137 | "# 3. Local application/library specific imports\n", |
138 | | - "from ontograph.downloader import download_file\n", |
139 | | - "import ontograph.constants as constants" |
| 138 | + "from ontograph._downloader import download_file\n", |
| 139 | + "import ontograph._constants as _constants" |
140 | 140 | ] |
141 | 141 | }, |
142 | 142 | { |
|
148 | 148 | }, |
149 | 149 | { |
150 | 150 | "cell_type": "code", |
151 | | - "execution_count": 2, |
| 151 | + "execution_count": null, |
152 | 152 | "metadata": {}, |
153 | | - "outputs": [ |
154 | | - { |
155 | | - "name": "stderr", |
156 | | - "output_type": "stream", |
157 | | - "text": [ |
158 | | - "Downloading data from 'https://purl.obolibrary.org/obo/go.obo' to file '/home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph/notebooks/cache/gene_ontology.obo'.\n", |
159 | | - "100%|█████████████████████████████████████| 35.1M/35.1M [00:00<00:00, 97.7GB/s]\n", |
160 | | - "SHA256 hash of downloaded file: 0908af70601dd41f2c55f664ca5d5959e939162362e9a5573c6794b5d850e601\n", |
161 | | - "Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.\n" |
162 | | - ] |
163 | | - }, |
164 | | - { |
165 | | - "name": "stdout", |
166 | | - "output_type": "stream", |
167 | | - "text": [ |
168 | | - "Gene Ontology OBO file cached at: /home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph/notebooks/cache/gene_ontology.obo\n" |
169 | | - ] |
170 | | - } |
171 | | - ], |
| 153 | + "outputs": [], |
172 | 154 | "source": [ |
173 | 155 | "CACHE_DIRECTORY = \"cache\"\n", |
174 | 156 | "\n", |
|
194 | 176 | }, |
195 | 177 | { |
196 | 178 | "cell_type": "code", |
197 | | - "execution_count": 76, |
| 179 | + "execution_count": null, |
198 | 180 | "metadata": {}, |
199 | 181 | "outputs": [], |
200 | 182 | "source": [ |
|
210 | 192 | }, |
211 | 193 | { |
212 | 194 | "cell_type": "code", |
213 | | - "execution_count": 75, |
| 195 | + "execution_count": null, |
214 | 196 | "metadata": {}, |
215 | 197 | "outputs": [], |
216 | 198 | "source": [ |
|
258 | 240 | }, |
259 | 241 | { |
260 | 242 | "cell_type": "code", |
261 | | - "execution_count": 77, |
| 243 | + "execution_count": null, |
262 | 244 | "metadata": {}, |
263 | | - "outputs": [ |
264 | | - { |
265 | | - "name": "stdout", |
266 | | - "output_type": "stream", |
267 | | - "text": [ |
268 | | - "Format_version: \n", |
269 | | - "\t1.2\n", |
270 | | - "Data_version: \n", |
271 | | - "\treleases/2025-06-01\n", |
272 | | - "Ontology_identifier: \n", |
273 | | - "\tgo\n", |
274 | | - "Last_update: \n", |
275 | | - "\tNone\n", |
276 | | - "Name: \n", |
277 | | - "\tGene Ontology\n", |
278 | | - "Description: \n", |
279 | | - "\tThe Gene Ontology (GO) provides a framework and set of concepts for describing the functions of gene products from all organisms.\n", |
280 | | - "License: \n", |
281 | | - "\thttp://creativecommons.org/licenses/by/4.0/\n", |
282 | | - "Roots: \n", |
283 | | - "\t['GO:0003674', 'GO:0005575', 'GO:0008150']\n" |
284 | | - ] |
285 | | - } |
286 | | - ], |
| 245 | + "outputs": [], |
287 | 246 | "source": [ |
288 | 247 | "print_metadata(gene_ontology)" |
289 | 248 | ] |
|
313 | 272 | "\n", |
314 | 273 | "Include citations for any external content or suggested resources for deeper learning." |
315 | 274 | ] |
| 275 | + }, |
| 276 | + { |
| 277 | + "cell_type": "code", |
| 278 | + "execution_count": null, |
| 279 | + "metadata": {}, |
| 280 | + "outputs": [], |
| 281 | + "source": [] |
| 282 | + }, |
| 283 | + { |
| 284 | + "cell_type": "code", |
| 285 | + "execution_count": null, |
| 286 | + "metadata": {}, |
| 287 | + "outputs": [ |
| 288 | + { |
| 289 | + "name": "stdout", |
| 290 | + "output_type": "stream", |
| 291 | + "text": [ |
| 292 | + "Added to sys.path: /home/edwin/SSC-Projects/b_REPOSITORIES/ontograph\n" |
| 293 | + ] |
| 294 | + } |
| 295 | + ], |
| 296 | + "source": [ |
| 297 | + "import sys\n", |
| 298 | + "import os\n", |
| 299 | + "\n", |
| 300 | + "# Get the absolute path to the parent folder (where both 'notebooks' and 'ontograph' live)\n", |
| 301 | + "project_root = os.path.abspath(os.path.join(os.getcwd(), \"..\"))\n", |
| 302 | + "\n", |
| 303 | + "# Insert at front of sys.path so it's prioritized\n", |
| 304 | + "sys.path.insert(0, project_root)\n", |
| 305 | + "\n", |
| 306 | + "print(\"Added to sys.path:\", project_root)" |
| 307 | + ] |
| 308 | + }, |
| 309 | + { |
| 310 | + "cell_type": "code", |
| 311 | + "execution_count": 3, |
| 312 | + "metadata": {}, |
| 313 | + "outputs": [ |
| 314 | + { |
| 315 | + "name": "stderr", |
| 316 | + "output_type": "stream", |
| 317 | + "text": [ |
| 318 | + "Downloading data from 'http://purl.obolibrary.org/obo/go.obo' to file '/home/edwin/.ontograph_cache/go.obo'.\n", |
| 319 | + "SHA256 hash of downloaded file: 0908af70601dd41f2c55f664ca5d5959e939162362e9a5573c6794b5d850e601\n", |
| 320 | + "Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.\n" |
| 321 | + ] |
| 322 | + }, |
| 323 | + { |
| 324 | + "name": "stdout", |
| 325 | + "output_type": "stream", |
| 326 | + "text": [ |
| 327 | + "{'name': 'go', 'version': 'releases/2025-06-01', 'format': '1.2'}\n" |
| 328 | + ] |
| 329 | + }, |
| 330 | + { |
| 331 | + "ename": "AttributeError", |
| 332 | + "evalue": "'Ontology' object has no attribute 'roots'", |
| 333 | + "output_type": "error", |
| 334 | + "traceback": [ |
| 335 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 336 | + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", |
| 337 | + "Cell \u001b[0;32mIn[3], line 7\u001b[0m\n\u001b[1;32m 4\u001b[0m gene_ontology \u001b[38;5;241m=\u001b[39m client\u001b[38;5;241m.\u001b[39mload(name_id\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgo\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mobo\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(gene_ontology\u001b[38;5;241m.\u001b[39mmetadata())\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28mprint\u001b[39m([root\u001b[38;5;241m.\u001b[39mid \u001b[38;5;28;01mfor\u001b[39;00m root \u001b[38;5;129;01min\u001b[39;00m \u001b[43mgene_ontology\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mroots\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m])\n", |
| 338 | + "File \u001b[0;32m~/SSC-Projects/b_REPOSITORIES/ontograph/ontograph/api/client.py:51\u001b[0m, in \u001b[0;36mOntologyWrapper.roots\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mroots\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 51\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43montology\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mroots\u001b[49m())\n", |
| 339 | + "\u001b[0;31mAttributeError\u001b[0m: 'Ontology' object has no attribute 'roots'" |
| 340 | + ] |
| 341 | + } |
| 342 | + ], |
| 343 | + "source": [ |
| 344 | + "from ontograph.api.client import OntologyClient\n", |
| 345 | + "\n", |
| 346 | + "client = OntologyClient()\n", |
| 347 | + "gene_ontology = client.load(name_id=\"go\", format=\"obo\")\n", |
| 348 | + "\n", |
| 349 | + "print(gene_ontology.metadata())\n", |
| 350 | + "print([root.id for root in gene_ontology.roots()])" |
| 351 | + ] |
| 352 | + }, |
| 353 | + { |
| 354 | + "cell_type": "code", |
| 355 | + "execution_count": null, |
| 356 | + "metadata": {}, |
| 357 | + "outputs": [], |
| 358 | + "source": [ |
| 359 | + "print(os.listdir(sys.path[0]))" |
| 360 | + ] |
| 361 | + }, |
| 362 | + { |
| 363 | + "cell_type": "code", |
| 364 | + "execution_count": null, |
| 365 | + "metadata": {}, |
| 366 | + "outputs": [], |
| 367 | + "source": [ |
| 368 | + "import ontograph.api.client\n", |
| 369 | + "\n", |
| 370 | + "\n", |
| 371 | + "ontograph.api." |
| 372 | + ] |
316 | 373 | } |
317 | 374 | ], |
318 | 375 | "metadata": { |
319 | 376 | "kernelspec": { |
320 | | - "display_name": "Python 3", |
| 377 | + "display_name": "ontograph", |
321 | 378 | "language": "python", |
322 | 379 | "name": "python3" |
323 | 380 | }, |
|
331 | 388 | "name": "python", |
332 | 389 | "nbconvert_exporter": "python", |
333 | 390 | "pygments_lexer": "ipython3", |
334 | | - "version": "3.10.12" |
| 391 | + "version": "3.10.18" |
335 | 392 | } |
336 | 393 | }, |
337 | 394 | "nbformat": 4, |
|
0 commit comments