diff --git a/docs/source/tutorials/discovery.ipynb b/docs/source/tutorials/discovery.ipynb index 335ff135..b2d2cf65 100644 --- a/docs/source/tutorials/discovery.ipynb +++ b/docs/source/tutorials/discovery.ipynb @@ -31,103 +31,114 @@ "name": "stdout", "output_type": "stream", "text": [ - "Requirement already satisfied: vfb-connect in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (1.2.12.dev34+0ddbd15.dirty)\n", "Collecting vfb-connect\n", - " Obtaining dependency information for vfb-connect from https://files.pythonhosted.org/packages/d8/d7/0c7d60d7af8a1f7afc81d46d5805e501721fec36c3b4f726ae958f8671c9/vfb_connect-1.2.12-py3-none-any.whl.metadata\n", - " Downloading vfb_connect-1.2.12-py3-none-any.whl.metadata (2.7 kB)\n", - "Requirement already satisfied: requests in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from vfb-connect) (2.28.2)\n", - "Requirement already satisfied: pandas in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from vfb-connect) (1.3.5)\n", - "Requirement already satisfied: jsonpath-rw in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from vfb-connect) (1.4.0)\n", - "Requirement already satisfied: ply in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from jsonpath-rw->vfb-connect) (3.11)\n", - "Requirement already satisfied: decorator in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from jsonpath-rw->vfb-connect) (5.1.1)\n", - "Requirement already satisfied: six in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from jsonpath-rw->vfb-connect) (1.16.0)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pandas->vfb-connect) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pandas->vfb-connect) (2022.7.1)\n", - "Requirement already satisfied: numpy>=1.17.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pandas->vfb-connect) (1.21.6)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests->vfb-connect) (3.1.0)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests->vfb-connect) (3.4)\n", - "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests->vfb-connect) (1.26.15)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests->vfb-connect) (2022.12.7)\n", - "Downloading vfb_connect-1.2.12-py3-none-any.whl (39 kB)\n", - "Installing collected packages: vfb-connect\n", - " Attempting uninstall: vfb-connect\n", - " Found existing installation: vfb-connect 1.2.12.dev34+0ddbd15.dirty\n", - " Uninstalling vfb-connect-1.2.12.dev34+0ddbd15.dirty:\n", - " Successfully uninstalled vfb-connect-1.2.12.dev34+0ddbd15.dirty\n", - "Successfully installed vfb-connect-1.2.12\n", - "Requirement already satisfied: python-catmaid in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (2.0.4)\n", + " Downloading vfb_connect-1.2.20-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.3/40.3 kB\u001b[0m \u001b[31m660.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting jsonpath-rw\n", + " Using cached jsonpath-rw-1.4.0.tar.gz (13 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25ldone\n", + "\u001b[?25hRequirement already satisfied: pandas in /usr/local/anaconda3/lib/python3.10/site-packages (from vfb-connect) (1.5.3)\n", + "Requirement already satisfied: requests in /usr/local/anaconda3/lib/python3.10/site-packages (from vfb-connect) (2.28.1)\n", + "Requirement already satisfied: ply in /usr/local/anaconda3/lib/python3.10/site-packages (from jsonpath-rw->vfb-connect) (3.11)\n", + "Requirement already satisfied: decorator in /usr/local/anaconda3/lib/python3.10/site-packages (from jsonpath-rw->vfb-connect) (5.1.1)\n", + "Requirement already satisfied: six in /usr/local/anaconda3/lib/python3.10/site-packages (from jsonpath-rw->vfb-connect) (1.16.0)\n", + "Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from pandas->vfb-connect) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from pandas->vfb-connect) (2022.7)\n", + "Requirement already satisfied: numpy>=1.21.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from pandas->vfb-connect) (1.23.5)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests->vfb-connect) (3.4)\n", + "Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests->vfb-connect) (2.0.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests->vfb-connect) (2022.12.7)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests->vfb-connect) (1.26.14)\n", + "Building wheels for collected packages: jsonpath-rw\n", + " Building wheel for jsonpath-rw (setup.py) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for jsonpath-rw: filename=jsonpath_rw-1.4.0-py3-none-any.whl size=15127 sha256=abf2d409614383e35e5fd996e242843b10dd2432cf44d533c03dcc69fe300187\n", + " Stored in directory: /Users/robbiecourt/Library/Caches/pip/wheels/a6/83/8a/37ed5f4a4450482bef0f3a2960ddb304411aa09bcf213a1c6e\n", + "Successfully built jsonpath-rw\n", + "Installing collected packages: jsonpath-rw, vfb-connect\n", + "Successfully installed jsonpath-rw-1.4.0 vfb-connect-1.2.20\n", "Collecting python-catmaid\n", - " Downloading python_catmaid-2.4.0-py3-none-any.whl (177 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m177.5/177.5 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", - "\u001b[?25hCollecting navis>=1.0.0 (from python-catmaid)\n", - " Downloading navis-1.4.0-py3-none-any.whl (2.4 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m5.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: numpy>=1.16.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (1.21.6)\n", - "Requirement already satisfied: networkx>=2.4 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (2.6.3)\n", - "Requirement already satisfied: pandas>=1.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (1.3.5)\n", - "Requirement already satisfied: requests-futures>=0.9.9 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (1.0.0)\n", - "Requirement already satisfied: requests>=2.21.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (2.28.2)\n", - "Requirement already satisfied: setuptools>=41.0.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (58.2.0)\n", - "Requirement already satisfied: scipy>=1.3.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (1.7.1)\n", - "Requirement already satisfied: six>=1.11.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (1.16.0)\n", - "Requirement already satisfied: tqdm>=4.50.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (4.62.3)\n", - "Requirement already satisfied: psutil>=5.4.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from python-catmaid) (5.8.0)\n", - "Requirement already satisfied: h5py>=3.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (3.4.0)\n", - "Requirement already satisfied: matplotlib>=3.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (3.4.3)\n", - "Requirement already satisfied: morphops>=0.1.11 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.1.12)\n", - "Collecting ncollpyde>=0.18 (from navis>=1.0.0->python-catmaid)\n", + " Using cached python_catmaid-2.4.0-py3-none-any.whl (177 kB)\n", + "Requirement already satisfied: psutil>=5.4.3 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (5.9.0)\n", + "Requirement already satisfied: six>=1.11.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (1.16.0)\n", + "Requirement already satisfied: setuptools>=41.0.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (65.6.3)\n", + "Requirement already satisfied: scipy>=1.3.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (1.10.0)\n", + "Requirement already satisfied: numpy>=1.16.3 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (1.23.5)\n", + "Collecting navis>=1.0.0\n", + " Downloading navis-1.6.0-py3-none-any.whl (2.4 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m7.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: tqdm>=4.50.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (4.64.1)\n", + "Requirement already satisfied: pandas>=1.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (1.5.3)\n", + "Collecting requests-futures>=0.9.9\n", + " Downloading requests_futures-1.0.1-py2.py3-none-any.whl (7.6 kB)\n", + "Requirement already satisfied: requests>=2.21.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (2.28.1)\n", + "Requirement already satisfied: networkx>=2.4 in /usr/local/anaconda3/lib/python3.10/site-packages (from python-catmaid) (2.8.4)\n", + "Collecting rdata>=0.5\n", + " Downloading rdata-0.11.2-py3-none-any.whl (46 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.5/46.5 kB\u001b[0m \u001b[31m854.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting ncollpyde>=0.18\n", " Using cached ncollpyde-0.19.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (540 kB)\n", - "Requirement already satisfied: pint>=0.10 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.17)\n", - "Requirement already satisfied: plotly>=4.9 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (5.3.1)\n", - "Requirement already satisfied: pynrrd>=0.4.2 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.4.2)\n", - "Requirement already satisfied: pypng>=0.0.18 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.0.21)\n", - "Requirement already satisfied: seaborn>=0.10 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.11.2)\n", - "Requirement already satisfied: typing-extensions>=3.7.4 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (4.5.0)\n", - "Requirement already satisfied: trimesh>=3.8 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (3.9.32)\n", - "Requirement already satisfied: fuzzywuzzy>=0.18 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.18.0)\n", - "Requirement already satisfied: molesq>=0.2.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.4.0)\n", - "Requirement already satisfied: rdata>=0.5 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (0.5)\n", - "Collecting igraph!=0.10.0,!=0.10.1 (from navis>=1.0.0->python-catmaid)\n", - " Obtaining dependency information for igraph!=0.10.0,!=0.10.1 from https://files.pythonhosted.org/packages/40/d6/7ae77b847631bedac753db9040ac1d230bd9405ad3a9d0b2ded66e1a8c15/igraph-0.10.8-cp37-cp37m-macosx_10_9_x86_64.whl.metadata\n", - " Downloading igraph-0.10.8-cp37-cp37m-macosx_10_9_x86_64.whl.metadata (3.8 kB)\n", - "Requirement already satisfied: skeletor>=1.0.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from navis>=1.0.0->python-catmaid) (1.1.0)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pandas>=1.0->python-catmaid) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pandas>=1.0->python-catmaid) (2022.7.1)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests>=2.21.0->python-catmaid) (3.1.0)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests>=2.21.0->python-catmaid) (3.4)\n", - "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests>=2.21.0->python-catmaid) (1.26.15)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from requests>=2.21.0->python-catmaid) (2022.12.7)\n", - "Requirement already satisfied: cached-property in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from h5py>=3.1->navis>=1.0.0->python-catmaid) (1.5.2)\n", - "Requirement already satisfied: texttable>=1.6.2 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from igraph!=0.10.0,!=0.10.1->navis>=1.0.0->python-catmaid) (1.6.4)\n", - "Requirement already satisfied: cycler>=0.10 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from matplotlib>=3.3->navis>=1.0.0->python-catmaid) (0.10.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from matplotlib>=3.3->navis>=1.0.0->python-catmaid) (1.3.2)\n", - "Requirement already satisfied: pillow>=6.2.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from matplotlib>=3.3->navis>=1.0.0->python-catmaid) (8.3.2)\n", - "Requirement already satisfied: pyparsing>=2.2.1 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from matplotlib>=3.3->navis>=1.0.0->python-catmaid) (2.4.7)\n", - "Requirement already satisfied: packaging in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pint>=0.10->navis>=1.0.0->python-catmaid) (23.0)\n", - "Requirement already satisfied: importlib-metadata in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from pint>=0.10->navis>=1.0.0->python-catmaid) (4.8.1)\n", - "Requirement already satisfied: tenacity>=6.2.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from plotly>=4.9->navis>=1.0.0->python-catmaid) (8.0.1)\n", - "Requirement already satisfied: xarray in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from rdata>=0.5->navis>=1.0.0->python-catmaid) (0.19.0)\n", - "Requirement already satisfied: scikit-learn>=0.23 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (1.0)\n", - "Requirement already satisfied: python-igraph>=0.8 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (0.9.6)\n", - "Requirement already satisfied: joblib>=0.11 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from scikit-learn>=0.23->skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (1.0.1)\n", - "Requirement already satisfied: threadpoolctl>=2.0.0 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from scikit-learn>=0.23->skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (3.0.0)\n", - "Requirement already satisfied: zipp>=0.5 in /Users/robbiecourt/.pyenv/versions/3.7.5/lib/python3.7/site-packages (from importlib-metadata->pint>=0.10->navis>=1.0.0->python-catmaid) (3.6.0)\n", - "Downloading igraph-0.10.8-cp37-cp37m-macosx_10_9_x86_64.whl (1.9 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.9/1.9 MB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n", - "\u001b[?25hInstalling collected packages: ncollpyde, igraph, navis, python-catmaid\n", - " Attempting uninstall: ncollpyde\n", - " Found existing installation: ncollpyde 0.16.0\n", - " Uninstalling ncollpyde-0.16.0:\n", - " Successfully uninstalled ncollpyde-0.16.0\n", - " Attempting uninstall: navis\n", - " Found existing installation: navis 0.6.0\n", - " Uninstalling navis-0.6.0:\n", - " Successfully uninstalled navis-0.6.0\n", - " Attempting uninstall: python-catmaid\n", - " Found existing installation: python-catmaid 2.0.4\n", - " Uninstalling python-catmaid-2.0.4:\n", - " Successfully uninstalled python-catmaid-2.0.4\n", - "Successfully installed igraph-0.10.8 navis-1.4.0 ncollpyde-0.19.0 python-catmaid-2.4.0\n" + "Requirement already satisfied: matplotlib>=3.6 in /usr/local/anaconda3/lib/python3.10/site-packages (from navis>=1.0.0->python-catmaid) (3.7.0)\n", + "Requirement already satisfied: h5py>=3.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from navis>=1.0.0->python-catmaid) (3.7.0)\n", + "Collecting fuzzywuzzy>=0.18\n", + " Using cached fuzzywuzzy-0.18.0-py2.py3-none-any.whl (18 kB)\n", + "Collecting igraph!=0.10.0,!=0.10.1\n", + " Downloading igraph-0.11.6-cp39-abi3-macosx_10_9_x86_64.whl (1.9 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.9/1.9 MB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hCollecting morphops>=0.1.11\n", + " Using cached morphops-0.1.13-py3-none-any.whl (23 kB)\n", + "Requirement already satisfied: plotly>=4.9 in /usr/local/anaconda3/lib/python3.10/site-packages (from navis>=1.0.0->python-catmaid) (5.9.0)\n", + "Collecting pint>=0.10\n", + " Downloading Pint-0.24.3-py3-none-any.whl (301 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m301.8/301.8 kB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hCollecting molesq>=0.2.0\n", + " Using cached molesq-0.4.0-py3-none-any.whl (6.9 kB)\n", + "Collecting pynrrd>=0.4.2\n", + " Using cached pynrrd-1.0.0-py2.py3-none-any.whl (19 kB)\n", + "Collecting skeletor>=1.0.0\n", + " Downloading skeletor-1.3.0-py3-none-any.whl (208 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m208.6/208.6 kB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting trimesh>=3.8\n", + " Downloading trimesh-4.4.4-py3-none-any.whl (696 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m696.3/696.3 kB\u001b[0m \u001b[31m8.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: seaborn>=0.10 in /usr/local/anaconda3/lib/python3.10/site-packages (from navis>=1.0.0->python-catmaid) (0.12.2)\n", + "Requirement already satisfied: typing-extensions>=3.7.4 in /usr/local/anaconda3/lib/python3.10/site-packages (from navis>=1.0.0->python-catmaid) (4.4.0)\n", + "Collecting pypng>=0.0.18\n", + " Using cached pypng-0.20220715.0-py3-none-any.whl (58 kB)\n", + "Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from pandas>=1.0->python-catmaid) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from pandas>=1.0->python-catmaid) (2022.7)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests>=2.21.0->python-catmaid) (3.4)\n", + "Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests>=2.21.0->python-catmaid) (2.0.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests>=2.21.0->python-catmaid) (2022.12.7)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from requests>=2.21.0->python-catmaid) (1.26.14)\n", + "Collecting texttable>=1.6.2\n", + " Downloading texttable-1.7.0-py2.py3-none-any.whl (10 kB)\n", + "Requirement already satisfied: pillow>=6.2.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (9.4.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (3.0.9)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (1.0.5)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (4.25.0)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (0.11.0)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (22.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from matplotlib>=3.6->navis>=1.0.0->python-catmaid) (1.4.4)\n", + "Collecting flexparser>=0.3\n", + " Downloading flexparser-0.3.1-py3-none-any.whl (27 kB)\n", + "Collecting flexcache>=0.3\n", + " Downloading flexcache-0.3-py3-none-any.whl (13 kB)\n", + "Requirement already satisfied: appdirs>=1.4.4 in /usr/local/anaconda3/lib/python3.10/site-packages (from pint>=0.10->navis>=1.0.0->python-catmaid) (1.4.4)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from plotly>=4.9->navis>=1.0.0->python-catmaid) (8.0.1)\n", + "Collecting nptyping\n", + " Using cached nptyping-2.5.0-py3-none-any.whl (37 kB)\n", + "Requirement already satisfied: xarray in /usr/local/anaconda3/lib/python3.10/site-packages (from rdata>=0.5->navis>=1.0.0->python-catmaid) (2022.11.0)\n", + "Collecting typing-extensions>=3.7.4\n", + " Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)\n", + "Requirement already satisfied: scikit-learn>=0.23 in /usr/local/anaconda3/lib/python3.10/site-packages (from skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (1.2.1)\n", + "Requirement already satisfied: joblib>=1.1.1 in /usr/local/anaconda3/lib/python3.10/site-packages (from scikit-learn>=0.23->skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (1.1.1)\n", + "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/anaconda3/lib/python3.10/site-packages (from scikit-learn>=0.23->skeletor>=1.0.0->navis>=1.0.0->python-catmaid) (2.2.0)\n", + "Installing collected packages: texttable, pypng, fuzzywuzzy, typing-extensions, trimesh, nptyping, ncollpyde, igraph, requests-futures, pynrrd, morphops, molesq, flexparser, flexcache, skeletor, pint, rdata, navis, python-catmaid\n", + " Attempting uninstall: typing-extensions\n", + " Found existing installation: typing_extensions 4.4.0\n", + " Uninstalling typing_extensions-4.4.0:\n", + " Successfully uninstalled typing_extensions-4.4.0\n", + "Successfully installed flexcache-0.3 flexparser-0.3.1 fuzzywuzzy-0.18.0 igraph-0.11.6 molesq-0.4.0 morphops-0.1.13 navis-1.6.0 ncollpyde-0.19.0 nptyping-2.5.0 pint-0.24.3 pynrrd-1.0.0 pypng-0.20220715.0 python-catmaid-2.4.0 rdata-0.11.2 requests-futures-1.0.1 skeletor-1.3.0 texttable-1.7.0 trimesh-4.4.4 typing-extensions-4.12.2\n" ] } ], @@ -219,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "metadata": { "cell_id": "00002-0f08c5a1-913b-4a33-be18-d83db2c4809b", "deepnote_cell_type": "code", @@ -233,177 +244,83 @@ "outputs": [ { "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
labelsymbolidtagsparents_labelparents_iddata_sourceaccessiontemplatesdatasetlicense
0DSKMP1A(PVM02)_L (FlyEM-HB:1260833150)1260833150VFB_jrchjti3Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point11260833150JRC_FlyEM_Hemibrain|JRC2018UnisexXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
1DSKMP3_R (FlyEM-HB:327937328)327937328VFB_jrchjti6Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point1327937328JRC_FlyEM_Hemibrain|JRC2018UnisexXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
2DSKMP3_R (FlyEM-HB:328559607)328559607VFB_jrchjti7Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point1328559607JRC_FlyEM_Hemibrain|JRC2018UnisexXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
3DSKMP1A_R (FlyEM-HB:1135837629)1135837629VFB_jrchjti2Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point11135837629JRC2018Unisex|JRC_FlyEM_HemibrainXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
4DSKMP1B_R (FlyEM-HB:1352077058)1352077058VFB_jrchjti4Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point11352077058JRC_FlyEM_Hemibrain|JRC2018UnisexXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
5DSKMP1B(PVM02)_L (FlyEM-HB:1011184205)1011184205VFB_jrchjti5Entity|Adult|Anatomy|Cell|Individual|Nervous_s...adult Drosulfakinin neuronFBbt_00048999neuprint_JRC_Hemibrain_1point11011184205JRC_FlyEM_Hemibrain|JRC2018UnisexXu2020NeuronsV1point1https://creativecommons.org/licenses/by/4.0/le...
\n", - "
" - ], "text/plain": [ - " label symbol id \\\n", - "0 DSKMP1A(PVM02)_L (FlyEM-HB:1260833150) 1260833150 VFB_jrchjti3 \n", - "1 DSKMP3_R (FlyEM-HB:327937328) 327937328 VFB_jrchjti6 \n", - "2 DSKMP3_R (FlyEM-HB:328559607) 328559607 VFB_jrchjti7 \n", - "3 DSKMP1A_R (FlyEM-HB:1135837629) 1135837629 VFB_jrchjti2 \n", - "4 DSKMP1B_R (FlyEM-HB:1352077058) 1352077058 VFB_jrchjti4 \n", - "5 DSKMP1B(PVM02)_L (FlyEM-HB:1011184205) 1011184205 VFB_jrchjti5 \n", - "\n", - " tags \\\n", - "0 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "1 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "2 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "3 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "4 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "5 Entity|Adult|Anatomy|Cell|Individual|Nervous_s... \n", - "\n", - " parents_label parents_id data_source \\\n", - "0 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "1 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "2 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "3 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "4 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "5 adult Drosulfakinin neuron FBbt_00048999 neuprint_JRC_Hemibrain_1point1 \n", - "\n", - " accession templates dataset \\\n", - "0 1260833150 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 \n", - "1 327937328 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 \n", - "2 328559607 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 \n", - "3 1135837629 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 \n", - "4 1352077058 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 \n", - "5 1011184205 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 \n", - "\n", - " license \n", - "0 https://creativecommons.org/licenses/by/4.0/le... \n", - "1 https://creativecommons.org/licenses/by/4.0/le... \n", - "2 https://creativecommons.org/licenses/by/4.0/le... \n", - "3 https://creativecommons.org/licenses/by/4.0/le... \n", - "4 https://creativecommons.org/licenses/by/4.0/le... \n", - "5 https://creativecommons.org/licenses/by/4.0/le... " + "[{'label': 'DSKMP1A_R (FlyEM-HB:1135837629)',\n", + " 'symbol': 'DSKMP1A_R',\n", + " 'id': 'VFB_jrchjti2',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Individual|Nervous_system|Neuron|Octopaminergic|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|neuronbridge',\n", + " 'parents_label': 'adult octopaminergic neuron|adult Drosulfakinin MP1a neuron',\n", + " 'parents_id': 'FBbt_00058203|FBbt_00051433',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '1135837629',\n", + " 'templates': 'JRC2018Unisex|JRC_FlyEM_Hemibrain',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'},\n", + " {'label': 'DSKMP1A(PVM02)_L (FlyEM-HB:1260833150)',\n", + " 'symbol': 'DSKMP1A(PVM02)_L',\n", + " 'id': 'VFB_jrchjti3',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Individual|Nervous_system|Neuron|Octopaminergic|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|neuronbridge',\n", + " 'parents_label': 'adult Drosulfakinin MP1a neuron|adult octopaminergic neuron',\n", + " 'parents_id': 'FBbt_00051433|FBbt_00058203',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '1260833150',\n", + " 'templates': 'JRC_FlyEM_Hemibrain|JRC2018Unisex',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'},\n", + " {'label': 'DSKMP1B_R (FlyEM-HB:1352077058)',\n", + " 'symbol': 'DSKMP1B_R',\n", + " 'id': 'VFB_jrchjti4',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Individual|Nervous_system|Neuron|Octopaminergic|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|neuronbridge',\n", + " 'parents_label': 'adult octopaminergic neuron|adult Drosulfakinin MP1b neuron',\n", + " 'parents_id': 'FBbt_00058203|FBbt_00051434',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '1352077058',\n", + " 'templates': 'JRC2018Unisex|JRC_FlyEM_Hemibrain',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'},\n", + " {'label': 'DSKMP1B(PVM02)_L (FlyEM-HB:1011184205)',\n", + " 'symbol': 'DSKMP1B(PVM02)_L',\n", + " 'id': 'VFB_jrchjti5',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Individual|Nervous_system|Neuron|Octopaminergic|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|neuronbridge',\n", + " 'parents_label': 'adult Drosulfakinin MP1b neuron|adult octopaminergic neuron',\n", + " 'parents_id': 'FBbt_00051434|FBbt_00058203',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '1011184205',\n", + " 'templates': 'JRC_FlyEM_Hemibrain|JRC2018Unisex',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'},\n", + " {'label': 'DSKMP3_R (FlyEM-HB:328559607)',\n", + " 'symbol': 'DSKMP3_R',\n", + " 'id': 'VFB_jrchjti7',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Cholinergic|Individual|Nervous_system|Neuron|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|NBLASTexp|neuronbridge',\n", + " 'parents_label': 'adult cholinergic neuron|adult Drosulfakinin MP3 neuron',\n", + " 'parents_id': 'FBbt_00058205|FBbt_00051432',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '328559607',\n", + " 'templates': 'JRC_FlyEM_Hemibrain|JRC2018Unisex',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'},\n", + " {'label': 'DSKMP3_R (FlyEM-HB:327937328)',\n", + " 'symbol': 'DSKMP3_R',\n", + " 'id': 'VFB_jrchjti6',\n", + " 'tags': 'Entity|Adult|Anatomy|Cell|Cholinergic|Individual|Nervous_system|Neuron|Peptidergic|has_image|has_neuron_connectivity|has_region_connectivity|FlyEM_HB|NBLAST|neuronbridge',\n", + " 'parents_label': 'adult cholinergic neuron|adult Drosulfakinin MP3 neuron',\n", + " 'parents_id': 'FBbt_00058205|FBbt_00051432',\n", + " 'data_source': 'neuprint_JRC_Hemibrain_1point1',\n", + " 'accession': '327937328',\n", + " 'templates': 'JRC2018Unisex|JRC_FlyEM_Hemibrain',\n", + " 'dataset': 'Xu2020NeuronsV1point1',\n", + " 'license': 'https://creativecommons.org/licenses/by/4.0/legalcode'}]" ] }, - "execution_count": 3, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "DA3adPN = vc.get_instances(\"adult Drosulfakinin neuron\", summary=True)\n", - "pd.DataFrame.from_records(DA3adPN)" + "pd.DataFrame.from_records(DA3adPN)\n" ] }, { @@ -3230,7 +3147,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.5" + "version": "3.10.9" }, "orig_nbformat": 2 }, diff --git a/src/vfb_connect/cross_server_tools.py b/src/vfb_connect/cross_server_tools.py index 48708a79..b1c79247 100644 --- a/src/vfb_connect/cross_server_tools.py +++ b/src/vfb_connect/cross_server_tools.py @@ -98,7 +98,7 @@ def get_terms_by_region(self, region, cells_only=False, verbose=False, query_by_ :param cells_only: Optional. Limits query to cell type if `True`. Defaults to `False` :param verbose: Optional. :param query_by_label: Optional (see region). Default `True` - :param summary: Optional. Returns summary reports if true. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of VFB_json or summary_report_json """ @@ -121,7 +121,7 @@ def get_subclasses(self, class_expression, query_by_label=True, direct=False, su :param class_expression: A valid OWL class expression, e.g. the name of a class. :param query_by_label: Optional. If false, class_expression takes IDs instead of labels Default `True` :param direct: Return direct subclasses only. Default `False` - :param summary: Optional. Returns summary reports if true. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of VFB_json or summary_report_json """ @@ -135,9 +135,9 @@ def get_superclasses(self, class_expression, query_by_label=True, direct=False, """Generate JSON report of all superclasses of class_expression. :param class_expression: A valid OWL class expression, e.g. the name of a class. - :param query_by_label: Optional. If false, class_expression takes IDs instead of labels Default `True` + :param query_by_label: Optional. If false, class_expression takes IDs instead of labels. Default `True` :param direct: Return direct superclass only. Default `False` - :param summary: Optional. Returns summary reports if true. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of VFB_json or summary_report_json """ if not re.search("'", class_expression): @@ -151,8 +151,8 @@ def get_instances(self, class_expression, query_by_label=True, summary=True): of a type/class, e.g. a neuron of type DA1 adPN from the FAFB_catmaid database. :param class_expression: A valid OWL class expression, e.g. the name of a class. - :param query_by_label: Optional. If false, class_expression takes IDs instead of labels Default `True` - :param summary: Optional. Returns summary reports if true. Default `False` + :param query_by_label: Optional. If false, class_expression takes IDs instead of labels. Default `True` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of VFB_json or summary_report_json """ if not re.search("'", class_expression): @@ -300,7 +300,7 @@ def get_instances_by_dataset(self, dataset, summary=True): """Get JSON report of all individuals in a dataset :param dataset: dataset ID - :param summary: Optional. Returns summary reports if true. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of VFB_json or summary_report_json diff --git a/src/vfb_connect/neo/neo4j_tools.py b/src/vfb_connect/neo/neo4j_tools.py index a4fd8f68..2bfd667a 100644 --- a/src/vfb_connect/neo/neo4j_tools.py +++ b/src/vfb_connect/neo/neo4j_tools.py @@ -74,7 +74,7 @@ def chunks(l, n): class Neo4jConnect: - """Thin layer over REST API to hold connection details, + """Thin layer over REST API to hold connection details, handle multi-statement POST queries, return results and report errors. :param endpoint: a neo4j REST endpoint @@ -96,7 +96,7 @@ def __init__(self, endpoint = get_default_servers()['neo_endpoint'], self.commit = "/db/data/transaction/commit" self.headers = {} self.test_connection() - + def commit_list(self, statements, return_graphs=False): """Commit a list of statements to neo4J DB via REST API. Errors prompt warnings (STDERR), not exceptions, and cause return = FALSE. @@ -110,19 +110,18 @@ def commit_list(self, statements, return_graphs=False): if return_graphs: for s in statements: cstatements.append({'statement': s, "resultDataContents" : [ "row", "graph" ]}) - else: + else: for s in statements: cstatements.append({'statement': s}) # rows an columns are returned by default. payload = {'statements': cstatements} - response = requests.post(url = "%s%s" + response = requests.post(url = "%s%s" % (self.base_uri, self.commit), auth = (self.usr, self.pwd) , data = json.dumps(payload), headers = self.headers) if self.rest_return_check(response): return response.json()['results'] else: return False - - + def commit_list_in_chunks(self, statements, verbose=False, chunk_length=1000): """Commit multiple (chunked) commit of statements to neo4J DB via REST API. @@ -142,7 +141,7 @@ def commit_list_in_chunks(self, statements, verbose=False, chunk_length=1000): if verbose: start_time = time.time() print("Processing chunk of %d of %d starting with: %s" % (i, - c_no, + c_no, c[0].encode('utf8'))) r = self.commit_list(c) if verbose: @@ -179,7 +178,7 @@ def rest_return_check(self, response): return False else: return True - + def test_connection(self): """Test neo4j endpoint connection""" statements = ["MATCH (n) RETURN n LIMIT 1"] @@ -187,19 +186,19 @@ def test_connection(self): return True else: return False - + def list_all_node_props(self): r = self.commit_list(['MATCH (n) with keys(n) AS kl UNWIND kl as k RETURN DISTINCT k']) d = dict_cursor(r) return [x['k'] for x in d] - + def list_all_edge_props(self): r = self.commit_list(['MATCH ()-[r]-() with keys(r) AS kl UNWIND kl as k RETURN DISTINCT k']) d = dict_cursor(r) return [x['k'] for x in d] def get_lookup(self, limit_by_prefix=None, include_individuals=False, - limit_properties_by_prefix=('RO', 'BFO', 'VFBext'), curies=False): + limit_properties_by_prefix=('RO', 'BFO', 'VFBext'), curies=False, include_synonyms=True): """Generate a name:ID lookup from a VFB neo4j DB, optionally restricted by a list of prefixes. @@ -226,6 +225,16 @@ def get_lookup(self, limit_by_prefix=None, include_individuals=False, "RETURN a.short_form as id, a.symbol[0] as name" % (l, where) q = self.commit_list([lookup_query]) out.extend(dict_cursor(q)) + if include_synonyms: + lookup_query = "MATCH (a:%s) %s AND EXISTS(a.synonyms) OR (a)-[:has_reference {typ:'syn'}]->(:pub:Individual) " \ + "UNWIND a.synonyms AS synonym2 " \ + "RETURN DISTINCT a.short_form AS id, synonym2 AS name " \ + "UNION ALL MATCH (n)-[r:has_reference {typ:'syn'}]->(:pub:Individual) " \ + "UNWIND r.value AS synonym1 " \ + "WITH a.short_form AS id, synonym1 AS synonym " \ + "RETURN DISTINCT id, synonym AS name" % (l, where) + q = self.commit_list([lookup_query]) + out.extend(dict_cursor(q)) # All ObjectProperties wanted, irrespective of ID if limit_properties_by_prefix: regex_string = '.+|'.join(limit_properties_by_prefix) + '.+' @@ -266,7 +275,7 @@ def escape_string(strng): if type(strng) == str: strng = re.sub(r'\\', r'\\\\', strng) strng = re.sub("'", "\\'", strng) - strng = re.sub('"', '\\"', strng) + strng = re.sub('"', '\\"', strng) return strng diff --git a/src/vfb_connect/neo/query_wrapper.py b/src/vfb_connect/neo/query_wrapper.py index 6ecae882..c561b5fd 100644 --- a/src/vfb_connect/neo/query_wrapper.py +++ b/src/vfb_connect/neo/query_wrapper.py @@ -249,10 +249,10 @@ def get_dbs(self): "return i.short_form" return [d['i.short_form'] for d in self._query(query)] - def get_datasets(self, summary=False): + def get_datasets(self, summary=True): """Generate JSON report of all datsets. - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :return type: list of VFB_json or summary_report_json """ @@ -262,10 +262,10 @@ def get_datasets(self, summary=False): short_forms = [d['sf'] for d in dc] return self.get_DataSet_TermInfo(short_forms, summary=summary) - def get_templates(self, summary=False): + def get_templates(self, summary=True): """Generate JSON report of all available templates. - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :return type: list of VFB_json or summary_report_json """ @@ -395,7 +395,7 @@ def get_TermInfo(self, short_forms: iter): return out @batch_query - def _get_TermInfo(self, short_forms: iter, typ, show_query=False, summary=False): + def _get_TermInfo(self, short_forms: iter, typ, show_query=False, summary=True): short_forms = list(short_forms) sfl = "', '".join(short_forms) qs = Template(self.queries[typ]).substitute(ID=sfl) @@ -406,7 +406,7 @@ def _get_TermInfo(self, short_forms: iter, typ, show_query=False, summary=False) else: return self._query(qs) - def _get_anatomical_individual_TermInfo_by_type(self, classification, summary=False): + def _get_anatomical_individual_TermInfo_by_type(self, classification, summary=True): typ = 'Get JSON for Individual:Anatomy_by_type' qs = Template(self.queries[typ]).substitute(ID=classification) if summary: @@ -429,32 +429,32 @@ def _termInfo_2_summary(self, TermInfo, typ): dc.append(_populate_dataset_summary_tab(r)) return dc - def get_anatomical_individual_TermInfo(self, short_forms, summary=False): + def get_anatomical_individual_TermInfo(self, short_forms, summary=True): """ Generate JSON reports for anatomical individuals from a list of VFB IDs (short_forms) :param short_forms: An iterable (e.g. a list) of VFB IDs (short_forms) of anatomical individuals - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :rtype: list of VFB_json or summary_report_json """ return self._get_TermInfo(short_forms, typ='Get JSON for Individual', summary=summary) - def get_type_TermInfo(self, short_forms, summary=False): + def get_type_TermInfo(self, short_forms, summary=True): """ Generate JSON reports for types from a list of VFB IDs (short_forms) of classes/types. :param short_forms: An iterable (e.g. a list) of VFB IDs (short_forms) of types - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :rtype: list of VFB_json or summary_report_json """ return self._get_TermInfo(short_forms, typ='Get JSON for Class', summary=summary) - def get_DataSet_TermInfo(self, short_forms, summary=False): + def get_DataSet_TermInfo(self, short_forms, summary=True): """ Generate JSON reports for types from a list of VFB IDs (short_forms) of DataSets. :param short_forms: An iterable (e.g. a list) of VFB IDs (short_forms) of types - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :rtype: list of VFB_json or summary_report_json """ return self._get_TermInfo(short_forms, typ='Get JSON for DataSet', summary=summary) @@ -464,7 +464,7 @@ def get_template_TermInfo(self, short_forms): Generate JSON reports for types from a list of VFB IDs (short_forms) of templates. :param short_forms: An iterable (e.g. a list) of VFB IDs (short_forms) of types - :param summary: Optional. Returns summary reports if `True`. Default `False` + :param summary: Optional. Returns summary reports if `True`. Default `True` :rtype: list of VFB_json or summary_report_json """ return self._get_TermInfo(short_forms, typ='Get JSON for Template') diff --git a/src/vfb_connect/owl/owlery_query_tools.py b/src/vfb_connect/owl/owlery_query_tools.py index 5c42ab22..c07bda9b 100644 --- a/src/vfb_connect/owl/owlery_query_tools.py +++ b/src/vfb_connect/owl/owlery_query_tools.py @@ -83,13 +83,13 @@ def query(self, query_type, return_type, warnings.warn(str(r.content)) return False - def get_subclasses(self, query, query_by_label=True, direct=False, return_short_forms=False): + def get_subclasses(self, query, query_by_label=True, direct=False, return_short_forms=True): """Generate list of IDs of all subclasses of class_expression. :param class_expression: A valid OWL class expression, e.g. the name of a class. :param query_by_label: Optional. If `False``, class_expression takes CURIEs instead of labels. Default `False` :param direct: Return direct subclasses only. Default `False` - :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. + :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of IRIs or short_forms (depending on return_short_form option) """ @@ -101,13 +101,13 @@ def get_subclasses(self, query, query_by_label=True, direct=False, return_short_ else: return out - def get_instances(self, query, query_by_label=True, direct=False, return_short_forms=False): + def get_instances(self, query, query_by_label=True, direct=False, return_short_forms=True): """Generate list of IDs of all instances of class_expression. :param class_expression: A valid OWL class expression, e.g. the name of a class. :param query_by_label: Optional. If `False``, class_expression takes CURIEs instead of labels. Default `False` :param direct: Return direct instances only. Default `False` - :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. + :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of IRIs or short_forms (depending on return_short_form option) """ @@ -119,13 +119,13 @@ def get_instances(self, query, query_by_label=True, direct=False, return_short_f else: return out - def get_superclasses(self, query, query_by_label=True, direct=False, return_short_forms=False): + def get_superclasses(self, query, query_by_label=True, direct=False, return_short_forms=True): """Generate list of IDs of all superclasses of class_expression. :param class_expression: A valid OWL class expression, e.g. the name (or CURIE) of a class. :param query_by_label: Optional. If `False``, class_expression takes CURIEs instead of labels. Default `False` :param direct: Return direct instances only. Default `False` - :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. + :param return_short_forms: Optional. If `True`, returns short_forms instead of IRIs. Default `True` :return: Returns a list of terms as nested python data structures following VFB_json or a summary_report_json :rtype: list of IRIs or short_forms (depending on return_short_form option) """