-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:RECETOX/ei_spectra_predictions into…
… main
- Loading branch information
Showing
75 changed files
with
380,861 additions
and
1,737,149 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,95 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import plotly.graph_objs as go\n", | ||
"import pandas as pd\n", | ||
"import seaborn as sns\n", | ||
"import os\n", | ||
"from matplotlib import pyplot as plt\n", | ||
"from rdkit import Chem" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 19, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"query = Chem.SDMolSupplier(\"../../data/simulated_spectra.msp\")\n", | ||
"reference = Chem.SDMolSupplier(\"../data/experimental/RECETOX_GC-EI_MS_20201028_norm_matchms.msp\")\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 20, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def append_classes(molecules):\n", | ||
" class_names = pd.DataFrame({\n", | ||
" \"molname\" : [m.GetProp(\"NAME\") for m in molecules],\n", | ||
"\n", | ||
" })\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 21, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"[15:52:07] ERROR: Cannot convert '35.' to unsigned int on line 4\n", | ||
"[15:52:07] ERROR: moving to the beginning of the next molecule\n" | ||
] | ||
}, | ||
{ | ||
"ename": "AttributeError", | ||
"evalue": "'NoneType' object has no attribute 'GetProp'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[1;32m/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb Cell 4\u001b[0m line \u001b[0;36m1\n\u001b[0;32m----> <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m merged_top5_same \u001b[39m=\u001b[39m append_classes(query)\n", | ||
"\u001b[1;32m/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb Cell 4\u001b[0m line \u001b[0;36m3\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mappend_classes\u001b[39m(molecules):\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a>\u001b[0m class_names \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mDataFrame({\n\u001b[0;32m----> <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a>\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mmolname\u001b[39m\u001b[39m\"\u001b[39m : [m\u001b[39m.\u001b[39mGetProp(\u001b[39m\"\u001b[39m\u001b[39mNAME\u001b[39m\u001b[39m\"\u001b[39m) \u001b[39mfor\u001b[39;00m m \u001b[39min\u001b[39;00m molecules],\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a>\u001b[0m \n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a>\u001b[0m })\n", | ||
"\u001b[1;32m/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb Cell 4\u001b[0m line \u001b[0;36m3\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mappend_classes\u001b[39m(molecules):\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a>\u001b[0m class_names \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mDataFrame({\n\u001b[0;32m----> <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a>\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mmolname\u001b[39m\u001b[39m\"\u001b[39m : [m\u001b[39m.\u001b[39;49mGetProp(\u001b[39m\"\u001b[39m\u001b[39mNAME\u001b[39m\u001b[39m\"\u001b[39m) \u001b[39mfor\u001b[39;00m m \u001b[39min\u001b[39;00m molecules],\n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a>\u001b[0m \n\u001b[1;32m <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/wrojas/dev/RECETOX/ei_spectra_predictions/analysis/Python_scripts/add_zeros_matching.ipynb#X20sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a>\u001b[0m })\n", | ||
"\u001b[0;31mAttributeError\u001b[0m: 'NoneType' object has no attribute 'GetProp'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"merged_top5_same = append_classes(query)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"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.10.2" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.