andrewdalpino commited on
Commit
30a189a
·
verified ·
1 Parent(s): 322d9f6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -20
README.md CHANGED
@@ -4,7 +4,7 @@ tags:
4
  - gene-ontology
5
  - proteomics
6
  datasets:
7
- - andrewdalpino/CAFA5
8
  metrics:
9
  - precision
10
  - recall
@@ -16,9 +16,17 @@ pipeline_tag: text-classification
16
 
17
  # ESM2 Protein Function Caller
18
 
19
- An Evolutionary-scale Model (ESM) for protein function calling from amino acid sequences. Based on the ESM2 Transformer architecture and fine-tuned on the [CAFA 5](https://huggingface.co/datasets/andrewdalpino/CAFA5) dataset, this model predicts the gene ontology (GO) subgraph for a particular protein sequence - giving you insight into the molecular function, biological process, and location of the activity inside the cell.
20
 
21
- **Note**: This model specializes on the `molecular function` subgraph of the gene ontology.
 
 
 
 
 
 
 
 
22
 
23
  ## Code Repository
24
 
@@ -31,16 +39,17 @@ https://github.com/andrewdalpino/esm2-function-classifier
31
  - **Attention Heads**: 20
32
  - **Encoder Layers**: 30
33
  - **Context Length**: 1026
34
- - **Total Parameters**: 153M
35
 
36
- ## Example Usage
 
 
37
 
38
  ```python
39
  import torch
40
 
41
  from transformers import EsmTokenizer, EsmForSequenceClassification
42
 
43
- model_name = "andrewdalpino/ESM2-150M-Protein-Molecular-Function"
44
 
45
  tokenizer = EsmTokenizer.from_pretrained(model_name)
46
 
@@ -48,15 +57,11 @@ model = EsmForSequenceClassification.from_pretrained(model_name)
48
 
49
  model.eval()
50
 
51
- sequence = "MCNAWYISVDFEKNREDKSKCIHTRRNSGPKLLEHVMYEVLRDWYCLEGENVYMMGKKWQMPMCSLH"
52
 
53
  top_k = 10
54
 
55
- out = tokenizer(
56
- sequence,
57
- max_length=1026,
58
- truncation=True,
59
- )
60
 
61
  input_ids = out["input_ids"]
62
 
@@ -79,17 +84,9 @@ for term, probability in zip(terms, probabilities):
79
  print(f"{probability:.4f}: {term}")
80
  ```
81
 
82
- ## Training Results
83
-
84
- - **Epochs**: 20
85
- - **Test F1**: 0.66
86
- - **Test Precision**: 0.75
87
- - **Test Recall**: 0.60
88
-
89
  ## References:
90
 
91
  >- A. Rives, et al. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences, 2021.
92
  >- Z. Lin, et al. Evolutionary-scale prediction of atomic level protein structure with a language model, 2022.
93
  >- G. A. Merino, et al. Hierarchical deep learning for predicting GO annotations by integrating protein knowledge, 2022.
94
- >- I. Friedberg, et al. CAFA 5 Protein Function Prediction. https://kaggle.com/competitions/cafa-5-protein-function-prediction, 2023.
95
  >- M. Ashburner, et al. Gene Ontology: tool for the unification of biology, 2000.
 
4
  - gene-ontology
5
  - proteomics
6
  datasets:
7
+ - andrewdalpino/AmiGO
8
  metrics:
9
  - precision
10
  - recall
 
16
 
17
  # ESM2 Protein Function Caller
18
 
19
+ An Evolutionary-scale Model (ESM) for protein function prediction from amino acid sequences using the Gene Ontology (GO). Based on the ESM2 Transformer architecture, pre-trained on [UniRef50](https://www.uniprot.org/help/uniref), and fine-tuned on the [AmiGO](https://huggingface.co/datasets/andrewdalpino/AmiGO) dataset, this model predicts the GO subgraph for a particular protein sequence - giving you insight into the molecular function, biological process, and location of the activity inside the cell.
20
 
21
+ **Note**: This version only models the `molecular function` subgraph of the gene ontology.
22
+
23
+ ## What are GO terms?
24
+
25
+ > "The Gene Ontology (GO) is a concept hierarchy that describes the biological function of genes and gene products at different levels of abstraction (Ashburner et al., 2000). It is a good model to describe the multi-faceted nature of protein function."
26
+
27
+ > "GO is a directed acyclic graph. The nodes in this graph are functional descriptors (terms or classes) connected by relational ties between them (is_a, part_of, etc.). For example, terms 'protein binding activity' and 'binding activity' are related by an is_a relationship; however, the edge in the graph is often reversed to point from binding towards protein binding. This graph contains three subgraphs (subontologies): Molecular Function (MF), Biological Process (BP), and Cellular Component (CC), defined by their root nodes. Biologically, each subgraph represent a different aspect of the protein's function: what it does on a molecular level (MF), which biological processes it participates in (BP) and where in the cell it is located (CC)."
28
+
29
+ From [CAFA 5 Protein Function Prediction](https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/data)
30
 
31
  ## Code Repository
32
 
 
39
  - **Attention Heads**: 20
40
  - **Encoder Layers**: 30
41
  - **Context Length**: 1026
 
42
 
43
+ ## Basic Example
44
+
45
+ For a basic demonstration we can rank the GO terms for a particular sequence. For a more advanced example see the [predict-subgraph.py](https://github.com/andrewdalpino/esm2-function-classifier/blob/master/predict-subgraph.py) source file.
46
 
47
  ```python
48
  import torch
49
 
50
  from transformers import EsmTokenizer, EsmForSequenceClassification
51
 
52
+ model_name = "andrewdalpino/ESM2-35M-Protein-Molecular-Function"
53
 
54
  tokenizer = EsmTokenizer.from_pretrained(model_name)
55
 
 
57
 
58
  model.eval()
59
 
60
+ sequence = "MCNAWYISVDFEKNREDKSKCIHTRRNSGPKLLEHVMYEVLRDWYCLEGENVYMM"
61
 
62
  top_k = 10
63
 
64
+ out = tokenizer(sequence)
 
 
 
 
65
 
66
  input_ids = out["input_ids"]
67
 
 
84
  print(f"{probability:.4f}: {term}")
85
  ```
86
 
 
 
 
 
 
 
 
87
  ## References:
88
 
89
  >- A. Rives, et al. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences, 2021.
90
  >- Z. Lin, et al. Evolutionary-scale prediction of atomic level protein structure with a language model, 2022.
91
  >- G. A. Merino, et al. Hierarchical deep learning for predicting GO annotations by integrating protein knowledge, 2022.
 
92
  >- M. Ashburner, et al. Gene Ontology: tool for the unification of biology, 2000.