{
  "id": 420931,
  "title": "Everything you need to know | CAFA Protein Prediction",
  "url": "/competitions/cafa-5-protein-function-prediction/discussion/420931",
  "author_name": "",
  "post_date": "2023-07-03T09:12:52.219756600Z",
  "votes": 8,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hey guys, the goal of this discussion is to <code>provide efficient resources</code> to new-comers so that they can catch up with the competition. As I am also exploring the competition, this <code>discussion will be updated as better resources are available</code>.</p>\n<p>This discussion is <code>divided into distinct sections</code>, to improve feasibility</p>\n<h1>1 | Advisory</h1>\n<ul>\n<li>This is a <code>Multilabel-Classification</code> problem</li>\n<li><code>Increasing</code> the number of <code>Neurons</code>/<code>Network Layers</code>, will <code>not</code> provide a <code>significant impact</code> on the <code>results</code>, but rather <code>cost</code> a lot more with <code>GPU</code></li>\n<li>When <code>Trained and Evaluated</code>, <code>TEMPROT</code>, took <code>less training time</code> and gave <code>better results.</code></li>\n</ul>\n<h1>2 | Field Knowledge</h1>\n<hr>\n<p>The competition is about <code>predicting the function of Proteins</code> in the Body</p>\n<hr>\n<p><code>Proteins</code> are made up of <code>long chains of Amino-Acids connected</code> with the help of <code>Peptide-Bonds</code>. Further Amino Acids are made up of mainly 2 molecules named as </p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Amino Group</td>\n<td><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F47c91ebb060a60d80a65cad72bfd79e7%2FAmino%20Group.png?generation=1688372939969645&amp;alt=media\"></td>\n</tr>\n<tr>\n<td>Carboxyl Group</td>\n<td><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F8b56b794e2665247b9e3d9ef55844301%2FCarboxyl%20Group.png?generation=1688373003090699&amp;alt=media\"></td>\n</tr>\n</tbody>\n</table>\n<p>Amino Acid also have a <code>Side Chain</code>, which introduces the possibility of <code>different types of Amino Acids</code>. <code>Different types of Amino Acids</code> group/connect together to form <code>different types of Proteins</code>. <code>Different types of Proteins</code> conduct <code>different Biological Function</code> in the body. </p>\n<p>Our goal is to predict these Biological Functions.</p>\n<hr>\n<p>Gene Ontology is a <code>controlled vocabulary</code> that describes the <code>functions of genes</code> and gene products. </p>\n<p>There are mainly 3 <code>Ontologies</code></p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Biological Process</td>\n<td>Describes the <code>biological processes</code></td>\n<td>A gene product might be involved in the process of <code>cell cycle</code>/<code>signal transduction.</code></td>\n</tr>\n<tr>\n<td>Cellular Component</td>\n<td>Describes the <code>cellular components</code></td>\n<td>A gene product might be located in the <code>nucleus</code>/<code>cytoplasm</code>.</td>\n</tr>\n<tr>\n<td>Molecular Function</td>\n<td>Describes the <code>molecular functions</code></td>\n<td>A gene product might be involved in the <code>catalysis of a reaction</code>/<code>binding of a molecule</code>.</td>\n</tr>\n</tbody>\n</table>\n<p>We are given the GO-Terms and we need to predict the Biological Functions. </p>\n<h1>3 | Data</h1>\n<hr>\n<p><code>Go-Basic.obo</code> file has the information of <code>GO-terms particular with Ontologies</code> </p>\n<pre><code>subontology_roots = {'BPO':'GO:0',\n                     'CCO':'GO:5',\n                     'MFO':'GO:4'}\n</code></pre>\n<p>When <code>read/printined</code></p>\n<pre><code>[Term]\n GO:\n mitochondrion inheritance\n biological_process\n  [GOC:mcc, PMID:, PMID:]\n  EXACT []\n GO: ! organelle inheritance\n GO: ! mitochondrion distribution\n</code></pre>\n<hr>\n<p><code>Train-Fasta.fasta</code> is a <code>Fasta</code> Sequence conatining the Protein Sequences which can be read</p>\n<pre><code> Bio  SeqIO\n\nfasta_seq = SeqIO.parse((\"/kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta\") ,)\n</code></pre>\n<p><br>\nUpon getting deep, the Sequence looks like this </p>\n<pre><code>(SeqRecord(=Seq('HCISSLKLTAFFKRSFLLSPEKHLVLLRDGRTLIGFLRSIDQFANLVLHQTVER...DEY'), =, =, =, dbxrefs=[])\n</code></pre>\n<p>These can be distincitlvely reached by functions such as <code>sequence.seq</code>/<code>sequence.id</code>, where sequence is a object of the Fasta Files. We can get the object by iterating over the Fasta Files as </p>\n<pre><code>for   fasta_seq:\n</code></pre>\n<hr>\n<p><code>Train-Terms.tsv</code> is a tsv file containing the <code>main training data</code>like this </p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>EntryID</th>\n<th>term</th>\n<th>aspect</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>0</td>\n<td>A0A009IHW8</td>\n<td>GO:0008152</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>1</td>\n<td>A0A009IHW8</td>\n<td>GO:0034655</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>2</td>\n<td>A0A009IHW8</td>\n<td>GO:0072523</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>3</td>\n<td>A0A009IHW8</td>\n<td>GO:0044270</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>4</td>\n<td>A0A009IHW8</td>\n<td>GO:0006753</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>…</td>\n<td>…</td>\n<td>…</td>\n<td>…</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>The <code>Test</code> <code>Set</code> is <code>unknown at the beginning</code> of the competition. It will contain <code>protein sequences</code> <code>their functions</code> from the <code>test superset</code> that <code>gained experimental annotations</code> between the <code>submission-deadline</code> and the <code>time of evaluation</code>.</p>\n<h1>4 | Pytorch DataLoader</h1>\n<p>Here is the <code>Pytorch Dataloader</code>  with <code>O(1)</code> <code>Time-Complexity</code> and <code>O(n)</code> <code>Space-Complexity</code>. This uses the following additional datasets</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><a href=\"https://www.kaggle.com/datasets/siddhvr/train-targets-top500\" target=\"_blank\">train_targets_top500</a></td>\n<td>Top 500 targets</td>\n</tr>\n</tbody>\n</table>\n<pre><code> numpy  np\n\n torch\n torch.utils.data  Dataset\n\n ():\n\n     ():\n        (Pytorch_Dataset).__init__()\n\n        self.datatype = datatype\n        self.embeds = np.load()\n\n         datatype == :\n\n            self.targets = np.load()[:self.embeds.shape[]]\n\n     (): self.targets.shape[]\n\n     ():\n\n        r_embed = torch.tensor(self.embeds[index] , dtype = torch.float32)\n\n         self.datatype == :\n\n            r_targets = torch.tensor(self.targets[index], dtype = torch.float32)\n\n             r_embed, r_targets\n\n         r_embed\n</code></pre>\n<h1>5 | Sources</h1>\n<h3>Data</h3>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/gusthema/cafa-5-protein-function-with-tensorflow\" target=\"_blank\">CAFA 5 protein function with TensorFlow</a> - <a href=\"https://www.kaggle.com/gusthema\" target=\"_blank\">Gusthema</a>,<a href=\"https://www.kaggle.com/elliot2robot\" target=\"_blank\">elliot robot</a></li>\n</ul>\n<h3>Pytorch DataLoader</h3>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/code/henriupton/proteinet-pytorch-ems2-t5-protbert-embeddings\" target=\"_blank\">ProteiNet 🧬 PyTorch+EMS2/T5/ProtBERT Embedding</a> - <a href=\"https://www.kaggle.com/henriupton\" target=\"_blank\">Henri Upton</a></p></li>\n<li><p><a href=\"https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-023-05375-0\" target=\"_blank\">TEMPROT: protein function annotation using transformers embeddings and homology search</a></p></li>\n</ul>",
  "messages": [
    {
      "id": "2327969",
      "postDate": "07/03/2023 09:12:52",
      "content": "<p>Hey guys, the goal of this discussion is to <code>provide efficient resources</code> to new-comers so that they can catch up with the competition. As I am also exploring the competition, this <code>discussion will be updated as better resources are available</code>.</p>\n<p>This discussion is <code>divided into distinct sections</code>, to improve feasibility</p>\n<h1>1 | Advisory</h1>\n<ul>\n<li>This is a <code>Multilabel-Classification</code> problem</li>\n<li><code>Increasing</code> the number of <code>Neurons</code>/<code>Network Layers</code>, will <code>not</code> provide a <code>significant impact</code> on the <code>results</code>, but rather <code>cost</code> a lot more with <code>GPU</code></li>\n<li>When <code>Trained and Evaluated</code>, <code>TEMPROT</code>, took <code>less training time</code> and gave <code>better results.</code></li>\n</ul>\n<h1>2 | Field Knowledge</h1>\n<hr>\n<p>The competition is about <code>predicting the function of Proteins</code> in the Body</p>\n<hr>\n<p><code>Proteins</code> are made up of <code>long chains of Amino-Acids connected</code> with the help of <code>Peptide-Bonds</code>. Further Amino Acids are made up of mainly 2 molecules named as </p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Amino Group</td>\n<td><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F47c91ebb060a60d80a65cad72bfd79e7%2FAmino%20Group.png?generation=1688372939969645&amp;alt=media\"></td>\n</tr>\n<tr>\n<td>Carboxyl Group</td>\n<td><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F8b56b794e2665247b9e3d9ef55844301%2FCarboxyl%20Group.png?generation=1688373003090699&amp;alt=media\"></td>\n</tr>\n</tbody>\n</table>\n<p>Amino Acid also have a <code>Side Chain</code>, which introduces the possibility of <code>different types of Amino Acids</code>. <code>Different types of Amino Acids</code> group/connect together to form <code>different types of Proteins</code>. <code>Different types of Proteins</code> conduct <code>different Biological Function</code> in the body. </p>\n<p>Our goal is to predict these Biological Functions.</p>\n<hr>\n<p>Gene Ontology is a <code>controlled vocabulary</code> that describes the <code>functions of genes</code> and gene products. </p>\n<p>There are mainly 3 <code>Ontologies</code></p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Biological Process</td>\n<td>Describes the <code>biological processes</code></td>\n<td>A gene product might be involved in the process of <code>cell cycle</code>/<code>signal transduction.</code></td>\n</tr>\n<tr>\n<td>Cellular Component</td>\n<td>Describes the <code>cellular components</code></td>\n<td>A gene product might be located in the <code>nucleus</code>/<code>cytoplasm</code>.</td>\n</tr>\n<tr>\n<td>Molecular Function</td>\n<td>Describes the <code>molecular functions</code></td>\n<td>A gene product might be involved in the <code>catalysis of a reaction</code>/<code>binding of a molecule</code>.</td>\n</tr>\n</tbody>\n</table>\n<p>We are given the GO-Terms and we need to predict the Biological Functions. </p>\n<h1>3 | Data</h1>\n<hr>\n<p><code>Go-Basic.obo</code> file has the information of <code>GO-terms particular with Ontologies</code> </p>\n<pre><code>subontology_roots = {'BPO':'GO:0',\n                     'CCO':'GO:5',\n                     'MFO':'GO:4'}\n</code></pre>\n<p>When <code>read/printined</code></p>\n<pre><code>[Term]\n GO:\n mitochondrion inheritance\n biological_process\n  [GOC:mcc, PMID:, PMID:]\n  EXACT []\n GO: ! organelle inheritance\n GO: ! mitochondrion distribution\n</code></pre>\n<hr>\n<p><code>Train-Fasta.fasta</code> is a <code>Fasta</code> Sequence conatining the Protein Sequences which can be read</p>\n<pre><code> Bio  SeqIO\n\nfasta_seq = SeqIO.parse((\"/kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta\") ,)\n</code></pre>\n<p><br>\nUpon getting deep, the Sequence looks like this </p>\n<pre><code>(SeqRecord(=Seq('HCISSLKLTAFFKRSFLLSPEKHLVLLRDGRTLIGFLRSIDQFANLVLHQTVER...DEY'), =, =, =, dbxrefs=[])\n</code></pre>\n<p>These can be distincitlvely reached by functions such as <code>sequence.seq</code>/<code>sequence.id</code>, where sequence is a object of the Fasta Files. We can get the object by iterating over the Fasta Files as </p>\n<pre><code>for   fasta_seq:\n</code></pre>\n<hr>\n<p><code>Train-Terms.tsv</code> is a tsv file containing the <code>main training data</code>like this </p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>EntryID</th>\n<th>term</th>\n<th>aspect</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>0</td>\n<td>A0A009IHW8</td>\n<td>GO:0008152</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>1</td>\n<td>A0A009IHW8</td>\n<td>GO:0034655</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>2</td>\n<td>A0A009IHW8</td>\n<td>GO:0072523</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>3</td>\n<td>A0A009IHW8</td>\n<td>GO:0044270</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>4</td>\n<td>A0A009IHW8</td>\n<td>GO:0006753</td>\n<td>BPO</td>\n</tr>\n<tr>\n<td>…</td>\n<td>…</td>\n<td>…</td>\n<td>…</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>The <code>Test</code> <code>Set</code> is <code>unknown at the beginning</code> of the competition. It will contain <code>protein sequences</code> <code>their functions</code> from the <code>test superset</code> that <code>gained experimental annotations</code> between the <code>submission-deadline</code> and the <code>time of evaluation</code>.</p>\n<h1>4 | Pytorch DataLoader</h1>\n<p>Here is the <code>Pytorch Dataloader</code>  with <code>O(1)</code> <code>Time-Complexity</code> and <code>O(n)</code> <code>Space-Complexity</code>. This uses the following additional datasets</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><a href=\"https://www.kaggle.com/datasets/siddhvr/train-targets-top500\" target=\"_blank\">train_targets_top500</a></td>\n<td>Top 500 targets</td>\n</tr>\n</tbody>\n</table>\n<pre><code> numpy  np\n\n torch\n torch.utils.data  Dataset\n\n ():\n\n     ():\n        (Pytorch_Dataset).__init__()\n\n        self.datatype = datatype\n        self.embeds = np.load()\n\n         datatype == :\n\n            self.targets = np.load()[:self.embeds.shape[]]\n\n     (): self.targets.shape[]\n\n     ():\n\n        r_embed = torch.tensor(self.embeds[index] , dtype = torch.float32)\n\n         self.datatype == :\n\n            r_targets = torch.tensor(self.targets[index], dtype = torch.float32)\n\n             r_embed, r_targets\n\n         r_embed\n</code></pre>\n<h1>5 | Sources</h1>\n<h3>Data</h3>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/gusthema/cafa-5-protein-function-with-tensorflow\" target=\"_blank\">CAFA 5 protein function with TensorFlow</a> - <a href=\"https://www.kaggle.com/gusthema\" target=\"_blank\">Gusthema</a>,<a href=\"https://www.kaggle.com/elliot2robot\" target=\"_blank\">elliot robot</a></li>\n</ul>\n<h3>Pytorch DataLoader</h3>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/code/henriupton/proteinet-pytorch-ems2-t5-protbert-embeddings\" target=\"_blank\">ProteiNet 🧬 PyTorch+EMS2/T5/ProtBERT Embedding</a> - <a href=\"https://www.kaggle.com/henriupton\" target=\"_blank\">Henri Upton</a></p></li>\n<li><p><a href=\"https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-023-05375-0\" target=\"_blank\">TEMPROT: protein function annotation using transformers embeddings and homology search</a></p></li>\n</ul>",
      "rawMarkdown": "Hey guys, the goal of this discussion is to `provide efficient resources` to new-comers so that they can catch up with the competition. As I am also exploring the competition, this `discussion will be updated as better resources are available`.\n\nThis discussion is `divided into distinct sections`, to improve feasibility\n\n# 1 | Advisory \n\n* This is a `Multilabel-Classification` problem\n* `Increasing` the number of `Neurons`/`Network Layers`, will `not` provide a `significant impact` on the `results`, but rather `cost` a lot more with `GPU`\n* When `Trained and Evaluated`, `TEMPROT`, took `less training time` and gave `better results.`\n\n# 2 | Field Knowledge\n****\nThe competition is about `predicting the function of Proteins` in the Body\n****\n`Proteins` are made up of `long chains of Amino-Acids connected` with the help of `Peptide-Bonds`. Further Amino Acids are made up of mainly 2 molecules named as \n\n|||\n|---|---\n|Amino Group|<img src = \"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F47c91ebb060a60d80a65cad72bfd79e7%2FAmino%20Group.png?generation=1688372939969645&alt=media\">\n|Carboxyl Group|<img src = \"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F8b56b794e2665247b9e3d9ef55844301%2FCarboxyl%20Group.png?generation=1688373003090699&alt=media\">\n\nAmino Acid also have a `Side Chain`, which introduces the possibility of `different types of Amino Acids`. `Different types of Amino Acids` group/connect together to form `different types of Proteins`. `Different types of Proteins` conduct `different Biological Function` in the body. \n\nOur goal is to predict these Biological Functions.\n\n****\n\nGene Ontology is a `controlled vocabulary` that describes the `functions of genes` and gene products. \n\nThere are mainly 3 `Ontologies`\n\n||||\n|---|---|---\n|Biological Process|Describes the `biological processes`|A gene product might be involved in the process of `cell cycle`/`signal transduction.`\n|Cellular Component|Describes the `cellular components`|A gene product might be located in the `nucleus`/`cytoplasm`.\n|Molecular Function|Describes the `molecular functions`|A gene product might be involved in the `catalysis of a reaction`/`binding of a molecule`.\n\nWe are given the GO-Terms and we need to predict the Biological Functions. \n\n# 3 | Data\n****\n`Go-Basic.obo` file has the information of `GO-terms particular with Ontologies` \n```\nsubontology_roots = {'BPO':'GO:0008150',\n                     'CCO':'GO:0005575',\n                     'MFO':'GO:0003674'}\n```\nWhen `read/printined`\n```\n[Term]\nid: GO:0000001\nname: mitochondrion inheritance\nnamespace: biological_process\ndef: \"The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.\" [GOC:mcc, PMID:10873824, PMID:11389764]\nsynonym: \"mitochondrial inheritance\" EXACT []\nis_a: GO:0048308 ! organelle inheritance\nis_a: GO:0048311 ! mitochondrion distribution\n```\n****\n`Train-Fasta.fasta` is a `Fasta` Sequence conatining the Protein Sequences which can be read\n```\nfrom Bio import SeqIO\n\nfasta_seq = SeqIO.parse(open(\"/kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta\") ,'fasta')\n``` \nUpon getting deep, the Sequence looks like this \n```\n(SeqRecord(seq=Seq('HCISSLKLTAFFKRSFLLSPEKHLVLLRDGRTLIGFLRSIDQFANLVLHQTVER...DEY'), id='A0A8I6GHU0', name='A0A8I6GHU0', description='A0A8I6GHU0 tr|A0A8I6GHU0|A0A8I6GHU0_RAT U6 snRNA-associated Sm-like protein LSm1 OS=Rattus norvegicus OX=10116 GN=Lsm1 PE=3 SV=1', dbxrefs=[])\n```\nThese can be distincitlvely reached by functions such as `sequence.seq`/`sequence.id`, where sequence is a object of the Fasta Files. We can get the object by iterating over the Fasta Files as \n```\nfor sequence in fasta_seq:pass\n```\n****\n`Train-Terms.tsv` is a tsv file containing the `main training data `like this \n\n||EntryID|term|aspect\n|---|---|---|---\n|0|A0A009IHW8|GO:0008152|BPO\n|1|A0A009IHW8|GO:0034655|BPO\n|2|A0A009IHW8|GO:0072523|BPO\n|3|A0A009IHW8|GO:0044270|BPO\n|4|A0A009IHW8|GO:0006753|BPO\n|...|...|...|...\n****\nThe `Test` `Set` is `unknown at the beginning` of the competition. It will contain `protein sequences` `their functions` from the `test superset` that `gained experimental annotations` between the `submission-deadline` and the `time of evaluation`.\n\n# 4 | Pytorch DataLoader \nHere is the `Pytorch Dataloader`  with `O(1)` `Time-Complexity` and `O(n)` `Space-Complexity`. This uses the following additional datasets\n\n|||\n|---|---\n|[train_targets_top500](https://www.kaggle.com/datasets/siddhvr/train-targets-top500)|Top 500 targets\n\n```\nimport numpy as np\n\nimport torch\nfrom torch.utils.data import Dataset\n\nclass Pytorch_Dataset(Dataset):\n\n    def __init__(self , datatype ):\n        super(Pytorch_Dataset).__init__()\n\n        self.datatype = datatype\n        self.embeds = np.load(\"/kaggle/input/cafa-sample-embeddings/Embeddings/T5-Prot-BERT BFD/Train/Embeds.npy\")\n        \n        if datatype == \"train\":\n\n            self.targets = np.load(\"/kaggle/input/train-targets-top500/train_targets_top500.npy\")[:self.embeds.shape[0]]\n            \n    def __len__(self):return self.targets.shape[0]\n\n    def __getitem__(self , index):\n\n        r_embed = torch.tensor(self.embeds[index] , dtype = torch.float32)\n\n        if self.datatype == \"train\":\n\n            r_targets = torch.tensor(self.targets[index], dtype = torch.float32)\n\n            return r_embed, r_targets\n\n        return r_embed\n```\n\n# 5 | Sources \n\n### Data\n\n* [CAFA 5 protein function with TensorFlow](https://www.kaggle.com/code/gusthema/cafa-5-protein-function-with-tensorflow) - [Gusthema](https://www.kaggle.com/gusthema),[elliot robot](https://www.kaggle.com/elliot2robot)\n\n### Pytorch DataLoader \n\n* [ProteiNet 🧬 PyTorch+EMS2/T5/ProtBERT Embedding](https://www.kaggle.com/code/henriupton/proteinet-pytorch-ems2-t5-protbert-embeddings) - [Henri Upton](https://www.kaggle.com/henriupton)\n\n* [TEMPROT: protein function annotation using transformers embeddings and homology search](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-023-05375-0)",
      "votes": null
    },
    {
      "id": "2328483",
      "postDate": "07/03/2023 15:59:25",
      "content": "<p><a href=\"https://www.kaggle.com/ayushs9020\" target=\"_blank\">@ayushs9020</a> hi<br>\nDo you like to come to zoom meeting now:):</p>\n<p><a href=\"https://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09\" target=\"_blank\">https://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09</a></p>\n<p>?</p>",
      "rawMarkdown": "ayushs9020 hi\nDo you like to come to zoom meeting now:):\n\nhttps://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09\n\n?",
      "votes": null
    },
    {
      "id": "2329250",
      "postDate": "07/04/2023 06:59:19",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/liudacheldieva\" target=\"_blank\">@liudacheldieva</a> , sorry for replying you late, Kaggle didn't notified me.</p>\n<p>Actually I am <code>currently not in a situation to attend a zoom meeting</code>, because of several reasons. It would be great if <code>we could communicate</code> over <code>Mail</code>/<code>Linkedin</code>.</p>\n<ul>\n<li>Mail - <a href=\"mailto:ayushsinghal659@gmail.com\">ayushsinghal659@gmail.com</a></li>\n<li>Linkedin - <a href=\"https://www.linkedin.com/in/ayush-singhal-a0614a221/\" target=\"_blank\">Ayush Singhal</a></li>\n</ul>\n<p>Hope you will not mind :)</p>",
      "rawMarkdown": "Hi @liudacheldieva , sorry for replying you late, Kaggle didn't notified me.\n\nActually I am `currently not in a situation to attend a zoom meeting`, because of several reasons. It would be great if `we could communicate` over `Mail`/`Linkedin`.\n\n* Mail - ayushsinghal659@gmail.com\n* Linkedin - [Ayush Singhal](https://www.linkedin.com/in/ayush-singhal-a0614a221/)\n\nHope you will not mind :)",
      "votes": null
    },
    {
      "id": "2331596",
      "postDate": "07/05/2023 16:39:35",
      "content": "<p>You are welcome to do as you wish, but here is a simple reminder: private communications is generally not allowed except between group members, or at least potential group members. There is a reason why they are organizing public Zoom meetings.</p>\n<p>You may want to read the rules section.</p>\n<p><a href=\"https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules\" target=\"_blank\">https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules</a></p>",
      "rawMarkdown": "You are welcome to do as you wish, but here is a simple reminder: private communications is generally not allowed except between group members, or at least potential group members. There is a reason why they are organizing public Zoom meetings.\n\nYou may want to read the rules section.\n\nhttps://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2328483,
      "author_name": "",
      "author_url": "",
      "post_date": "07/03/2023 15:59:25",
      "content": "<p><a href=\"https://www.kaggle.com/ayushs9020\" target=\"_blank\">@ayushs9020</a> hi<br>\nDo you like to come to zoom meeting now:):</p>\n<p><a href=\"https://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09\" target=\"_blank\">https://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09</a></p>\n<p>?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2329250,
          "author_name": "ayushs9020",
          "author_url": "",
          "post_date": "07/04/2023 06:59:19",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/liudacheldieva\" target=\"_blank\">@liudacheldieva</a> , sorry for replying you late, Kaggle didn't notified me.</p>\n<p>Actually I am <code>currently not in a situation to attend a zoom meeting</code>, because of several reasons. It would be great if <code>we could communicate</code> over <code>Mail</code>/<code>Linkedin</code>.</p>\n<ul>\n<li>Mail - <a href=\"mailto:ayushsinghal659@gmail.com\">ayushsinghal659@gmail.com</a></li>\n<li>Linkedin - <a href=\"https://www.linkedin.com/in/ayush-singhal-a0614a221/\" target=\"_blank\">Ayush Singhal</a></li>\n</ul>\n<p>Hope you will not mind :)</p>",
          "votes": null,
          "replies": [
            {
              "id": 2331596,
              "author_name": "tilii7",
              "author_url": "",
              "post_date": "07/05/2023 16:39:35",
              "content": "<p>You are welcome to do as you wish, but here is a simple reminder: private communications is generally not allowed except between group members, or at least potential group members. There is a reason why they are organizing public Zoom meetings.</p>\n<p>You may want to read the rules section.</p>\n<p><a href=\"https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules\" target=\"_blank\">https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules</a></p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2327969": "Hey guys, the goal of this discussion is to `provide efficient resources` to new-comers so that they can catch up with the competition. As I am also exploring the competition, this `discussion will be updated as better resources are available`.\n\nThis discussion is `divided into distinct sections`, to improve feasibility\n\n# 1 | Advisory \n\n* This is a `Multilabel-Classification` problem\n* `Increasing` the number of `Neurons`/`Network Layers`, will `not` provide a `significant impact` on the `results`, but rather `cost` a lot more with `GPU`\n* When `Trained and Evaluated`, `TEMPROT`, took `less training time` and gave `better results.`\n\n# 2 | Field Knowledge\n****\nThe competition is about `predicting the function of Proteins` in the Body\n****\n`Proteins` are made up of `long chains of Amino-Acids connected` with the help of `Peptide-Bonds`. Further Amino Acids are made up of mainly 2 molecules named as \n\n|||\n|---|---\n|Amino Group|<img src = \"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F47c91ebb060a60d80a65cad72bfd79e7%2FAmino%20Group.png?generation=1688372939969645&alt=media\">\n|Carboxyl Group|<img src = \"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9711370%2F8b56b794e2665247b9e3d9ef55844301%2FCarboxyl%20Group.png?generation=1688373003090699&alt=media\">\n\nAmino Acid also have a `Side Chain`, which introduces the possibility of `different types of Amino Acids`. `Different types of Amino Acids` group/connect together to form `different types of Proteins`. `Different types of Proteins` conduct `different Biological Function` in the body. \n\nOur goal is to predict these Biological Functions.\n\n****\n\nGene Ontology is a `controlled vocabulary` that describes the `functions of genes` and gene products. \n\nThere are mainly 3 `Ontologies`\n\n||||\n|---|---|---\n|Biological Process|Describes the `biological processes`|A gene product might be involved in the process of `cell cycle`/`signal transduction.`\n|Cellular Component|Describes the `cellular components`|A gene product might be located in the `nucleus`/`cytoplasm`.\n|Molecular Function|Describes the `molecular functions`|A gene product might be involved in the `catalysis of a reaction`/`binding of a molecule`.\n\nWe are given the GO-Terms and we need to predict the Biological Functions. \n\n# 3 | Data\n****\n`Go-Basic.obo` file has the information of `GO-terms particular with Ontologies` \n```\nsubontology_roots = {'BPO':'GO:0008150',\n                     'CCO':'GO:0005575',\n                     'MFO':'GO:0003674'}\n```\nWhen `read/printined`\n```\n[Term]\nid: GO:0000001\nname: mitochondrion inheritance\nnamespace: biological_process\ndef: \"The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.\" [GOC:mcc, PMID:10873824, PMID:11389764]\nsynonym: \"mitochondrial inheritance\" EXACT []\nis_a: GO:0048308 ! organelle inheritance\nis_a: GO:0048311 ! mitochondrion distribution\n```\n****\n`Train-Fasta.fasta` is a `Fasta` Sequence conatining the Protein Sequences which can be read\n```\nfrom Bio import SeqIO\n\nfasta_seq = SeqIO.parse(open(\"/kaggle/input/cafa-5-protein-function-prediction/Train/train_sequences.fasta\") ,'fasta')\n``` \nUpon getting deep, the Sequence looks like this \n```\n(SeqRecord(seq=Seq('HCISSLKLTAFFKRSFLLSPEKHLVLLRDGRTLIGFLRSIDQFANLVLHQTVER...DEY'), id='A0A8I6GHU0', name='A0A8I6GHU0', description='A0A8I6GHU0 tr|A0A8I6GHU0|A0A8I6GHU0_RAT U6 snRNA-associated Sm-like protein LSm1 OS=Rattus norvegicus OX=10116 GN=Lsm1 PE=3 SV=1', dbxrefs=[])\n```\nThese can be distincitlvely reached by functions such as `sequence.seq`/`sequence.id`, where sequence is a object of the Fasta Files. We can get the object by iterating over the Fasta Files as \n```\nfor sequence in fasta_seq:pass\n```\n****\n`Train-Terms.tsv` is a tsv file containing the `main training data `like this \n\n||EntryID|term|aspect\n|---|---|---|---\n|0|A0A009IHW8|GO:0008152|BPO\n|1|A0A009IHW8|GO:0034655|BPO\n|2|A0A009IHW8|GO:0072523|BPO\n|3|A0A009IHW8|GO:0044270|BPO\n|4|A0A009IHW8|GO:0006753|BPO\n|...|...|...|...\n****\nThe `Test` `Set` is `unknown at the beginning` of the competition. It will contain `protein sequences` `their functions` from the `test superset` that `gained experimental annotations` between the `submission-deadline` and the `time of evaluation`.\n\n# 4 | Pytorch DataLoader \nHere is the `Pytorch Dataloader`  with `O(1)` `Time-Complexity` and `O(n)` `Space-Complexity`. This uses the following additional datasets\n\n|||\n|---|---\n|[train_targets_top500](https://www.kaggle.com/datasets/siddhvr/train-targets-top500)|Top 500 targets\n\n```\nimport numpy as np\n\nimport torch\nfrom torch.utils.data import Dataset\n\nclass Pytorch_Dataset(Dataset):\n\n    def __init__(self , datatype ):\n        super(Pytorch_Dataset).__init__()\n\n        self.datatype = datatype\n        self.embeds = np.load(\"/kaggle/input/cafa-sample-embeddings/Embeddings/T5-Prot-BERT BFD/Train/Embeds.npy\")\n        \n        if datatype == \"train\":\n\n            self.targets = np.load(\"/kaggle/input/train-targets-top500/train_targets_top500.npy\")[:self.embeds.shape[0]]\n            \n    def __len__(self):return self.targets.shape[0]\n\n    def __getitem__(self , index):\n\n        r_embed = torch.tensor(self.embeds[index] , dtype = torch.float32)\n\n        if self.datatype == \"train\":\n\n            r_targets = torch.tensor(self.targets[index], dtype = torch.float32)\n\n            return r_embed, r_targets\n\n        return r_embed\n```\n\n# 5 | Sources \n\n### Data\n\n* [CAFA 5 protein function with TensorFlow](https://www.kaggle.com/code/gusthema/cafa-5-protein-function-with-tensorflow) - [Gusthema](https://www.kaggle.com/gusthema),[elliot robot](https://www.kaggle.com/elliot2robot)\n\n### Pytorch DataLoader \n\n* [ProteiNet 🧬 PyTorch+EMS2/T5/ProtBERT Embedding](https://www.kaggle.com/code/henriupton/proteinet-pytorch-ems2-t5-protbert-embeddings) - [Henri Upton](https://www.kaggle.com/henriupton)\n\n* [TEMPROT: protein function annotation using transformers embeddings and homology search](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-023-05375-0)",
    "2328483": "ayushs9020 hi\nDo you like to come to zoom meeting now:):\n\nhttps://us02web.zoom.us/j/84239724288?pwd=L3hQSXRTaUppWlpmWEs5SUFzMitUZz09\n\n?",
    "2329250": "Hi @liudacheldieva , sorry for replying you late, Kaggle didn't notified me.\n\nActually I am `currently not in a situation to attend a zoom meeting`, because of several reasons. It would be great if `we could communicate` over `Mail`/`Linkedin`.\n\n* Mail - ayushsinghal659@gmail.com\n* Linkedin - [Ayush Singhal](https://www.linkedin.com/in/ayush-singhal-a0614a221/)\n\nHope you will not mind :)",
    "2331596": "You are welcome to do as you wish, but here is a simple reminder: private communications is generally not allowed except between group members, or at least potential group members. There is a reason why they are organizing public Zoom meetings.\n\nYou may want to read the rules section.\n\nhttps://www.kaggle.com/competitions/cafa-5-protein-function-prediction/rules"
  },
  "source": "meta"
}