You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

extract_smiles.ipynb 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "import requests"
  10. ]
  11. },
  12. {
  13. "cell_type": "code",
  14. "execution_count": 11,
  15. "metadata": {},
  16. "outputs": [],
  17. "source": [
  18. "\n",
  19. "url = 'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/vioxx/property/CanonicalSMILES/TXT'\n",
  20. "data = '''{\n",
  21. " \"query\": {\n",
  22. " \"bool\": {\n",
  23. " \"must\": [\n",
  24. " {\n",
  25. " \"text\": {\n",
  26. " \"record.document\": \"SOME_JOURNAL\"\n",
  27. " }\n",
  28. " },\n",
  29. " {\n",
  30. " \"text\": {\n",
  31. " \"record.articleTitle\": \"farmers\"\n",
  32. " }\n",
  33. " }\n",
  34. " ],\n",
  35. " \"must_not\": [],\n",
  36. " \"should\": []\n",
  37. " }\n",
  38. " },\n",
  39. " \"from\": 0,\n",
  40. " \"size\": 50,\n",
  41. " \"sort\": [],\n",
  42. " \"facets\": {}\n",
  43. "}'''\n",
  44. "response = requests.post(url, data=data)"
  45. ]
  46. },
  47. {
  48. "cell_type": "code",
  49. "execution_count": 12,
  50. "metadata": {},
  51. "outputs": [
  52. {
  53. "name": "stdout",
  54. "output_type": "stream",
  55. "text": [
  56. "200\n",
  57. "CS(=O)(=O)C1=CC=C(C=C1)C2=C(C(=O)OC2)C3=CC=CC=C3\n",
  58. "\n"
  59. ]
  60. }
  61. ],
  62. "source": [
  63. "print(response.status_code)\n",
  64. "print(response.text)"
  65. ]
  66. },
  67. {
  68. "cell_type": "code",
  69. "execution_count": null,
  70. "metadata": {},
  71. "outputs": [],
  72. "source": []
  73. }
  74. ],
  75. "metadata": {
  76. "kernelspec": {
  77. "display_name": "base",
  78. "language": "python",
  79. "name": "python3"
  80. },
  81. "language_info": {
  82. "codemirror_mode": {
  83. "name": "ipython",
  84. "version": 3
  85. },
  86. "file_extension": ".py",
  87. "mimetype": "text/x-python",
  88. "name": "python",
  89. "nbconvert_exporter": "python",
  90. "pygments_lexer": "ipython3",
  91. "version": "3.9.7"
  92. },
  93. "orig_nbformat": 4
  94. },
  95. "nbformat": 4,
  96. "nbformat_minor": 2
  97. }