rcsb-embedding-model 0.0.3__tar.gz → 0.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rcsb-embedding-model might be problematic. Click here for more details.
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/PKG-INFO +1 -1
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/pyproject.toml +1 -1
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/rcsb_structure_embedding.py +20 -1
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/tests/test_model.py +10 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/.gitignore +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/LICENSE.md +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/README.md +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/assets/embedding-model-architecture.png +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/examples/esm_embeddings.py +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/__init__.py +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/model/layers.py +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/model/residue_embedding_aggregator.py +0 -0
- {rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/tests/resources/1acb.cif +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rcsb-embedding-model
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Protein Embedding Model for Structure Search
|
|
5
5
|
Project-URL: Homepage, https://github.com/rcsb/rcsb-embedding-model
|
|
6
6
|
Project-URL: Issues, https://github.com/rcsb/rcsb-embedding-model/issues
|
|
@@ -16,7 +16,7 @@ class RcsbStructureEmbedding:
|
|
|
16
16
|
MIN_RES = 10
|
|
17
17
|
REPO_ID = "rcsb/rcsb-embedding-model"
|
|
18
18
|
FILE_NAME = "rcsb-embedding-model.pt"
|
|
19
|
-
VERSION = "
|
|
19
|
+
VERSION = "410606e40b1bb7968ce318c41009355c3ac32503"
|
|
20
20
|
|
|
21
21
|
def __init__(self):
|
|
22
22
|
self.__residue_embedding = None
|
|
@@ -66,6 +66,25 @@ class RcsbStructureEmbedding:
|
|
|
66
66
|
dim=0
|
|
67
67
|
)
|
|
68
68
|
|
|
69
|
+
def sequence_embedding(self, sequence):
|
|
70
|
+
self.__check_residue_embedding()
|
|
71
|
+
|
|
72
|
+
if sequence.startswith(">"):
|
|
73
|
+
sequence = "".join(line.strip() for line in sequence.splitlines() if not line.startswith(">"))
|
|
74
|
+
|
|
75
|
+
if len(sequence) < RcsbStructureEmbedding.MIN_RES:
|
|
76
|
+
raise ValueError(f"Sequence too short for embedding (min {RcsbStructureEmbedding.MIN_RES} residues)")
|
|
77
|
+
|
|
78
|
+
protein = ESMProtein(sequence=sequence)
|
|
79
|
+
protein_tensor = self.__residue_embedding.encode(protein)
|
|
80
|
+
|
|
81
|
+
result = self.__residue_embedding.forward_and_sample(
|
|
82
|
+
protein_tensor,
|
|
83
|
+
SamplingConfig(return_per_residue_embeddings=True)
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return result.per_residue_embedding
|
|
87
|
+
|
|
69
88
|
def aggregator_embedding(self, residue_embedding):
|
|
70
89
|
self.__check_aggregator_embedding()
|
|
71
90
|
return self.__aggregator_embedding(residue_embedding)
|
|
@@ -18,6 +18,16 @@ class TestEmbeddingModel(unittest.TestCase):
|
|
|
18
18
|
)
|
|
19
19
|
self.assertEqual(list(res_embedding.shape), [243, 1536])
|
|
20
20
|
|
|
21
|
+
def test_sequence_embedding(self):
|
|
22
|
+
|
|
23
|
+
model = RcsbStructureEmbedding()
|
|
24
|
+
res_embedding = model.sequence_embedding(
|
|
25
|
+
sequence="CGVPAIQPVLSGLSRIVNGEEAVPGSWPWQVSLQDKTGFHFCGGSLINENWVVTAAHCGVTTSDVVVAGEFDQGSSSEKIQKLKIAKVFKNSK"
|
|
26
|
+
"YNSLTINNDITLLKLSTAASFSQTVSAVCLPSASDDFAAGTTCVTTGWGLTRYTNANTPDRLQQASLPLLSNTNCKKYWGTKIKDAMICAGAS"
|
|
27
|
+
"GVSSCMGDSGGPLVCKKNGAWTLVGIVSWGSSTCSTSTPGVYARVTALVNWVQQTLAAN"
|
|
28
|
+
)
|
|
29
|
+
self.assertEqual(list(res_embedding.shape), [247, 1536])
|
|
30
|
+
|
|
21
31
|
def test_aggregator_embedding(self):
|
|
22
32
|
|
|
23
33
|
model = RcsbStructureEmbedding()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/assets/embedding-model-architecture.png
RENAMED
|
File without changes
|
|
File without changes
|
{rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/__init__.py
RENAMED
|
File without changes
|
{rcsb_embedding_model-0.0.3 → rcsb_embedding_model-0.0.5}/src/rcsb_embedding_model/model/layers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|