Views
No views yet
"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."
"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)."
| Name | Embedding Dim. | Attn. Heads | Encoder Layers | Context Length | QAT | Total Parameters |
|---|---|---|---|---|---|---|
| andrewdalpino/ESMC-300M-Protein-Function | 960 | 15 | 30 | 2048 | None | 361M |
| andrewdalpino/ESMC-300M-QAT-Protein-Function | 960 | 15 | 30 | 2048 | int8w | 361M |
| andrewdalpino/ESMC-600M-Protein-Function | 1152 | 18 | 36 | 2048 | None | 644M |
| andrewdalpino/ESMC-600M-QAT-Protein-Function | 1152 | 18 | 36 | 2048 | int8w | 644M |
esmc_function_classifier package using pip.pip install esmc_function_classifier obonetobonet, tokenize the amino acid sequence, and infer the GO subgraph.1import torch
2
3from esm.tokenization import EsmSequenceTokenizer
4
5from esmc_function_classifier.model import EsmcGoTermClassifier
6
7
8model_name = "andrewdalpino/ESMC-600M-Protein-Function"
9
10sequence = "MPPKGHKKTADGDFRPVNSAGNTIQAKQKYSIDDLLYPKSTIKNLAKETLPDDAIISKDALTAIQRAATLFVSYMASHGNASAEAGGRKKIT"
11
12top_p = 0.5
13
14tokenizer = EsmSequenceTokenizer()
15
16model = EsmcGoTermClassifier.from_pretrained(model_name)
17
18out = tokenizer(sequence, max_length=2048, truncation=True)
19
20input_ids = torch.tensor(out["input_ids"], dtype=torch.int64)
21
22go_term_probabilities = model.predict_terms(
23 input_ids, top_p=top_p
24)networkx subgraph for a given sequence like in the example below. You'll need an up-to-date gene ontology database that you can import using the obonet package.1import networkx as nx
2
3import obonet
4
5
6# Visit https://geneontology.org/docs/download-ontology/ to download.
7go_db_path = "./dataset/go-basic.obo"
8
9graph = obonet.read_obo(go_db_path)
10
11model.load_gene_ontology(graph)
12
13subgraph, go_term_probabilities = model.predict_subgraph(
14 input_ids, top_p=top_p
15)
16
17json = nx.node_link_data(subgraph)
18
19print(json)quantize_weights() method. Any model can be quantized, but we recommend one that has been quantization-aware trained (QAT) for the best performance. The group_size argument controls the granularity at which quantization scales are computed.model.quantize_weights(group_size=64)
- T. Hayes, et al. Simulating 500 million years of evolution with a language model, 2024.
- M. Ashburner, et al. Gene Ontology: tool for the unification of biology, 2000.