{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data       , CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\n\nimport matplotlib\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib import pyplot as plt\n%matplotlib inline\n\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"df_train = pd.read_csv(\"../input/train.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"structures = pd.read_csv(\"../input/structures.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"molecule = 'dsgdb9nsd_000001'","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"a = df_train.loc[df_train['molecule_name'] == f'{molecule}']\nb = structures[structures.molecule_name == f'{molecule}']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"list(df_train['type'].unique())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def convert_index_to_atom(a, b, atom_index):\n    c = a.merge(b, how='left', left_on=['molecule_name', f'atom_index_{atom_index}'], right_on=['molecule_name', 'atom_index'])\n    c.drop('atom_index', axis=1, inplace=True)\n    c.rename(columns = {\n    'atom': f'atom_{atom_index}',\n    'x': f'x_{atom_index}',\n    'y': f'y_{atom_index}',\n    'z': f'z_{atom_index}'\n}, inplace=True)\n    c.drop(f'atom_index_{atom_index}', axis=1, inplace=True)\n    return c","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"c = convert_index_to_atom(df_train, structures, 0)\nc = convert_index_to_atom(c, structures, 1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"t = c[c['molecule_name'] == f'{molecule}']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"types  = list(c.groupby('type').groups)\ntypes","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '1JHC']['x_0']\ny = c[c['type'] == '1JHC']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('1JHC')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '1JHN']['x_0']\ny = c[c['type'] == '1JHN']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('1JHN')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '2JHC']['x_0']\ny = c[c['type'] == '2JHC']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('2JHC')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '2JHH']['x_0']\ny = c[c['type'] == '2JHH']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('2JHH')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '2JHN']['x_0']\ny = c[c['type'] == '2JHN']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('2JHN')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '3JHC']['x_0']\ny = c[c['type'] == '3JHC']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('3JHC')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '3JHH']['x_0']\ny = c[c['type'] == '3JHH']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('3JHH')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(10, 5))\nx = c[c['type'] == '3JHN']['x_0']\ny = c[c['type'] == '3JHN']['y_0']\nax.scatter(x, y)\nax.grid(True)\nax.set_title('3JHN')\nfig.tight_layout()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.4","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}