Skip to content

Commit 62dfd4f

Browse files
committed
Make CentroidLayer inherit from Layer
1 parent aad5eca commit 62dfd4f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
upload:
113113
environment: PyPI
114114
runs-on: ubuntu-latest
115+
if: startsWith(github.ref, 'refs/tags/v')
115116
name: Upload
116117
needs:
117118
- sdist
@@ -123,7 +124,6 @@ jobs:
123124
name: dist
124125
path: dist
125126
- name: Publish distributions to PyPI
126-
if: startsWith(github.ref, 'refs/tags/v')
127127
uses: pypa/gh-action-pypi-publish@master
128128
with:
129129
user: __token__

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
## 🗺️ Overview
2121

22-
[`foldseek`] is a method developed by van Kempen *et al.*[\[1\]](#ref1) for the fast
23-
and accurate search of protein structures. In order to search proteins structures
24-
at a large scale, it first encodes the 3D structure into sequences over a
25-
structural alphabet, 3di, which captures tertiary amino acid interactions.
22+
[`foldseek`](https://github.com/steineggerlab/foldseek) is a method developed
23+
by van Kempen *et al.*[\[1\]](#ref1) for the fast and accurate search of
24+
protein structures. In order to search proteins structures at a large scale,
25+
it first encodes the 3D structure into sequences over a structural alphabet,
26+
3di, which captures tertiary amino acid interactions.
2627

2728
`mini3di` is a pure-Python package to encode 3D structures of proteins into
2829
the 3di alphabet, using the trained weights from the `foldseek` VQ-VAE model.

mini3di/layers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ def __call__(self, X: ArrayNxM[numpy.floating]) -> ArrayNxM[numpy.floating]:
4646
return out
4747

4848

49-
class CentroidLayer:
49+
class CentroidLayer(Layer):
5050
def __init__(self, centroids: ArrayNxM[numpy.floating]) -> None:
51-
self.centroids = centroids
51+
self.centroids = numpy.asarray(centroids)
5252
self.r2 = numpy.sum(self.centroids**2, axis=1).reshape(-1, 1).T
5353
def __call__(self, X: ArrayNxM[numpy.floating]) -> ArrayN[numpy.uint8]:
5454
# compute pairwise squared distance matrix
55-
r1 = numpy.sum(X * X, 1).reshape(-1, 1)
55+
r1 = numpy.sum(X * X, axis=1).reshape(-1, 1)
5656
D = r1 - 2 * X @ self.centroids.T + self.r2
5757
# find closest centroid
5858
states = numpy.empty(D.shape[0], dtype=numpy.uint8)

0 commit comments

Comments
 (0)