Views
No views yet
molecular function subgraph of the gene ontology."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)."
1import torch
2
3from transformers import EsmTokenizer, EsmForSequenceClassification
4
5model_name = "andrewdalpino/ESM2-35M-Protein-Molecular-Function"
6
7tokenizer = EsmTokenizer.from_pretrained(model_name)
8
9model = EsmForSequenceClassification.from_pretrained(model_name)
10
11model.eval()
12
13sequence = "MCNAWYISVDFEKNREDKSKCIHTRRNSGPKLLEHVMYEVLRDWYCLEGENVYMM"
14
15top_k = 10
16
17out = tokenizer(sequence)
18
19input_ids = out["input_ids"]
20
21input_ids = torch.tensor(input_ids, dtype=torch.int64).unsqueeze(0)
22
23with torch.no_grad():
24 outputs = model.forward(input_ids)
25
26 probabilities = torch.sigmoid(outputs.logits.squeeze(0))
27
28 probabilities, indices = torch.topk(probabilities, top_k)
29
30probabilities = probabilities.tolist()
31
32terms = [model.config.id2label[index] for index in indices.tolist()]
33
34print(f"Top {args.top_k} GO Terms:")
35
36for term, probability in zip(terms, probabilities):
37 print(f"{probability:.4f}: {term}")
- A. Rives, et al. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences, 2021.
- Z. Lin, et al. Evolutionary-scale prediction of atomic level protein structure with a language model, 2022.
- G. A. Merino, et al. Hierarchical deep learning for predicting GO annotations by integrating protein knowledge, 2022.
- M. Ashburner, et al. Gene Ontology: tool for the unification of biology, 2000.