Created
April 17, 2024 15:27
-
-
Save chasemc/e707e5185ad86188557842168b4c0580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from socialgene.neo4j.neo4j import GraphDriver\n", | |
| "from socialgene.config import env_vars\n", | |
| "import logging\n", | |
| "import os\n", | |
| "\n", | |
| "env_vars[\"NEO4J_URI\"] =\"bolt://localhost:7687\"\n", | |
| "os.environ[\"NEO4J_PASSWORD\"] = \"test12345\"\n", | |
| "logging.getLogger(\"neo4j\").setLevel(logging.WARNING)\n", | |
| "logging.getLogger().setLevel(logging.INFO)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<div>\n", | |
| "<style scoped>\n", | |
| " .dataframe tbody tr th:only-of-type {\n", | |
| " vertical-align: middle;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe tbody tr th {\n", | |
| " vertical-align: top;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe thead th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a1.uid</th>\n", | |
| " <th>n1.external_id</th>\n", | |
| " <th>antismash_region</th>\n", | |
| " <th>antismash_products</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>GCF_000145235.1</td>\n", | |
| " <td>NC_014391.1</td>\n", | |
| " <td>4</td>\n", | |
| " <td>[NRPS, 2dos, T1PKS, NRPS-like]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>GCF_000145235.1</td>\n", | |
| " <td>NC_014391.1</td>\n", | |
| " <td>5</td>\n", | |
| " <td>[T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>GCF_000145235.1</td>\n", | |
| " <td>NC_014391.1</td>\n", | |
| " <td>8</td>\n", | |
| " <td>[NRPS-like, NRPS, T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>GCF_000145235.1</td>\n", | |
| " <td>NC_014391.1</td>\n", | |
| " <td>7</td>\n", | |
| " <td>[NRPS-like, NRPS, T1PKS, PKS-like]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>17</td>\n", | |
| " <td>[T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>5</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>13</td>\n", | |
| " <td>[T1PKS, PKS-like, other, oligosaccharide]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>6</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>4</td>\n", | |
| " <td>[T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>7</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>20</td>\n", | |
| " <td>[NRPS, T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>8</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>5</td>\n", | |
| " <td>[arylpolyene, T1PKS]</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>9</th>\n", | |
| " <td>GCF_000158815.1</td>\n", | |
| " <td>NZ_GG657738.1</td>\n", | |
| " <td>7</td>\n", | |
| " <td>[T1PKS]</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a1.uid n1.external_id antismash_region \\\n", | |
| "0 GCF_000145235.1 NC_014391.1 4 \n", | |
| "1 GCF_000145235.1 NC_014391.1 5 \n", | |
| "2 GCF_000145235.1 NC_014391.1 8 \n", | |
| "3 GCF_000145235.1 NC_014391.1 7 \n", | |
| "4 GCF_000158815.1 NZ_GG657738.1 17 \n", | |
| "5 GCF_000158815.1 NZ_GG657738.1 13 \n", | |
| "6 GCF_000158815.1 NZ_GG657738.1 4 \n", | |
| "7 GCF_000158815.1 NZ_GG657738.1 20 \n", | |
| "8 GCF_000158815.1 NZ_GG657738.1 5 \n", | |
| "9 GCF_000158815.1 NZ_GG657738.1 7 \n", | |
| "\n", | |
| " antismash_products \n", | |
| "0 [NRPS, 2dos, T1PKS, NRPS-like] \n", | |
| "1 [T1PKS] \n", | |
| "2 [NRPS-like, NRPS, T1PKS] \n", | |
| "3 [NRPS-like, NRPS, T1PKS, PKS-like] \n", | |
| "4 [T1PKS] \n", | |
| "5 [T1PKS, PKS-like, other, oligosaccharide] \n", | |
| "6 [T1PKS] \n", | |
| "7 [NRPS, T1PKS] \n", | |
| "8 [arylpolyene, T1PKS] \n", | |
| "9 [T1PKS] " | |
| ] | |
| }, | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "with GraphDriver() as db:\n", | |
| " results = db.run(\n", | |
| " \"\"\"\n", | |
| "MATCH p=(a1:assembly)-[:ASSEMBLES_TO]-(n1:nucleotide)-[e1:ENCODES]->(p1:protein) \n", | |
| "WHERE 'T1PKS' IN e1.antismash_products\n", | |
| "RETURN DISTINCT a1.uid, n1.external_id, e1.antismash_region as antismash_region, e1.antismash_products as antismash_products\n", | |
| "limit 10\n", | |
| "\"\"\"\n", | |
| " ).to_df()\n", | |
| "\n", | |
| "results" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "sgpy", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython3", | |
| "version": "3.12.0" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment