foldmatch 0.1.0__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.
- foldmatch-0.1.0/.dockerignore +37 -0
- foldmatch-0.1.0/.github/workflows/_workflow-docker.yaml +17 -0
- foldmatch-0.1.0/.github/workflows/publish.yaml +93 -0
- foldmatch-0.1.0/.gitignore +7 -0
- foldmatch-0.1.0/Dockerfile +45 -0
- foldmatch-0.1.0/LICENSE.md +4 -0
- foldmatch-0.1.0/PKG-INFO +616 -0
- foldmatch-0.1.0/README.md +588 -0
- foldmatch-0.1.0/assets/embedding-model-architecture.png +0 -0
- foldmatch-0.1.0/examples/esm_embeddings.py +23 -0
- foldmatch-0.1.0/pyproject.toml +47 -0
- foldmatch-0.1.0/src/foldmatch/__init__.py +9 -0
- foldmatch-0.1.0/src/foldmatch/cli/args_utils.py +30 -0
- foldmatch-0.1.0/src/foldmatch/cli/inference.py +500 -0
- foldmatch-0.1.0/src/foldmatch/cli/search.py +573 -0
- foldmatch-0.1.0/src/foldmatch/dataset/esm_prot_from_chain.py +118 -0
- foldmatch-0.1.0/src/foldmatch/dataset/esm_prot_from_structure.py +124 -0
- foldmatch-0.1.0/src/foldmatch/dataset/resdiue_assembly_embedding_from_structure.py +67 -0
- foldmatch-0.1.0/src/foldmatch/dataset/residue_assembly_embedding_from_tensor_file.py +100 -0
- foldmatch-0.1.0/src/foldmatch/dataset/residue_embedding_from_structure.py +67 -0
- foldmatch-0.1.0/src/foldmatch/dataset/residue_embedding_from_tensor_file.py +44 -0
- foldmatch-0.1.0/src/foldmatch/dataset/untils/__init__.py +4 -0
- foldmatch-0.1.0/src/foldmatch/dataset/untils/utils.py +17 -0
- foldmatch-0.1.0/src/foldmatch/foldmatch.py +195 -0
- foldmatch-0.1.0/src/foldmatch/inference/assembly_inferece.py +62 -0
- foldmatch-0.1.0/src/foldmatch/inference/chain_inference.py +81 -0
- foldmatch-0.1.0/src/foldmatch/inference/esm_inference.py +81 -0
- foldmatch-0.1.0/src/foldmatch/inference/structure_inference.py +81 -0
- foldmatch-0.1.0/src/foldmatch/model/layers.py +28 -0
- foldmatch-0.1.0/src/foldmatch/model/residue_embedding_aggregator.py +53 -0
- foldmatch-0.1.0/src/foldmatch/modules/chain_module.py +21 -0
- foldmatch-0.1.0/src/foldmatch/modules/esm_module.py +26 -0
- foldmatch-0.1.0/src/foldmatch/modules/structure_module.py +34 -0
- foldmatch-0.1.0/src/foldmatch/search/__init__.py +11 -0
- foldmatch-0.1.0/src/foldmatch/search/clustering.py +249 -0
- foldmatch-0.1.0/src/foldmatch/search/database_builder.py +338 -0
- foldmatch-0.1.0/src/foldmatch/search/faiss_database.py +403 -0
- foldmatch-0.1.0/src/foldmatch/search/structure_search.py +190 -0
- foldmatch-0.1.0/src/foldmatch/types/api_types.py +67 -0
- foldmatch-0.1.0/src/foldmatch/utils/data.py +179 -0
- foldmatch-0.1.0/src/foldmatch/utils/esm/loaders.py +77 -0
- foldmatch-0.1.0/src/foldmatch/utils/model.py +30 -0
- foldmatch-0.1.0/src/foldmatch/utils/structure_parser.py +102 -0
- foldmatch-0.1.0/src/foldmatch/utils/structure_provider.py +27 -0
- foldmatch-0.1.0/src/foldmatch/writer/batch_writer.py +165 -0
- foldmatch-0.1.0/tests/resources/embeddings/1acb.A.pt +0 -0
- foldmatch-0.1.0/tests/resources/embeddings/1acb.B.pt +0 -0
- foldmatch-0.1.0/tests/resources/embeddings/2uzi.A.pt +0 -0
- foldmatch-0.1.0/tests/resources/embeddings/2uzi.B.pt +0 -0
- foldmatch-0.1.0/tests/resources/embeddings/2uzi.C.pt +0 -0
- foldmatch-0.1.0/tests/resources/pdb/1acb.cif +5068 -0
- foldmatch-0.1.0/tests/resources/pdb/2uzi.cif +6685 -0
- foldmatch-0.1.0/tests/resources/src_stream/assembly-complete-test.csv +7 -0
- foldmatch-0.1.0/tests/resources/src_stream/instance-complete-test.csv +10 -0
- foldmatch-0.1.0/tests/resources/src_stream/instance.csv +2 -0
- foldmatch-0.1.0/tests/test_cli_inference.py +48 -0
- foldmatch-0.1.0/tests/test_cli_search.py +483 -0
- foldmatch-0.1.0/tests/test_embedding_model.py +43 -0
- foldmatch-0.1.0/tests/test_inference.py +172 -0
- foldmatch-0.1.0/tests/test_remote_inference.py +103 -0
- foldmatch-0.1.0/uv.lock +2897 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Only list files that could be under version control or could be created in CI/CD.
|
|
2
|
+
|
|
3
|
+
# Note: Patterns are absolute, like `.prettierignore` but unlike `.gitignore`.
|
|
4
|
+
|
|
5
|
+
# Gitignored files
|
|
6
|
+
**/.*
|
|
7
|
+
**/[~#$]*
|
|
8
|
+
**/*[~#$]
|
|
9
|
+
|
|
10
|
+
# Gitignored directories
|
|
11
|
+
node_modules/
|
|
12
|
+
|
|
13
|
+
# Directories
|
|
14
|
+
/dist/
|
|
15
|
+
/tests/
|
|
16
|
+
/assets/
|
|
17
|
+
/examples/
|
|
18
|
+
|
|
19
|
+
# Files in the root directory
|
|
20
|
+
/*.md
|
|
21
|
+
/*.txt
|
|
22
|
+
/CITATION.cff
|
|
23
|
+
/compose.yaml
|
|
24
|
+
/justfile
|
|
25
|
+
/mkdocs.yaml
|
|
26
|
+
/uv.lock
|
|
27
|
+
|
|
28
|
+
# Keep README.md (needed for build)
|
|
29
|
+
!/README.md
|
|
30
|
+
|
|
31
|
+
# Keep .dockerignore and .gitignore
|
|
32
|
+
!/.dockerignore
|
|
33
|
+
!/.gitignore
|
|
34
|
+
|
|
35
|
+
# Keep legal files
|
|
36
|
+
!/LICENSE.*
|
|
37
|
+
!/NOTICE.txt
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Docker build and push workflow
|
|
2
|
+
|
|
3
|
+
name: Run CI/CD Docker Workflow
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_call:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
run-workflow:
|
|
10
|
+
if: github.event_name == 'release'
|
|
11
|
+
name: "Run automated docker workflow"
|
|
12
|
+
uses: rcsb/devops-cicd-github-actions/.github/workflows/workflow-docker.yaml@master
|
|
13
|
+
with:
|
|
14
|
+
dockerfile_location: "Dockerfile" # The location of the Dockerfile relative to the root of the repository. Defaults to "Dockerfile".
|
|
15
|
+
repo_project: "rcsb" # REQUIRED. The name of the project or organization in the remote Docker image repository.
|
|
16
|
+
docker_image_name: "foldmatch" # REQUIRED. The name of the Docker image to create.
|
|
17
|
+
docker_build_context: "." # The path location of the docker build context, relative to the project root. Defaults to the project root.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: CI Pipeline
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
|
|
13
|
+
hatch-test:
|
|
14
|
+
name: Test on Python ${{ matrix.python-version }}
|
|
15
|
+
runs-on: ["self-hosted", "buildchain"]
|
|
16
|
+
timeout-minutes: 20
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.12"]
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout code
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install build dependencies
|
|
25
|
+
run: |
|
|
26
|
+
sudo apt-get update
|
|
27
|
+
sudo apt-get install -y build-essential pkg-config libzstd-dev
|
|
28
|
+
|
|
29
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
30
|
+
uses: actions/setup-python@v4
|
|
31
|
+
with:
|
|
32
|
+
python-version: ${{ matrix.python-version }}
|
|
33
|
+
|
|
34
|
+
- name: Install Hatch and HaggingFace
|
|
35
|
+
run: pip install hatch huggingface_hub[cli]
|
|
36
|
+
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: hatch test
|
|
39
|
+
|
|
40
|
+
hatch-build:
|
|
41
|
+
name: Build to PyPI
|
|
42
|
+
needs:
|
|
43
|
+
- hatch-test
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
if: github.event_name == 'release'
|
|
46
|
+
steps:
|
|
47
|
+
- name: Checkout code
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Set up Python 3.12
|
|
51
|
+
uses: actions/setup-python@v4
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.12"
|
|
54
|
+
|
|
55
|
+
- name: Install Hatch
|
|
56
|
+
run: pip install hatch
|
|
57
|
+
|
|
58
|
+
- name: Build distribution
|
|
59
|
+
run: hatch build
|
|
60
|
+
|
|
61
|
+
- name: Store the distribution packages
|
|
62
|
+
uses: actions/upload-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: python-package-distributions
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
push-image:
|
|
68
|
+
needs:
|
|
69
|
+
- hatch-build
|
|
70
|
+
name: Push image to harbor
|
|
71
|
+
uses: ./.github/workflows/_workflow-docker.yaml
|
|
72
|
+
|
|
73
|
+
publish-to-pypi:
|
|
74
|
+
name: >-
|
|
75
|
+
Publish Python 🐍 distribution 📦 to PyPI
|
|
76
|
+
if: github.event_name == 'release'
|
|
77
|
+
needs:
|
|
78
|
+
- push-image
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
environment:
|
|
81
|
+
name: pypi
|
|
82
|
+
url: https://pypi.org/p/foldmatch
|
|
83
|
+
permissions:
|
|
84
|
+
id-token: write
|
|
85
|
+
|
|
86
|
+
steps:
|
|
87
|
+
- name: Download all the dists
|
|
88
|
+
uses: actions/download-artifact@v4
|
|
89
|
+
with:
|
|
90
|
+
name: python-package-distributions
|
|
91
|
+
path: dist/
|
|
92
|
+
- name: Publish distribution 📦 to PyPI
|
|
93
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Build stage
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
# Copy only necessary files for installation
|
|
7
|
+
COPY pyproject.toml README.md LICENSE.md ./
|
|
8
|
+
COPY src/ ./src/
|
|
9
|
+
|
|
10
|
+
# Install build dependencies, build, strip, and cleanup in one layer
|
|
11
|
+
# hadolint ignore=DL3008
|
|
12
|
+
RUN apt-get update && \
|
|
13
|
+
apt-get install -y --no-install-recommends gcc g++ binutils && \
|
|
14
|
+
pip install --no-cache-dir -e . && \
|
|
15
|
+
# Strip binaries immediately to reduce size before copying
|
|
16
|
+
find /usr/local/lib/python3.12 -name "*.so" -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
|
|
17
|
+
find /usr/local/lib/python3.12 -type f -executable -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
|
|
18
|
+
# Remove unnecessary files in builder stage
|
|
19
|
+
find /usr/local/lib/python3.12 -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true && \
|
|
20
|
+
find /usr/local/lib/python3.12 -type d -name "test" -exec rm -rf {} + 2>/dev/null || true && \
|
|
21
|
+
find /usr/local/lib/python3.12 -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true && \
|
|
22
|
+
find /usr/local/lib/python3.12 -name "*.pyc" -delete && \
|
|
23
|
+
find /usr/local/lib/python3.12 -name "*.pyo" -delete && \
|
|
24
|
+
# Remove build dependencies immediately
|
|
25
|
+
apt-get purge -y gcc g++ binutils && \
|
|
26
|
+
apt-get autoremove -y && \
|
|
27
|
+
rm -rf /var/lib/apt/lists/*
|
|
28
|
+
|
|
29
|
+
# Runtime stage
|
|
30
|
+
FROM python:3.12-slim
|
|
31
|
+
|
|
32
|
+
WORKDIR /app
|
|
33
|
+
|
|
34
|
+
# Copy the cleaned packages from builder
|
|
35
|
+
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
|
36
|
+
COPY --from=builder /usr/local/bin /usr/local/bin
|
|
37
|
+
COPY --from=builder /app /app
|
|
38
|
+
|
|
39
|
+
# Final cleanup for runtime image
|
|
40
|
+
# hadolint ignore=SC2015
|
|
41
|
+
RUN find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en*' -exec rm -rf {} + 2>/dev/null || true && \
|
|
42
|
+
find /usr/share/i18n/locales -mindepth 1 -maxdepth 1 ! -name 'en_*' -exec rm -rf {} + 2>/dev/null || true && \
|
|
43
|
+
rm -rf /usr/share/doc/* /usr/share/man/* /usr/share/info/* 2>/dev/null || true
|
|
44
|
+
|
|
45
|
+
ENTRYPOINT ["fm-inference"]
|