Views
No views yet
enzymes (class 0), receptor_proteins (class 1), and structural_proteins (class 2).
This is trained using facebook/esm2_t6_8M_UR50D, one of the ESM-2 models.1# Load the trained model and tokenizer
2model = EsmForSequenceClassification.from_pretrained("AmelieSchreiber/esm2_t6_8M_UR50D_sequence_classifier_v1")
3tokenizer = AutoTokenizer.from_pretrained("facebook/esm2_t6_8M_UR50D")
4
5# Suppose these are your new sequences that you want to classify
6# Additional Family 0: Enzymes
7new_sequences_0 = [
8 "ACGYLKTPKLADPPVLRGDSSVTKAICKPDPVLEK",
9 "GVALDECKALDYLPGKPLPMDGKVCQCGSKTPLRP",
10 "VLPGYTCGELDCKPGKPLPKCGADKTQVATPFLRG",
11 "TCGALVQYPSCADPPVLRGSDSSVKACKKLDPQDK",
12 "GALCEECKLCPGADYKPMDGDRLPAAATSKTRPVG",
13 "PAVDCKKALVYLPKPLPMDGKVCRGSKTPKTRPYG",
14 "VLGYTCGALDCKPGKPLPKCGADKTQVATPFLRGA",
15 "CGALVQYPSCADPPVLRGSDSSVKACKKLDPQDKT",
16 "ALCEECKLCPGADYKPMDGDRLPAAATSKTRPVGK",
17 "AVDCKKALVYLPKPLPMDGKVCRGSKTPKTRPYGR",
18]
19
20# Additional Family 1: Receptor Proteins
21new_sequences_1 = [
22 "VGQRFYGGRQKNRHCELSPLPSACRGSVQGALYTD",
23 "KDQVLTVPTYACRCCPKMDSKGRVPSTLRVKSARS",
24 "PLAGVACGRGLDYRCPRKMVPGDLQVTPATQRPYG",
25 "CGVRLGYPGCADVPLRGRSSFAPRACMKKDPRVTR",
26 "RKGVAYLYECRKLRCRADYKPRGMDGRRLPKASTT",
27 "RPTGAVNCKQAKVYRGLPLPMMGKVPRVCRSRRPY",
28 "RLDGGYTCGQALDCKPGRKPPKMGCADLKSTVATP",
29 "LGTCRKLVRYPQCADPPVMGRSSFRPKACCRQDPV",
30 "RVGYAMCSPKLCSCRADYKPPMGDGDRLPKAATSK",
31 "QPKAVNCRKAMVYRPKPLPMDKGVPVCRSKRPRPY",
32]
33
34# Additional Family 2: Structural Proteins
35new_sequences_2 = [
36 "VGKGFRYGSSQKRYLHCQKSALPPSCRRGKGQGSAT",
37 "KDPTVMTVGTYSCQCPKQDSRGSVQPTSRVKTSRSK",
38 "PLVGKACGRSSDYKCPGQMVSGGSKQTPASQRPSYD",
39 "CGKKLVGYPSSKADVPLQGRSSFSPKACKKDPQMTS",
40 "RKGVASLYCSSKLSCKAQYSKGMSDGRSPKASSTTS",
41 "RPKSAASCEQAKSYRSLSLPSMKGKVPSKCSRSKRP",
42 "RSDVSYTSCSQSKDCKPSKPPKMSGSKDSSTVATPS",
43 "LSTCSKKVAYPSSKADPPSSGRSSFSMKACKKQDPPV",
44 "RVGSASSEPKSSCSVQSYSKPSMSGDSSPKASSTSK",
45 "QPSASNCEKMSSYRPSLPSMSKGVPSSRSKSSPPYQ",
46]
47
48# Tokenize the sequences and convert to tensors
49# Merge all sequences
50new_sequences = new_sequences_0 + new_sequences_1 + new_sequences_2
51inputs = tokenizer(new_sequences, return_tensors="pt", padding=True, truncation=True)
52
53# Use the model to get the logits
54with torch.no_grad():
55 logits = model(**inputs).logits
56
57# Get the predicted class for each sequence
58predicted_class_ids = torch.argmax(logits, dim=-1)
59
60# Print the predicted class for each sequence
61for sequence, predicted_class in zip(new_sequences, predicted_class_ids):
62 print(f"Sequence: {sequence}, Predicted class: {predicted_class.item()}")