{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":87793,"databundleVersionId":11228175,"sourceType":"competition"}],"dockerImageVersionId":30918,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Interactive 3D Plots of Molecules\n\nA very simple kernel to render 3D interactive plots of RNA molecules from the training labels.","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport plotly.express as px\nfrom pathlib import Path\n\ninput_path = Path('/kaggle/input/stanford-rna-3d-folding')","metadata":{"_uuid":"aa07ca2b-9de4-44f4-b6c7-bc6faaa976c6","_cell_guid":"8bfa8a6c-b593-4d94-9e7b-adb34b2d443b","trusted":true,"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2025-02-27T22:12:00.710414Z","iopub.execute_input":"2025-02-27T22:12:00.710869Z","iopub.status.idle":"2025-02-27T22:12:00.716804Z","shell.execute_reply.started":"2025-02-27T22:12:00.710837Z","shell.execute_reply":"2025-02-27T22:12:00.715247Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Load train sequences and labels.\ntrain_sequences = pd.read_csv(input_path / 'train_sequences.csv')\ntrain_labels = pd.read_csv(input_path / 'train_labels.csv')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-27T22:12:01.838070Z","iopub.execute_input":"2025-02-27T22:12:01.838471Z","iopub.status.idle":"2025-02-27T22:12:02.344261Z","shell.execute_reply.started":"2025-02-27T22:12:01.838443Z","shell.execute_reply":"2025-02-27T22:12:02.343070Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Check out a few train sequences.\ntrain_sequences.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-27T22:42:23.245127Z","iopub.execute_input":"2025-02-27T22:42:23.245537Z","iopub.status.idle":"2025-02-27T22:42:23.258100Z","shell.execute_reply.started":"2025-02-27T22:42:23.245506Z","shell.execute_reply":"2025-02-27T22:42:23.256769Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Label the labels with their target_id.\ntrain_labels['target_id'] = train_labels.ID.str.rsplit('_', n=1, expand=True).iloc[:,0]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-27T22:34:06.366712Z","iopub.execute_input":"2025-02-27T22:34:06.367068Z","iopub.status.idle":"2025-02-27T22:34:06.895989Z","shell.execute_reply.started":"2025-02-27T22:34:06.367044Z","shell.execute_reply":"2025-02-27T22:34:06.894590Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Let's plot some polymeric molecules...\n\ntarget_id = '9G8O_S2'\n\nfig = px.line_3d(\n    train_labels.loc[train_labels.target_id==target_id],\n    x='x_1', y='y_1', z='z_1',\n    height=800, width=800,\n    title=f'{target_id}'\n)\n\nfig.show(renderer='iframe')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-27T23:06:50.319186Z","iopub.execute_input":"2025-02-27T23:06:50.319599Z","iopub.status.idle":"2025-02-27T23:06:50.452658Z","shell.execute_reply.started":"2025-02-27T23:06:50.319554Z","shell.execute_reply":"2025-02-27T23:06:50.451104Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Oh boy, that's _some_ structure.","metadata":{}},{"cell_type":"code","source":"target_id = '1BIV_A'\n\nfig = px.line_3d(\n    train_labels.loc[train_labels.target_id==target_id],\n    x='x_1', y='y_1', z='z_1',\n    height=800, width=800,\n    title=f'{target_id}'\n)\n\nfig.show(renderer='iframe')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-27T23:06:52.924499Z","iopub.execute_input":"2025-02-27T23:06:52.924956Z","iopub.status.idle":"2025-02-27T23:06:53.070222Z","shell.execute_reply.started":"2025-02-27T23:06:52.924924Z","shell.execute_reply":"2025-02-27T23:06:53.068507Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"So tame in comparison with 9G8O_S2!","metadata":{}}]}