-
-
Save egonw/e4c788437a827407457deb764ce8eb93 to your computer and use it in GitHub Desktop.
IUPAC name 2 InChIKey
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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyMKhmxGiqR2xmIoq9EeBrjP", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/egonw/e4c788437a827407457deb764ce8eb93/iupac-name-2-inchikey.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "Xv8CMhwoMQWw" | |
}, | |
"outputs": [], | |
"source": [ | |
"!apt install maven\n", | |
"!pip install scyjava" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from scyjava import config, jimport\n", | |
"config.endpoints.append('io.github.egonw.bacting:managers-inchi:0.1.0')\n", | |
"config.endpoints.append('io.github.egonw.bacting:managers-opsin:0.1.0')" | |
], | |
"metadata": { | |
"id": "CY2kFHvMMTNb" | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"inchi_cls = jimport(\"net.bioclipse.managers.InChIManager\")\n", | |
"inchi = inchi_cls(\".\")\n", | |
"opsin_cls = jimport(\"net.bioclipse.managers.OpsinManager\")\n", | |
"opsin = opsin_cls(\".\")" | |
], | |
"metadata": { | |
"id": "odv1VJKlMigU" | |
}, | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"anInChI = inchi.generate(opsin.parseIUPACName(\"methane\"))\n", | |
"print(f\"InChI: {anInChI.getValue()}\")\n", | |
"print(f\"InchIKey: {anInChI.getKey()}\")\n" | |
], | |
"metadata": { | |
"id": "Jgw-pi5-Mrs6", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "71edb633-bfe3-4c86-c41c-ada7e6dddd5e" | |
}, | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"InChI: InChI=1S/CH4/h1H4\n", | |
"InchIKey: VNWKTOKETHGBQD-UHFFFAOYSA-N\n" | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment