{"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":51294,"databundleVersionId":6923401,"sourceType":"competition"},{"sourceId":153825489,"sourceType":"kernelVersion"},{"sourceId":153903761,"sourceType":"kernelVersion"}],"dockerImageVersionId":30587,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"https://www.kaggle.com/code/mirenaborisova/srrnaf-2","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"code","source":"import warnings\nwarnings.simplefilter('ignore')\n\nimport pandas as pd\npd.set_option('display.max_columns', 30)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:35:28.531041Z","iopub.execute_input":"2023-12-07T15:35:28.531730Z","iopub.status.idle":"2023-12-07T15:35:29.014570Z","shell.execute_reply.started":"2023-12-07T15:35:28.531692Z","shell.execute_reply":"2023-12-07T15:35:29.013251Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = pd.read_csv('/kaggle/input/stanford-ribonanza-rna-folding/test_sequences.csv')","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:35:29.016851Z","iopub.execute_input":"2023-12-07T15:35:29.017507Z","iopub.status.idle":"2023-12-07T15:35:37.520930Z","shell.execute_reply.started":"2023-12-07T15:35:29.017441Z","shell.execute_reply":"2023-12-07T15:35:37.519689Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_seq_lengths = test.sequence.str.len()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:35:37.522285Z","iopub.execute_input":"2023-12-07T15:35:37.522673Z","iopub.status.idle":"2023-12-07T15:35:38.565394Z","shell.execute_reply.started":"2023-12-07T15:35:37.522641Z","shell.execute_reply":"2023-12-07T15:35:38.563893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\n\ndel test\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:35:38.568322Z","iopub.execute_input":"2023-12-07T15:35:38.568690Z","iopub.status.idle":"2023-12-07T15:35:38.759847Z","shell.execute_reply.started":"2023-12-07T15:35:38.568659Z","shell.execute_reply":"2023-12-07T15:35:38.758473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_2A3 = pd.read_csv('/kaggle/input/srrnaf-2/preds_2A3.csv').drop(columns='Unnamed: 0')","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:35:38.761519Z","iopub.execute_input":"2023-12-07T15:35:38.761987Z","iopub.status.idle":"2023-12-07T15:39:51.151176Z","shell.execute_reply.started":"2023-12-07T15:35:38.761941Z","shell.execute_reply":"2023-12-07T15:39:51.148736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\n\npreds_2A3_bylength = []\n\nfor i in range(test_seq_lengths.size):\n    \n    x = np.reshape(preds_2A3.iloc[i, :test_seq_lengths[i]], (-1, 1))\n    \n    preds_2A3_bylength.append(x)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:39:51.154349Z","iopub.execute_input":"2023-12-07T15:39:51.154934Z","iopub.status.idle":"2023-12-07T15:44:01.902740Z","shell.execute_reply.started":"2023-12-07T15:39:51.154880Z","shell.execute_reply":"2023-12-07T15:44:01.901529Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_2A3 = np.concatenate(preds_2A3_bylength)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:44:01.904375Z","iopub.execute_input":"2023-12-07T15:44:01.904854Z","iopub.status.idle":"2023-12-07T15:44:03.718059Z","shell.execute_reply.started":"2023-12-07T15:44:01.904813Z","shell.execute_reply":"2023-12-07T15:44:03.716847Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del preds_2A3_bylength\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:44:03.719690Z","iopub.execute_input":"2023-12-07T15:44:03.720052Z","iopub.status.idle":"2023-12-07T15:44:03.961923Z","shell.execute_reply.started":"2023-12-07T15:44:03.720021Z","shell.execute_reply":"2023-12-07T15:44:03.960781Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_DMS = pd.read_csv('/kaggle/input/srrnaf-8/preds_DMS.csv').drop(columns='Unnamed: 0')","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:44:03.963393Z","iopub.execute_input":"2023-12-07T15:44:03.963866Z","iopub.status.idle":"2023-12-07T15:47:42.612701Z","shell.execute_reply.started":"2023-12-07T15:44:03.963820Z","shell.execute_reply":"2023-12-07T15:47:42.611560Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_DMS_bylength = []\n\nfor i in range(test_seq_lengths.size):\n    \n    x = np.reshape(preds_DMS.iloc[i, :test_seq_lengths[i]], (-1, 1))\n    \n    preds_DMS_bylength.append(x)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:47:42.616384Z","iopub.execute_input":"2023-12-07T15:47:42.616762Z","iopub.status.idle":"2023-12-07T15:51:59.733487Z","shell.execute_reply.started":"2023-12-07T15:47:42.616727Z","shell.execute_reply":"2023-12-07T15:51:59.732539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_DMS = np.concatenate(preds_DMS_bylength)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:51:59.735589Z","iopub.execute_input":"2023-12-07T15:51:59.736654Z","iopub.status.idle":"2023-12-07T15:52:02.110042Z","shell.execute_reply.started":"2023-12-07T15:51:59.736608Z","shell.execute_reply":"2023-12-07T15:52:02.108874Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del preds_DMS_bylength\n\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:02.111994Z","iopub.execute_input":"2023-12-07T15:52:02.112434Z","iopub.status.idle":"2023-12-07T15:52:02.364715Z","shell.execute_reply.started":"2023-12-07T15:52:02.112391Z","shell.execute_reply":"2023-12-07T15:52:02.363497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.DataFrame({'id': np.arange(0, preds_DMS.shape[0], 1),\n                           'reactivity_DMS_MaP': preds_DMS[:, 0],\n                           'reactivity_2A3_MaP': preds_2A3[:, 0]})","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:02.365741Z","iopub.execute_input":"2023-12-07T15:52:02.366046Z","iopub.status.idle":"2023-12-07T15:52:10.042923Z","shell.execute_reply.started":"2023-12-07T15:52:02.366019Z","shell.execute_reply":"2023-12-07T15:52:10.041713Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del preds_2A3\ndel preds_DMS\n\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:10.044664Z","iopub.execute_input":"2023-12-07T15:52:10.044994Z","iopub.status.idle":"2023-12-07T15:52:10.124135Z","shell.execute_reply.started":"2023-12-07T15:52:10.044966Z","shell.execute_reply":"2023-12-07T15:52:10.123031Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:10.125833Z","iopub.execute_input":"2023-12-07T15:52:10.126295Z","iopub.status.idle":"2023-12-07T15:52:10.145796Z","shell.execute_reply.started":"2023-12-07T15:52:10.126251Z","shell.execute_reply":"2023-12-07T15:52:10.144738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install pyarrow","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:10.147414Z","iopub.execute_input":"2023-12-07T15:52:10.147752Z","iopub.status.idle":"2023-12-07T15:52:25.419329Z","shell.execute_reply.started":"2023-12-07T15:52:10.147722Z","shell.execute_reply":"2023-12-07T15:52:25.418261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_parquet('submission.parquet', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-12-07T15:52:25.421107Z","iopub.execute_input":"2023-12-07T15:52:25.422231Z","iopub.status.idle":"2023-12-07T15:53:21.176816Z","shell.execute_reply.started":"2023-12-07T15:52:25.422180Z","shell.execute_reply":"2023-12-07T15:53:21.175428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}