{"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"}],"dockerImageVersionId":30587,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nplt.style.use('fivethirtyeight')\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-11-26T16:52:23.985645Z","iopub.execute_input":"2023-11-26T16:52:23.986091Z","iopub.status.idle":"2023-11-26T16:52:24.890753Z","shell.execute_reply.started":"2023-11-26T16:52:23.986053Z","shell.execute_reply":"2023-11-26T16:52:24.889376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/stanford-ribonanza-rna-folding/train_data.csv')\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-11-26T16:52:32.692393Z","iopub.execute_input":"2023-11-26T16:52:32.692932Z","iopub.status.idle":"2023-11-26T16:53:46.348283Z","shell.execute_reply.started":"2023-11-26T16:52:32.692899Z","shell.execute_reply":"2023-11-26T16:53:46.347342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe().style.background_gradient(cmap='summer')","metadata":{"execution":{"iopub.status.busy":"2023-11-26T16:54:24.093409Z","iopub.execute_input":"2023-11-26T16:54:24.093755Z","iopub.status.idle":"2023-11-26T16:54:45.522889Z","shell.execute_reply.started":"2023-11-26T16:54:24.093726Z","shell.execute_reply":"2023-11-26T16:54:45.521777Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def sensitivity(true_positives, false_negatives):\n    return true_positives / (true_positives + false_negatives)\n\ntrue_positives = 100  \nfalse_negatives = 20  \n\nprint(f\"True Positives: {true_positives}\")\nprint(f\"False Negatives: {false_negatives}\")\n\nsensitivity_score = sensitivity(true_positives, false_negatives)\nprint(f\"Sensitivity: {sensitivity_score}\")","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:01:57.088959Z","iopub.execute_input":"2023-11-26T17:01:57.089395Z","iopub.status.idle":"2023-11-26T17:01:57.098244Z","shell.execute_reply.started":"2023-11-26T17:01:57.089363Z","shell.execute_reply":"2023-11-26T17:01:57.096743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def ppv(true_positives, false_positives):\n    return true_positives / (true_positives + false_positives)\n\ntrue_positives = 100  \nfalse_positives = 30  \n\nppv_score = ppv(true_positives, false_positives)\nprint(f\"Positive Predictive Value (PPV): {ppv_score}\")","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:02:08.788068Z","iopub.execute_input":"2023-11-26T17:02:08.788475Z","iopub.status.idle":"2023-11-26T17:02:08.795020Z","shell.execute_reply.started":"2023-11-26T17:02:08.788436Z","shell.execute_reply":"2023-11-26T17:02:08.793953Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def mcc(true_positives, true_negatives, false_positives, false_negatives):\n    numerator = (true_positives * true_negatives) - (false_positives * false_negatives)\n    denominator = ((true_positives + false_positives) * (true_positives + false_negatives) * \n                   (true_negatives + false_positives) * (true_negatives + false_negatives)) ** 0.5\n    return numerator / denominator if denominator != 0 else 0\n\n\ntrue_positives = 100  \ntrue_negatives = 50   \nfalse_positives = 30  \nfalse_negatives = 20  \n\nmcc_score = mcc(true_positives, true_negatives, false_positives, false_negatives)\nprint(f\"Matthews Correlation Coefficient (MCC): {mcc_score}\")","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:02:19.209060Z","iopub.execute_input":"2023-11-26T17:02:19.209459Z","iopub.status.idle":"2023-11-26T17:02:19.219446Z","shell.execute_reply.started":"2023-11-26T17:02:19.209414Z","shell.execute_reply":"2023-11-26T17:02:19.217195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def f_measure(true_positives, false_positives, false_negatives):\n    precision = ppv(true_positives, false_positives)\n    recall = sensitivity(true_positives, false_negatives)\n    return 2 * (precision * recall) / (precision + recall) if (precision + recall) != 0 else 0\n\ntrue_positives = 100  \nfalse_positives = 30  \nfalse_negatives = 20  \n\nf_measure_score = f_measure(true_positives, false_positives, false_negatives)\nprint(f\"F-measure (F1 Score): {f_measure_score}\")","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:02:33.476703Z","iopub.execute_input":"2023-11-26T17:02:33.477201Z","iopub.status.idle":"2023-11-26T17:02:33.487969Z","shell.execute_reply.started":"2023-11-26T17:02:33.477164Z","shell.execute_reply":"2023-11-26T17:02:33.485159Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%capture\n%pip install arnie","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:02:42.690564Z","iopub.execute_input":"2023-11-26T17:02:42.691095Z","iopub.status.idle":"2023-11-26T17:03:19.967804Z","shell.execute_reply.started":"2023-11-26T17:02:42.691029Z","shell.execute_reply":"2023-11-26T17:03:19.965459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%capture\n%pip install draw_rna","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:03:50.768443Z","iopub.execute_input":"2023-11-26T17:03:50.770971Z","iopub.status.idle":"2023-11-26T17:04:04.464805Z","shell.execute_reply.started":"2023-11-26T17:03:50.770914Z","shell.execute_reply":"2023-11-26T17:04:04.462719Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# install eternafold\n!conda config --set auto_update_conda false\n!conda install -c bioconda eternafold --yes","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:04:20.781370Z","iopub.execute_input":"2023-11-26T17:04:20.781843Z","iopub.status.idle":"2023-11-26T17:05:26.622939Z","shell.execute_reply.started":"2023-11-26T17:04:20.781809Z","shell.execute_reply":"2023-11-26T17:05:26.621655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%env ETERNAFOLD_PATH=/opt/conda/bin/eternafold-bin\n%env ETERNAFOLD_PARAMETERS=/opt/conda/lib/eternafold-lib/parameters/EternaFoldParams.v1","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:06:13.669291Z","iopub.execute_input":"2023-11-26T17:06:13.669696Z","iopub.status.idle":"2023-11-26T17:06:13.679354Z","shell.execute_reply.started":"2023-11-26T17:06:13.669663Z","shell.execute_reply":"2023-11-26T17:06:13.678030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#  df is your DataFrame\nsequences = df['sequence'].tolist()\nsequences","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:06:30.419948Z","iopub.execute_input":"2023-11-26T17:06:30.420561Z","iopub.status.idle":"2023-11-26T17:06:30.619340Z","shell.execute_reply.started":"2023-11-26T17:06:30.420512Z","shell.execute_reply":"2023-11-26T17:06:30.616220Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install mfe","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:13:08.907941Z","iopub.execute_input":"2023-11-26T17:13:08.908388Z","iopub.status.idle":"2023-11-26T17:13:19.784762Z","shell.execute_reply.started":"2023-11-26T17:13:08.908355Z","shell.execute_reply":"2023-11-26T17:13:19.783431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install --upgrade arnie","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:16:08.557628Z","iopub.execute_input":"2023-11-26T17:16:08.558263Z","iopub.status.idle":"2023-11-26T17:16:19.891878Z","shell.execute_reply.started":"2023-11-26T17:16:08.558226Z","shell.execute_reply":"2023-11-26T17:16:19.890169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_data = pd.read_csv('/kaggle/input/stanford-ribonanza-rna-folding/sample_submission.csv')\nsubmission_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:21:03.436564Z","iopub.execute_input":"2023-11-26T17:21:03.437060Z","iopub.status.idle":"2023-11-26T17:22:17.583768Z","shell.execute_reply.started":"2023-11-26T17:21:03.436992Z","shell.execute_reply":"2023-11-26T17:22:17.581964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_df = pd.DataFrame(submission_data)\n\n# Save the DataFrame to a CSV file\nsubmission_df.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-11-26T17:22:33.460870Z","iopub.execute_input":"2023-11-26T17:22:33.461466Z","iopub.status.idle":"2023-11-26T17:27:36.116064Z","shell.execute_reply.started":"2023-11-26T17:22:33.461421Z","shell.execute_reply":"2023-11-26T17:27:36.113164Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}