Update README.md
Browse files
README.md
CHANGED
|
@@ -16,9 +16,17 @@ pipeline_tag: text-classification
|
|
| 16 |
|
| 17 |
# ESM2 Protein Function Caller
|
| 18 |
|
| 19 |
-
An Evolutionary-scale Model (ESM) for protein function
|
| 20 |
|
| 21 |
-
**Note**: This
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Code Repository
|
| 24 |
|
|
@@ -29,18 +37,19 @@ https://github.com/andrewdalpino/esm2-function-classifier
|
|
| 29 |
- **Vocabulary Size**: 33
|
| 30 |
- **Embedding Dimensions**: 640
|
| 31 |
- **Attention Heads**: 20
|
| 32 |
-
- **
|
| 33 |
- **Context Length**: 1026
|
| 34 |
-
- **Total Parameters**: 151M
|
| 35 |
|
| 36 |
-
## Example
|
|
|
|
|
|
|
| 37 |
|
| 38 |
```python
|
| 39 |
import torch
|
| 40 |
|
| 41 |
from transformers import EsmTokenizer, EsmForSequenceClassification
|
| 42 |
|
| 43 |
-
model_name = "andrewdalpino/ESM2-
|
| 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 = "
|
| 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 |
|
|
@@ -76,20 +81,12 @@ terms = [model.config.id2label[index] for index in indices.tolist()]
|
|
| 76 |
print(f"Top {args.top_k} GO Terms:")
|
| 77 |
|
| 78 |
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.63
|
| 86 |
-
- **Test Precision**: 0.78
|
| 87 |
-
- **Test Recall**: 0.53
|
| 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.
|
|
|
|
| 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 `cellular component` 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 |
|
|
|
|
| 37 |
- **Vocabulary Size**: 33
|
| 38 |
- **Embedding Dimensions**: 640
|
| 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 |
|
|
|
|
| 81 |
print(f"Top {args.top_k} GO Terms:")
|
| 82 |
|
| 83 |
for term, probability in zip(terms, probabilities):
|
| 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.
|