{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!wget http://github.com/bbuchfink/diamond/releases/download/v2.1.6/diamond-linux64.tar.gz\n!tar xzf diamond-linux64.tar.gz\n!rm diamond-linux64.tar.gz","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-05-24T15:09:17.125276Z","iopub.execute_input":"2023-05-24T15:09:17.125714Z","iopub.status.idle":"2023-05-24T15:09:22.22495Z","shell.execute_reply.started":"2023-05-24T15:09:17.125674Z","shell.execute_reply":"2023-05-24T15:09:22.223555Z"},"trusted":true},"execution_count":1,"outputs":[{"name":"stdout","text":"URL transformed to HTTPS due to an HSTS policy\n--2023-05-24 15:09:18--  https://github.com/bbuchfink/diamond/releases/download/v2.1.6/diamond-linux64.tar.gz\nResolving github.com (github.com)... 140.82.113.3\nConnecting to github.com (github.com)|140.82.113.3|:443... connected.\nHTTP request sent, awaiting response... 302 Found\nLocation: https://objects.githubusercontent.com/github-production-release-asset-2e65be/31987083/6b15e096-093f-4e8e-b9ff-5e7bb45db282?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230524T150918Z&X-Amz-Expires=300&X-Amz-Signature=db6695e488f4ec87a09557f9e80af8bd5a5f209ba7af59ab30d9b877d2906e1e&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31987083&response-content-disposition=attachment%3B%20filename%3Ddiamond-linux64.tar.gz&response-content-type=application%2Foctet-stream [following]\n--2023-05-24 15:09:18--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/31987083/6b15e096-093f-4e8e-b9ff-5e7bb45db282?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230524T150918Z&X-Amz-Expires=300&X-Amz-Signature=db6695e488f4ec87a09557f9e80af8bd5a5f209ba7af59ab30d9b877d2906e1e&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31987083&response-content-disposition=attachment%3B%20filename%3Ddiamond-linux64.tar.gz&response-content-type=application%2Foctet-stream\nResolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...\nConnecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 29011146 (28M) [application/octet-stream]\nSaving to: ‘diamond-linux64.tar.gz’\n\ndiamond-linux64.tar 100%[===================>]  27.67M   165MB/s    in 0.2s    \n\n2023-05-24 15:09:18 (165 MB/s) - ‘diamond-linux64.tar.gz’ saved [29011146/29011146]\n\n","output_type":"stream"}]},{"cell_type":"code","source":"from subprocess import Popen, PIPE","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:09:22.227666Z","iopub.execute_input":"2023-05-24T15:09:22.22838Z","iopub.status.idle":"2023-05-24T15:09:22.233959Z","shell.execute_reply.started":"2023-05-24T15:09:22.228339Z","shell.execute_reply":"2023-05-24T15:09:22.232842Z"},"trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"code","source":"db_name='train_db'\noutfile_name='matches.tsv'\nk=16 ","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:09:22.235468Z","iopub.execute_input":"2023-05-24T15:09:22.236646Z","iopub.status.idle":"2023-05-24T15:09:22.246039Z","shell.execute_reply.started":"2023-05-24T15:09:22.236609Z","shell.execute_reply":"2023-05-24T15:09:22.245058Z"},"trusted":true},"execution_count":3,"outputs":[]},{"cell_type":"code","source":"p = Popen(['./diamond', 'makedb', \n           '--in', '/kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta',\n            '-d', db_name], stdin=PIPE, stdout=PIPE)\nstdout, stderr = p.communicate()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:11:15.871111Z","iopub.execute_input":"2023-05-24T15:11:15.871579Z","iopub.status.idle":"2023-05-24T15:11:21.150169Z","shell.execute_reply.started":"2023-05-24T15:11:15.871542Z","shell.execute_reply":"2023-05-24T15:11:21.149159Z"},"trusted":true},"execution_count":5,"outputs":[{"name":"stderr","text":"diamond v2.1.6.160 (C) Max Planck Society for the Advancement of Science\nDocumentation, support and updates available at http://www.diamondsearch.org\nPlease cite: http://dx.doi.org/10.1038/s41592-021-01101-x Nature Methods (2021)\n\n#CPU threads: 4\nScoring parameters: (Matrix=BLOSUM62 Lambda=0.267 K=0.041 Penalties=11/1)\nDatabase input file: /kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta\nOpening the database file...  [0.182s]\nLoading sequences...  [2.34s]\nMasking sequences...  [2.562s]\nWriting sequences...  [0.132s]\nHashing sequences...  [0.033s]\nLoading sequences...  [0s]\nWriting trailer...  [0.004s]\nClosing the input file...  [0s]\nClosing the database file...  [0.001s]\n\nDatabase sequences  142246\n  Database letters  78752603\n     Database hash  e491561cb14a4f3b4cbeb2d58ede2339\n        Total time  5.257000s\n","output_type":"stream"}]},{"cell_type":"code","source":"import time","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:12:00.673623Z","iopub.execute_input":"2023-05-24T15:12:00.674065Z","iopub.status.idle":"2023-05-24T15:12:00.679229Z","shell.execute_reply.started":"2023-05-24T15:12:00.674015Z","shell.execute_reply":"2023-05-24T15:12:00.677983Z"},"trusted":true},"execution_count":6,"outputs":[]},{"cell_type":"code","source":"time0 = time.time() \np = Popen(['./diamond', 'blastp', '-d', db_name,\n           '-q', '/kaggle/input/cafa-5-protein-function-prediction/Test (Targets)/testsuperset.fasta',\n            '-o', outfile_name, '--max-target-seqs', str(k), '--quiet'], stdin=PIPE, stdout=PIPE)\nstdout, stderr = p.communicate()\nprint(f'Execution time: {time.time()-time0}s')","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:12:00.813913Z","iopub.execute_input":"2023-05-24T15:12:00.814903Z","iopub.status.idle":"2023-05-24T15:16:05.43979Z","shell.execute_reply.started":"2023-05-24T15:12:00.814857Z","shell.execute_reply":"2023-05-24T15:16:05.438912Z"},"trusted":true},"execution_count":7,"outputs":[{"name":"stdout","text":"Execution time: 244.61876225471497s\n","output_type":"stream"}]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:16:05.441786Z","iopub.execute_input":"2023-05-24T15:16:05.442163Z","iopub.status.idle":"2023-05-24T15:16:05.447896Z","shell.execute_reply.started":"2023-05-24T15:16:05.442129Z","shell.execute_reply":"2023-05-24T15:16:05.446612Z"},"trusted":true},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"matches=pd.read_csv(outfile_name, sep='\\t', header=None, \n                    names=['qseqid', 'sseqid', 'pident', 'length', 'mismatch', \n                           'gapopen', 'qstart', 'qend', 'sstart','send', 'evalue', 'bitscore'])\nmatches['qseqid']=matches['qseqid'].apply(lambda x: x.split('\\\\t')[0])\nmatches.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:16:05.450112Z","iopub.execute_input":"2023-05-24T15:16:05.450591Z","iopub.status.idle":"2023-05-24T15:16:08.528569Z","shell.execute_reply.started":"2023-05-24T15:16:05.450556Z","shell.execute_reply":"2023-05-24T15:16:08.52746Z"},"trusted":true},"execution_count":9,"outputs":[{"execution_count":9,"output_type":"execute_result","data":{"text/plain":"   qseqid  sseqid  pident  length  mismatch  gapopen  qstart  qend  sstart  \\\n0  Q9CQV8  Q9CQV8   100.0     246         0        0       1   246       1   \n1  Q9CQV8  P35213    98.8     246         3        0       1   246       1   \n2  Q9CQV8  P31946    98.8     246         3        0       1   246       1   \n3  Q9CQV8  V9HWD6    98.8     246         3        0       1   246       1   \n4  Q9CQV8  Q5PRD0    91.0     244        22        0       3   246       1   \n5  Q9CQV8  P63104    87.2     242        31        0       3   244       1   \n6  Q9CQV8  Q5ZKC9    86.8     242        32        0       3   244       1   \n7  Q9CQV8  P63101    86.8     242        32        0       3   244       1   \n8  Q9CQV8  P63102    86.8     242        32        0       3   244       1   \n9  Q9CQV8  P68254    81.0     242        46        0       3   244       1   \n\n   send         evalue  bitscore  \n0   246  1.100000e-167     464.0  \n1   246  1.050000e-165     459.0  \n2   246  2.120000e-165     458.0  \n3   246  2.120000e-165     458.0  \n4   244  1.200000e-150     421.0  \n5   242  1.040000e-142     401.0  \n6   242  2.970000e-142     400.0  \n7   242  5.990000e-142     399.0  \n8   242  5.990000e-142     399.0  \n9   242  4.080000e-133     377.0  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>qseqid</th>\n      <th>sseqid</th>\n      <th>pident</th>\n      <th>length</th>\n      <th>mismatch</th>\n      <th>gapopen</th>\n      <th>qstart</th>\n      <th>qend</th>\n      <th>sstart</th>\n      <th>send</th>\n      <th>evalue</th>\n      <th>bitscore</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>Q9CQV8</td>\n      <td>Q9CQV8</td>\n      <td>100.0</td>\n      <td>246</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.100000e-167</td>\n      <td>464.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>Q9CQV8</td>\n      <td>P35213</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.050000e-165</td>\n      <td>459.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>Q9CQV8</td>\n      <td>P31946</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>Q9CQV8</td>\n      <td>V9HWD6</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>Q9CQV8</td>\n      <td>Q5PRD0</td>\n      <td>91.0</td>\n      <td>244</td>\n      <td>22</td>\n      <td>0</td>\n      <td>3</td>\n      <td>246</td>\n      <td>1</td>\n      <td>244</td>\n      <td>1.200000e-150</td>\n      <td>421.0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>Q9CQV8</td>\n      <td>P63104</td>\n      <td>87.2</td>\n      <td>242</td>\n      <td>31</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>1.040000e-142</td>\n      <td>401.0</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>Q9CQV8</td>\n      <td>Q5ZKC9</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>2.970000e-142</td>\n      <td>400.0</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>Q9CQV8</td>\n      <td>P63101</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>Q9CQV8</td>\n      <td>P63102</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>Q9CQV8</td>\n      <td>P68254</td>\n      <td>81.0</td>\n      <td>242</td>\n      <td>46</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>4.080000e-133</td>\n      <td>377.0</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"train_terms=pd.read_csv('/kaggle/input/cafa-5-protein-function-prediction/Train/train_terms.tsv', sep='\\t')\narrayofgos=train_terms.groupby('EntryID').term.apply(lambda x: np.array(x))\nprint(type(arrayofgos))","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:18:48.434645Z","iopub.execute_input":"2023-05-24T15:18:48.435215Z","iopub.status.idle":"2023-05-24T15:18:57.605276Z","shell.execute_reply.started":"2023-05-24T15:18:48.435147Z","shell.execute_reply":"2023-05-24T15:18:57.604009Z"},"trusted":true},"execution_count":11,"outputs":[{"name":"stdout","text":"<class 'pandas.core.series.Series'>\n","output_type":"stream"}]},{"cell_type":"code","source":"print(arrayofgos)","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:19:46.546505Z","iopub.execute_input":"2023-05-24T15:19:46.546948Z","iopub.status.idle":"2023-05-24T15:19:46.558089Z","shell.execute_reply.started":"2023-05-24T15:19:46.546912Z","shell.execute_reply":"2023-05-24T15:19:46.556739Z"},"trusted":true},"execution_count":12,"outputs":[{"name":"stdout","text":"EntryID\nA0A009IHW8    [GO:0008152, GO:0034655, GO:0072523, GO:004427...\nA0A021WW32    [GO:0048869, GO:0048856, GO:0022008, GO:006500...\nA0A021WZA4    [GO:0071944, GO:0005575, GO:0110165, GO:001602...\nA0A023FBW4    [GO:0019956, GO:0005488, GO:0003674, GO:001995...\nA0A023FBW7    [GO:0019957, GO:0019956, GO:0005488, GO:000367...\n                                    ...                        \nX6RKS3        [GO:0005622, GO:0031090, GO:0043226, GO:003196...\nX6RLN4        [GO:0005737, GO:0005829, GO:0005575, GO:000562...\nX6RLP6        [GO:0005622, GO:0031981, GO:0043229, GO:004322...\nX6RLR1        [GO:0005622, GO:0031981, GO:0043226, GO:000573...\nX6RM59        [GO:0005622, GO:0031981, GO:0043226, GO:004323...\nName: term, Length: 142246, dtype: object\n","output_type":"stream"}]},{"cell_type":"code","source":"matches['terms']=arrayofgos[matches.sseqid.values].values","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:20:01.079737Z","iopub.execute_input":"2023-05-24T15:20:01.080207Z","iopub.status.idle":"2023-05-24T15:20:02.076894Z","shell.execute_reply.started":"2023-05-24T15:20:01.08017Z","shell.execute_reply":"2023-05-24T15:20:02.075762Z"},"trusted":true},"execution_count":13,"outputs":[]},{"cell_type":"code","source":"matches.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:20:15.032778Z","iopub.execute_input":"2023-05-24T15:20:15.034163Z","iopub.status.idle":"2023-05-24T15:20:15.077721Z","shell.execute_reply.started":"2023-05-24T15:20:15.034099Z","shell.execute_reply":"2023-05-24T15:20:15.076613Z"},"trusted":true},"execution_count":14,"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":"   qseqid  sseqid  pident  length  mismatch  gapopen  qstart  qend  sstart  \\\n0  Q9CQV8  Q9CQV8   100.0     246         0        0       1   246       1   \n1  Q9CQV8  P35213    98.8     246         3        0       1   246       1   \n2  Q9CQV8  P31946    98.8     246         3        0       1   246       1   \n3  Q9CQV8  V9HWD6    98.8     246         3        0       1   246       1   \n4  Q9CQV8  Q5PRD0    91.0     244        22        0       3   246       1   \n5  Q9CQV8  P63104    87.2     242        31        0       3   244       1   \n6  Q9CQV8  Q5ZKC9    86.8     242        32        0       3   244       1   \n7  Q9CQV8  P63101    86.8     242        32        0       3   244       1   \n8  Q9CQV8  P63102    86.8     242        32        0       3   244       1   \n9  Q9CQV8  P68254    81.0     242        46        0       3   244       1   \n\n   send         evalue  bitscore  \\\n0   246  1.100000e-167     464.0   \n1   246  1.050000e-165     459.0   \n2   246  2.120000e-165     458.0   \n3   246  2.120000e-165     458.0   \n4   244  1.200000e-150     421.0   \n5   242  1.040000e-142     401.0   \n6   242  2.970000e-142     400.0   \n7   242  5.990000e-142     399.0   \n8   242  5.990000e-142     399.0   \n9   242  4.080000e-133     377.0   \n\n                                               terms  \n0  [GO:0051234, GO:0070727, GO:0051649, GO:005164...  \n1  [GO:0065007, GO:1903507, GO:0051172, GO:000815...  \n2  [GO:0051641, GO:0045744, GO:0009968, GO:006500...  \n3  [GO:0005737, GO:0005829, GO:0005575, GO:000562...  \n4  [GO:0006909, GO:0051234, GO:0006897, GO:001032...  \n5  [GO:0008152, GO:0006357, GO:0090128, GO:005164...  \n6   [GO:0110165, GO:0005575, GO:0005576, GO:0005615]  \n7  [GO:0006357, GO:0048869, GO:0051641, GO:004885...  \n8  [GO:0006839, GO:0051641, GO:0072655, GO:000700...  \n9  [GO:0051234, GO:0051716, GO:0070727, GO:005164...  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>qseqid</th>\n      <th>sseqid</th>\n      <th>pident</th>\n      <th>length</th>\n      <th>mismatch</th>\n      <th>gapopen</th>\n      <th>qstart</th>\n      <th>qend</th>\n      <th>sstart</th>\n      <th>send</th>\n      <th>evalue</th>\n      <th>bitscore</th>\n      <th>terms</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>Q9CQV8</td>\n      <td>Q9CQV8</td>\n      <td>100.0</td>\n      <td>246</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.100000e-167</td>\n      <td>464.0</td>\n      <td>[GO:0051234, GO:0070727, GO:0051649, GO:005164...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>Q9CQV8</td>\n      <td>P35213</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.050000e-165</td>\n      <td>459.0</td>\n      <td>[GO:0065007, GO:1903507, GO:0051172, GO:000815...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>Q9CQV8</td>\n      <td>P31946</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n      <td>[GO:0051641, GO:0045744, GO:0009968, GO:006500...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>Q9CQV8</td>\n      <td>V9HWD6</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n      <td>[GO:0005737, GO:0005829, GO:0005575, GO:000562...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>Q9CQV8</td>\n      <td>Q5PRD0</td>\n      <td>91.0</td>\n      <td>244</td>\n      <td>22</td>\n      <td>0</td>\n      <td>3</td>\n      <td>246</td>\n      <td>1</td>\n      <td>244</td>\n      <td>1.200000e-150</td>\n      <td>421.0</td>\n      <td>[GO:0006909, GO:0051234, GO:0006897, GO:001032...</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>Q9CQV8</td>\n      <td>P63104</td>\n      <td>87.2</td>\n      <td>242</td>\n      <td>31</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>1.040000e-142</td>\n      <td>401.0</td>\n      <td>[GO:0008152, GO:0006357, GO:0090128, GO:005164...</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>Q9CQV8</td>\n      <td>Q5ZKC9</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>2.970000e-142</td>\n      <td>400.0</td>\n      <td>[GO:0110165, GO:0005575, GO:0005576, GO:0005615]</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>Q9CQV8</td>\n      <td>P63101</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n      <td>[GO:0006357, GO:0048869, GO:0051641, GO:004885...</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>Q9CQV8</td>\n      <td>P63102</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n      <td>[GO:0006839, GO:0051641, GO:0072655, GO:000700...</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>Q9CQV8</td>\n      <td>P68254</td>\n      <td>81.0</td>\n      <td>242</td>\n      <td>46</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>4.080000e-133</td>\n      <td>377.0</td>\n      <td>[GO:0051234, GO:0051716, GO:0070727, GO:005164...</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"matches['ntargets']=matches.groupby(['qseqid']).qseqid.count()[matches['qseqid'].values].values","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:20:58.458329Z","iopub.execute_input":"2023-05-24T15:20:58.458921Z","iopub.status.idle":"2023-05-24T15:20:59.578756Z","shell.execute_reply.started":"2023-05-24T15:20:58.458877Z","shell.execute_reply":"2023-05-24T15:20:59.577289Z"},"trusted":true},"execution_count":15,"outputs":[]},{"cell_type":"code","source":"matches.head(20)","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:50:21.139656Z","iopub.execute_input":"2023-05-24T15:50:21.141635Z","iopub.status.idle":"2023-05-24T15:50:21.194714Z","shell.execute_reply.started":"2023-05-24T15:50:21.141582Z","shell.execute_reply":"2023-05-24T15:50:21.193349Z"},"trusted":true},"execution_count":27,"outputs":[{"execution_count":27,"output_type":"execute_result","data":{"text/plain":"    qseqid  sseqid  pident  length  mismatch  gapopen  qstart  qend  sstart  \\\n0   Q9CQV8  Q9CQV8   100.0     246         0        0       1   246       1   \n1   Q9CQV8  P35213    98.8     246         3        0       1   246       1   \n2   Q9CQV8  P31946    98.8     246         3        0       1   246       1   \n3   Q9CQV8  V9HWD6    98.8     246         3        0       1   246       1   \n4   Q9CQV8  Q5PRD0    91.0     244        22        0       3   246       1   \n5   Q9CQV8  P63104    87.2     242        31        0       3   244       1   \n6   Q9CQV8  Q5ZKC9    86.8     242        32        0       3   244       1   \n7   Q9CQV8  P63101    86.8     242        32        0       3   244       1   \n8   Q9CQV8  P63102    86.8     242        32        0       3   244       1   \n9   Q9CQV8  P68254    81.0     242        46        0       3   244       1   \n10  Q9CQV8  P68255    81.0     242        46        0       3   244       1   \n11  Q9CQV8  P27348    81.0     242        46        0       3   244       1   \n12  Q9CQV8  P29310    78.2     243        53        0       2   244       3   \n13  Q9CQV8  Q20655    78.4     245        53        0       1   245       1   \n14  Q9CQV8  P41932    81.5     227        41        1       7   233       7   \n15  Q9CQV8  P61982    75.8     248        54        3       3   246       2   \n16  P62259  P62258   100.0     255         0        0       1   255       1   \n17  P62259  P62261   100.0     255         0        0       1   255       1   \n18  P62259  P62259   100.0     255         0        0       1   255       1   \n19  P62259  P62260   100.0     255         0        0       1   255       1   \n\n    send         evalue  bitscore  \\\n0    246  1.100000e-167     464.0   \n1    246  1.050000e-165     459.0   \n2    246  2.120000e-165     458.0   \n3    246  2.120000e-165     458.0   \n4    244  1.200000e-150     421.0   \n5    242  1.040000e-142     401.0   \n6    242  2.970000e-142     400.0   \n7    242  5.990000e-142     399.0   \n8    242  5.990000e-142     399.0   \n9    242  4.080000e-133     377.0   \n10   242  4.080000e-133     377.0   \n11   242  4.080000e-133     377.0   \n12   245  6.820000e-128     363.0   \n13   245  3.930000e-127     362.0   \n14   232  2.920000e-122     349.0   \n15   247  5.400000e-120     343.0   \n16   255  1.340000e-177     490.0   \n17   255  1.340000e-177     490.0   \n18   255  1.340000e-177     490.0   \n19   255  1.340000e-177     490.0   \n\n                                                terms  ntargets  \n0   [GO:0051234, GO:0070727, GO:0051649, GO:005164...        16  \n1   [GO:0065007, GO:1903507, GO:0051172, GO:000815...        16  \n2   [GO:0051641, GO:0045744, GO:0009968, GO:006500...        16  \n3   [GO:0005737, GO:0005829, GO:0005575, GO:000562...        16  \n4   [GO:0006909, GO:0051234, GO:0006897, GO:001032...        16  \n5   [GO:0008152, GO:0006357, GO:0090128, GO:005164...        16  \n6    [GO:0110165, GO:0005575, GO:0005576, GO:0005615]        16  \n7   [GO:0006357, GO:0048869, GO:0051641, GO:004885...        16  \n8   [GO:0006839, GO:0051641, GO:0072655, GO:000700...        16  \n9   [GO:0051234, GO:0051716, GO:0070727, GO:005164...        16  \n10  [GO:0043269, GO:0034763, GO:0034762, GO:005078...        16  \n11  [GO:0007420, GO:0048856, GO:0065007, GO:190350...        16  \n12  [GO:0009266, GO:0009967, GO:0019953, GO:000727...        16  \n13  [GO:0051641, GO:0048856, GO:0065007, GO:000727...        16  \n14  [GO:0009266, GO:0019953, GO:0006913, GO:190285...        16  \n15  [GO:0051234, GO:0070727, GO:0051649, GO:005164...        16  \n16  [GO:0009266, GO:0051641, GO:0048856, GO:003450...        16  \n17  [GO:0042325, GO:0050790, GO:0065007, GO:004409...        16  \n18  [GO:0021766, GO:0048869, GO:0051641, GO:004885...        16  \n19  [GO:0051716, GO:0050896, GO:0050789, GO:006500...        16  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>qseqid</th>\n      <th>sseqid</th>\n      <th>pident</th>\n      <th>length</th>\n      <th>mismatch</th>\n      <th>gapopen</th>\n      <th>qstart</th>\n      <th>qend</th>\n      <th>sstart</th>\n      <th>send</th>\n      <th>evalue</th>\n      <th>bitscore</th>\n      <th>terms</th>\n      <th>ntargets</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>Q9CQV8</td>\n      <td>Q9CQV8</td>\n      <td>100.0</td>\n      <td>246</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.100000e-167</td>\n      <td>464.0</td>\n      <td>[GO:0051234, GO:0070727, GO:0051649, GO:005164...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>Q9CQV8</td>\n      <td>P35213</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1.050000e-165</td>\n      <td>459.0</td>\n      <td>[GO:0065007, GO:1903507, GO:0051172, GO:000815...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>Q9CQV8</td>\n      <td>P31946</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n      <td>[GO:0051641, GO:0045744, GO:0009968, GO:006500...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>Q9CQV8</td>\n      <td>V9HWD6</td>\n      <td>98.8</td>\n      <td>246</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>246</td>\n      <td>1</td>\n      <td>246</td>\n      <td>2.120000e-165</td>\n      <td>458.0</td>\n      <td>[GO:0005737, GO:0005829, GO:0005575, GO:000562...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>Q9CQV8</td>\n      <td>Q5PRD0</td>\n      <td>91.0</td>\n      <td>244</td>\n      <td>22</td>\n      <td>0</td>\n      <td>3</td>\n      <td>246</td>\n      <td>1</td>\n      <td>244</td>\n      <td>1.200000e-150</td>\n      <td>421.0</td>\n      <td>[GO:0006909, GO:0051234, GO:0006897, GO:001032...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>Q9CQV8</td>\n      <td>P63104</td>\n      <td>87.2</td>\n      <td>242</td>\n      <td>31</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>1.040000e-142</td>\n      <td>401.0</td>\n      <td>[GO:0008152, GO:0006357, GO:0090128, GO:005164...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>Q9CQV8</td>\n      <td>Q5ZKC9</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>2.970000e-142</td>\n      <td>400.0</td>\n      <td>[GO:0110165, GO:0005575, GO:0005576, GO:0005615]</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>Q9CQV8</td>\n      <td>P63101</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n      <td>[GO:0006357, GO:0048869, GO:0051641, GO:004885...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>Q9CQV8</td>\n      <td>P63102</td>\n      <td>86.8</td>\n      <td>242</td>\n      <td>32</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>5.990000e-142</td>\n      <td>399.0</td>\n      <td>[GO:0006839, GO:0051641, GO:0072655, GO:000700...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>Q9CQV8</td>\n      <td>P68254</td>\n      <td>81.0</td>\n      <td>242</td>\n      <td>46</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>4.080000e-133</td>\n      <td>377.0</td>\n      <td>[GO:0051234, GO:0051716, GO:0070727, GO:005164...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>Q9CQV8</td>\n      <td>P68255</td>\n      <td>81.0</td>\n      <td>242</td>\n      <td>46</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>4.080000e-133</td>\n      <td>377.0</td>\n      <td>[GO:0043269, GO:0034763, GO:0034762, GO:005078...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>Q9CQV8</td>\n      <td>P27348</td>\n      <td>81.0</td>\n      <td>242</td>\n      <td>46</td>\n      <td>0</td>\n      <td>3</td>\n      <td>244</td>\n      <td>1</td>\n      <td>242</td>\n      <td>4.080000e-133</td>\n      <td>377.0</td>\n      <td>[GO:0007420, GO:0048856, GO:0065007, GO:190350...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>Q9CQV8</td>\n      <td>P29310</td>\n      <td>78.2</td>\n      <td>243</td>\n      <td>53</td>\n      <td>0</td>\n      <td>2</td>\n      <td>244</td>\n      <td>3</td>\n      <td>245</td>\n      <td>6.820000e-128</td>\n      <td>363.0</td>\n      <td>[GO:0009266, GO:0009967, GO:0019953, GO:000727...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>Q9CQV8</td>\n      <td>Q20655</td>\n      <td>78.4</td>\n      <td>245</td>\n      <td>53</td>\n      <td>0</td>\n      <td>1</td>\n      <td>245</td>\n      <td>1</td>\n      <td>245</td>\n      <td>3.930000e-127</td>\n      <td>362.0</td>\n      <td>[GO:0051641, GO:0048856, GO:0065007, GO:000727...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>Q9CQV8</td>\n      <td>P41932</td>\n      <td>81.5</td>\n      <td>227</td>\n      <td>41</td>\n      <td>1</td>\n      <td>7</td>\n      <td>233</td>\n      <td>7</td>\n      <td>232</td>\n      <td>2.920000e-122</td>\n      <td>349.0</td>\n      <td>[GO:0009266, GO:0019953, GO:0006913, GO:190285...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>Q9CQV8</td>\n      <td>P61982</td>\n      <td>75.8</td>\n      <td>248</td>\n      <td>54</td>\n      <td>3</td>\n      <td>3</td>\n      <td>246</td>\n      <td>2</td>\n      <td>247</td>\n      <td>5.400000e-120</td>\n      <td>343.0</td>\n      <td>[GO:0051234, GO:0070727, GO:0051649, GO:005164...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>P62259</td>\n      <td>P62258</td>\n      <td>100.0</td>\n      <td>255</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1.340000e-177</td>\n      <td>490.0</td>\n      <td>[GO:0009266, GO:0051641, GO:0048856, GO:003450...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>P62259</td>\n      <td>P62261</td>\n      <td>100.0</td>\n      <td>255</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1.340000e-177</td>\n      <td>490.0</td>\n      <td>[GO:0042325, GO:0050790, GO:0065007, GO:004409...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>P62259</td>\n      <td>P62259</td>\n      <td>100.0</td>\n      <td>255</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1.340000e-177</td>\n      <td>490.0</td>\n      <td>[GO:0021766, GO:0048869, GO:0051641, GO:004885...</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>P62259</td>\n      <td>P62260</td>\n      <td>100.0</td>\n      <td>255</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1</td>\n      <td>255</td>\n      <td>1.340000e-177</td>\n      <td>490.0</td>\n      <td>[GO:0051716, GO:0050896, GO:0050789, GO:006500...</td>\n      <td>16</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_df=matches[['qseqid','terms', 'ntargets']].explode('terms').reset_index()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T16:38:15.574972Z","iopub.execute_input":"2023-05-24T16:38:15.575992Z","iopub.status.idle":"2023-05-24T16:38:54.8371Z","shell.execute_reply.started":"2023-05-24T16:38:15.575942Z","shell.execute_reply":"2023-05-24T16:38:54.835622Z"},"trusted":true},"execution_count":33,"outputs":[]},{"cell_type":"code","source":"test_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T16:38:54.839561Z","iopub.execute_input":"2023-05-24T16:38:54.839919Z","iopub.status.idle":"2023-05-24T16:38:54.856897Z","shell.execute_reply.started":"2023-05-24T16:38:54.839888Z","shell.execute_reply":"2023-05-24T16:38:54.855537Z"},"trusted":true},"execution_count":34,"outputs":[{"execution_count":34,"output_type":"execute_result","data":{"text/plain":"   index  qseqid       terms  ntargets\n0      0  Q9CQV8  GO:0051234        16\n1      0  Q9CQV8  GO:0070727        16\n2      0  Q9CQV8  GO:0051649        16\n3      0  Q9CQV8  GO:0051641        16\n4      0  Q9CQV8  GO:0009987        16","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>index</th>\n      <th>qseqid</th>\n      <th>terms</th>\n      <th>ntargets</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051234</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0070727</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051649</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051641</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0009987</td>\n      <td>16</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_df['ntargets']=1/test_df['ntargets']\ntest_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T16:38:54.858651Z","iopub.execute_input":"2023-05-24T16:38:54.859138Z","iopub.status.idle":"2023-05-24T16:38:55.801558Z","shell.execute_reply.started":"2023-05-24T16:38:54.85909Z","shell.execute_reply":"2023-05-24T16:38:55.800476Z"},"trusted":true},"execution_count":35,"outputs":[{"execution_count":35,"output_type":"execute_result","data":{"text/plain":"   index  qseqid       terms  ntargets\n0      0  Q9CQV8  GO:0051234    0.0625\n1      0  Q9CQV8  GO:0070727    0.0625\n2      0  Q9CQV8  GO:0051649    0.0625\n3      0  Q9CQV8  GO:0051641    0.0625\n4      0  Q9CQV8  GO:0009987    0.0625","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>index</th>\n      <th>qseqid</th>\n      <th>terms</th>\n      <th>ntargets</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051234</td>\n      <td>0.0625</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0070727</td>\n      <td>0.0625</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051649</td>\n      <td>0.0625</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0051641</td>\n      <td>0.0625</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>0</td>\n      <td>Q9CQV8</td>\n      <td>GO:0009987</td>\n      <td>0.0625</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"\ntest_df=test_df.groupby(['qseqid', 'terms']).sum().round(3).reset_index()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T16:38:55.803893Z","iopub.execute_input":"2023-05-24T16:38:55.804462Z","iopub.status.idle":"2023-05-24T16:39:31.218143Z","shell.execute_reply.started":"2023-05-24T16:38:55.804428Z","shell.execute_reply":"2023-05-24T16:39:31.216744Z"},"trusted":true},"execution_count":36,"outputs":[]},{"cell_type":"code","source":"test_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-24T16:39:31.220153Z","iopub.execute_input":"2023-05-24T16:39:31.220663Z","iopub.status.idle":"2023-05-24T16:39:31.236895Z","shell.execute_reply.started":"2023-05-24T16:39:31.220612Z","shell.execute_reply":"2023-05-24T16:39:31.235521Z"},"trusted":true},"execution_count":37,"outputs":[{"execution_count":37,"output_type":"execute_result","data":{"text/plain":"       qseqid       terms    index  ntargets\n0  A0A023PXF5  GO:0000722  5019000       0.7\n1  A0A023PXF5  GO:0000723  5019000       0.7\n2  A0A023PXF5  GO:0003674  3584991       0.5\n3  A0A023PXF5  GO:0003678  3584991       0.5\n4  A0A023PXF5  GO:0003824  3584991       0.5","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>qseqid</th>\n      <th>terms</th>\n      <th>index</th>\n      <th>ntargets</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>A0A023PXF5</td>\n      <td>GO:0000722</td>\n      <td>5019000</td>\n      <td>0.7</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>A0A023PXF5</td>\n      <td>GO:0000723</td>\n      <td>5019000</td>\n      <td>0.7</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>A0A023PXF5</td>\n      <td>GO:0003674</td>\n      <td>3584991</td>\n      <td>0.5</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>A0A023PXF5</td>\n      <td>GO:0003678</td>\n      <td>3584991</td>\n      <td>0.5</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>A0A023PXF5</td>\n      <td>GO:0003824</td>\n      <td>3584991</td>\n      <td>0.5</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_df[['qseqid','terms','ntargets']].to_csv(\"submission.tsv\",header=False, index=False, sep=\"\\t\")","metadata":{"execution":{"iopub.status.busy":"2023-05-24T15:57:17.470137Z","iopub.execute_input":"2023-05-24T15:57:17.470651Z","iopub.status.idle":"2023-05-24T15:58:52.453792Z","shell.execute_reply.started":"2023-05-24T15:57:17.470618Z","shell.execute_reply":"2023-05-24T15:58:52.452659Z"},"trusted":true},"execution_count":28,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}