{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Encoded cafa 5 protein function prediction labels as single numpy files ","metadata":{}},{"cell_type":"code","source":"import os\nimport numpy as np\nimport pandas as pd","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:41:30.743107Z","iopub.execute_input":"2023-08-04T02:41:30.743448Z","iopub.status.idle":"2023-08-04T02:41:30.74848Z","shell.execute_reply.started":"2023-08-04T02:41:30.743422Z","shell.execute_reply":"2023-08-04T02:41:30.747507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"terms_data = pd.read_csv('/kaggle/input/cafa-5-protein-function-prediction/Train/train_terms.tsv',sep='\\t')\ncounts = terms_data['term'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:41:30.750087Z","iopub.execute_input":"2023-08-04T02:41:30.750366Z","iopub.status.idle":"2023-08-04T02:41:32.806567Z","shell.execute_reply.started":"2023-08-04T02:41:30.750336Z","shell.execute_reply":"2023-08-04T02:41:32.805941Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"counts[0:100].plot()","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:41:32.807752Z","iopub.execute_input":"2023-08-04T02:41:32.808182Z","iopub.status.idle":"2023-08-04T02:41:32.963359Z","shell.execute_reply.started":"2023-08-04T02:41:32.808159Z","shell.execute_reply":"2023-08-04T02:41:32.962641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"termsorder = pd.read_csv('/kaggle/input/cafa-5-protein-function-prediction-labels/terms.csv')\nfiles = os.listdir('/kaggle/input/cafa-5-protein-function-prediction-labels/labels')","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:41:32.965205Z","iopub.execute_input":"2023-08-04T02:41:32.96579Z","iopub.status.idle":"2023-08-04T02:41:33.025219Z","shell.execute_reply.started":"2023-08-04T02:41:32.96576Z","shell.execute_reply":"2023-08-04T02:41:33.023804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"container = np.zeros(len(counts))\n\nfor val in files:\n    \n    current = np.load('/kaggle/input/cafa-5-protein-function-prediction-labels/labels/'+val)\n    container = container + current","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:41:33.026788Z","iopub.execute_input":"2023-08-04T02:41:33.027215Z","iopub.status.idle":"2023-08-04T02:51:13.783258Z","shell.execute_reply.started":"2023-08-04T02:41:33.027176Z","shell.execute_reply":"2023-08-04T02:51:13.781375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"order = np.argsort(container)[::-1]\nlabelnames = termsorder['labels'].iloc[order].values\n\nfor k in range(10):\n    print(labelnames[k] +' '+ str(container[order[k]]))\n    \ncounts[0:10]","metadata":{"execution":{"iopub.status.busy":"2023-08-04T02:51:13.786641Z","iopub.execute_input":"2023-08-04T02:51:13.78712Z","iopub.status.idle":"2023-08-04T02:51:13.818758Z","shell.execute_reply.started":"2023-08-04T02:51:13.787075Z","shell.execute_reply":"2023-08-04T02:51:13.818042Z"},"trusted":true},"execution_count":null,"outputs":[]}]}