-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import sys, os, io, json\n", | ||
"from neo4j import GraphDatabase\n", | ||
"from py2neo import Graph\n", | ||
"from pathlib import Path\n", | ||
"from pandas import DataFrame\n", | ||
"import pandas as pd\n", | ||
"import networkx as nx\n", | ||
"\n", | ||
"graph = Graph(\"bolt://sarevok:7687\")\n", | ||
"driver = GraphDatabase.driver('bolt://sarevok:7687', auth=None)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Which Metabolights studies are associated with chemicals under `\torganofluorine compound` in CHEBI?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"| | study_id | study_name | chemical_id | chemical_name |\n", | ||
"|---:|:-----------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------|:--------------------------|\n", | ||
"| 0 | MTBLS1693 | Known Metabolite Annotation in Different Biological Samples using Ion Mobility Collision Cross-Section Atlas (AllCCS) | chebi:36811 | 4-(trifluoromethyl)phenol |\n", | ||
"| 1 | MTBLS2406 | Multi-Omics Analysis Reveals Disturbance of Nanosecond Pulsed Electric Field in the Serum Metabolic Spectrum and Gut Microbiota | chebi:36811 | 4-(trifluoromethyl)phenol |\n", | ||
"| 2 | MTBLS9451 | Fecal microbiota transplantation treatment maintains post antibiotics gut function by change the gut microbiome and fecal metabolome to reduce gut inflammation and oxidative stress in nile tilapia (Oreochromis niloticus) | chebi:83488 | fipronil-sulfide |\n", | ||
"| 3 | MTBLS3977 | Integrated microbiome-metabolome-genome axis data of Laiwu and Lulai pigs | chebi:83487 | fipronil sulfone |\n", | ||
"| 4 | MTBLS2145 | Metabolic Dynamics of In Vitro CD8+ T Cell Activation | chebi:68540 | teriflunomide |\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"\n", | ||
"# chebi:37143 is \"organofluorine compound\"\n", | ||
"\n", | ||
"df = DataFrame(graph.run(\"\"\"\n", | ||
"MATCH (study:`metabolights:Study`)\n", | ||
" -[:`metabolights:ref`]->(metabolights_ref)\n", | ||
" -[:`metabolights:chemical`]->(chemical)\n", | ||
" -[:`biolink:broad_match`*1..]->(chem2)\n", | ||
" -[:sourceId]->(:Id { id: \"chebi:37143\" })\n", | ||
"RETURN\n", | ||
" [id in study.id WHERE id =~ \"MTBL.*\" | id][0] AS study_id,\n", | ||
" study.`grebi:name`[0] as study_name,\n", | ||
" [id in chemical.id WHERE id =~ \"chebi:.*\" | id][0] AS chemical_id,\n", | ||
" chemical.`grebi:name`[0] as chemical_name\n", | ||
"\"\"\").data())\n", | ||
"\n", | ||
"print(df.head(5).to_markdown())\n", | ||
"\n", | ||
"df.to_csv(\"metabolights_organofluorine.csv\", index=False)\n", | ||
"\n", | ||
"\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"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.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |