{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "!pip install -r ../../../requirements.txt --quiet\n", "!pip install ../../../ --quiet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# VFBTerm DataSet Methods\n", "This notebook demonstrates the usage of the `vfb.term` and `vfb.terms` methods for accessing VFB term information.\n", "We'll explore how to create `VFBTerm` objects, access related terms, images, and use advanced features like lazy loading of parents and manipulating collections of terms with `VFBTerms`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Welcome to the \u001b[36mVirtual Fly Brain\u001b[0m API\n", "See the documentation at: https://virtualflybrain.org/docs/tutorials/apis/\n", "\n", "\u001b[32mEstablishing connections to https://VirtualFlyBrain.org services...\u001b[0m\n", "\u001b[32mSession Established!\u001b[0m\n", "\n", "\u001b[33mType \u001b[35mvfb. \u001b[33mand press \u001b[35mtab\u001b[33m to see available queries. You can run help against any query e.g. \u001b[35mhelp(vfb.terms)\u001b[0m\n" ] } ], "source": [ "# Import the VFBConnect class\n", "from vfb_connect import vfb\n", "import os\n", "\n", "# Configure VFB for CI/notebook execution performance\n", "vfb._load_limit = int(os.getenv('VFB_LOAD_LIMIT', 20)) # limit to 20 results for brevity, can be overridden in CI\n", "if os.getenv('VFB_CACHE_ENABLED', 'false').lower() == 'true':\n", " vfb._use_cache = True\n", "\n", "print(f\"VFB load limit set to: {vfb._load_limit}\") " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating and Exploring VFBTerm DataSet Objects\n", "We'll start by creating a `VFBTerm` object using the `vfb.term` method." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "VFBTerm(term=Term(term=MinimalEntityInfo(name=EM FAFB Engert et al. 2022, short_form=Engert2022), link=https://n2t.net/vfb:Engert2022))" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Example of creating a VFBTerm object using a term name\n", "vfb_dataset = vfb.term('EM FAFB Engert et al. 2022')\n", "vfb_dataset" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | ID | \n", "Name | \n", "Description | \n", "URL | \n", "Counts | \n", "Publications | \n", "License | \n", "Cross References | \n", "
|---|---|---|---|---|---|---|---|---|
| 0 | \n", "Engert2022 | \n", "EM FAFB Engert et al. 2022 | \n", "FAFB EM reconstructed neurons from Engert et a... | \n", "https://n2t.net/vfb:Engert2022 | \n", "{'images': 144, 'types': 5} | \n", "[Engert et al., 2022, eLife 11: e78110] | \n", "CC-BY_4.0 | \n", "[https://fafb.catmaid.virtualflybrain.org/?pid... | \n", "