Skip to content

Commit

Permalink
Merge branch 'main' of github.com:RECETOX/ei_spectra_predictions into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
hechth committed Oct 30, 2023
2 parents cc2f6d2 + 53eb439 commit 1f009d1
Show file tree
Hide file tree
Showing 75 changed files with 380,861 additions and 1,737,149 deletions.
95 changes: 95 additions & 0 deletions analysis/Python_scripts/add_zeros_matching.ipynb
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
}
Binary file modified analysis/Python_scripts/chemical_composition_boxplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 45 additions & 21 deletions analysis/Python_scripts/classes_boxplot.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion analysis/Python_scripts/method_comparison_histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5373,7 +5373,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.10.2"
}
},
"nbformat": 4,
Expand Down
Binary file modified analysis/Python_scripts/method_comparison_histogram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1f009d1

Please sign in to comment.