binderqc 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.
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - run: pip install -e ".[test]"
21
+ - run: pytest -q
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ # Publishes to PyPI whenever you cut a GitHub Release. No stored token:
4
+ # it authenticates to PyPI via OIDC (trusted publishing). Set up the matching
5
+ # pending publisher on PyPI (project binderqc, repo ssiddhantsharma/binderqc,
6
+ # workflow publish.yml) before the first release.
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+ workflow_dispatch: # allow manual runs (and re-runs) from the Actions tab
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ id-token: write # required for trusted publishing (OIDC)
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+ - name: Build sdist and wheel
24
+ run: |
25
+ python -m pip install --upgrade build
26
+ python -m build
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.csv
4
+ *.pdb
5
+ *.cif
6
+ .venv/
7
+ .DS_Store
8
+ build/
9
+ dist/
10
+ *.egg-info/
11
+
12
+ # keep bundled test fixtures despite the *.pdb / *.cif rules above
13
+ !tests/data/
14
+ !tests/data/*.pdb
15
+ !tests/data/*.cif
16
+ .pytest_cache/
binderqc-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siddhant Sharma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: binderqc
3
+ Version: 0.1.0
4
+ Summary: Quality-control and tag-site scoring for designed protein binders, from a predicted complex
5
+ Project-URL: Homepage, https://github.com/ssiddhantsharma/binderqc
6
+ Author: Siddhant Sharma
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Siddhant Sharma
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ License-File: LICENSE
29
+ Keywords: binder,developability,protein-design,qc,sasa,structural-biology
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
33
+ Requires-Python: >=3.10
34
+ Requires-Dist: biotite>=1.0
35
+ Requires-Dist: numpy>=1.24
36
+ Requires-Dist: pandas>=2.0
37
+ Provides-Extra: test
38
+ Requires-Dist: pytest; extra == 'test'
39
+ Provides-Extra: validation
40
+ Requires-Dist: matplotlib; extra == 'validation'
41
+ Requires-Dist: scipy; extra == 'validation'
42
+ Description-Content-Type: text/markdown
43
+
44
+ <h1 align="center">binderqc</h1>
45
+
46
+ <p align="center">
47
+ Quality control and tag-site scoring for designed protein binders — geometry and
48
+ sequence only, one CSV row per binder, straight from a predicted complex.
49
+ </p>
50
+
51
+ <p align="center">
52
+ <a href="https://github.com/ssiddhantsharma/binderqc/actions/workflows/ci.yml"><img src="https://github.com/ssiddhantsharma/binderqc/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
53
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
54
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
55
+ </p>
56
+
57
+ <p align="center">
58
+ <img src="docs/schematic.png" width="860"
59
+ alt="From a predicted binder–target complex, binderqc reports interface, pose, grippability, tag site, and developability">
60
+ </p>
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ pip install -e . # or: uv pip install -e .
66
+ ```
67
+
68
+ Python 3.10+. Pulls in `biotite`, `numpy`, and `pandas`.
69
+
70
+ ## Usage
71
+
72
+ ```bash
73
+ binderqc --binder-chains A --target-chains B --out out.csv complex.cif some_dir/
74
+ ```
75
+
76
+ ```python
77
+ from binderqc import score_structure
78
+ rows = score_structure("complex.pdb", binder_chains=["A"], target_chains=["B"])
79
+ ```
80
+
81
+ Inputs are PDB/CIF files, globs, or directories. Leave `--binder-chains` off to
82
+ guess the binder as the shortest chain (20–250 aa, printed for each file);
83
+ `--target-chains` defaults to the remaining chains.
84
+
85
+ | flag | default | meaning |
86
+ |---|---|---|
87
+ | `--binder-chains` | auto-guess | comma-separated binder chain ids |
88
+ | `--target-chains` | all non-binder | comma-separated target chain ids |
89
+ | `--interface-cutoff` | `5.0` | heavy-atom contact distance (Å) |
90
+ | `--exposure-cutoff` | `0.25` | relSASA below which a terminus is buried |
91
+ | `--out` | `binderqc.csv` | output CSV path |
92
+ | `--fasta` | off | also write the QC-passing binders to this FASTA |
93
+
94
+ Example output for the bundled LCB1 minibinder (a few of the columns):
95
+
96
+ | recommended_tag | binder_bsa | epitope_planarity | epitope_aromatic_n | pi | qc_pass |
97
+ |---|---|---|---|---|---|
98
+ | C | 1021.4 | 3.21 | 11 | 4.17 | True |
99
+
100
+ Its `warnings` field reads *both termini ~equidistant from interface (ambiguous)* —
101
+ a tag-site advisory, so `qc_pass` stays `True`.
102
+
103
+ ## What it reports
104
+
105
+ Per binder chain:
106
+
107
+ - **Interface** — buried surface area and interface residue count.
108
+ - **Pose** — approach angle (end-on vs. lying across the surface).
109
+ - **Grippability** — epitope planarity, hydrophobic fraction, aromatic anchors.
110
+ - **Tag site** — recommended terminus (N/C) and the numbers behind it: relative
111
+ SASA, CA–CA distance to the paratope, orientation, and a terminal cysteine's SG SASA.
112
+ - **Developability** — sequence liabilities, GRAVY, net charge, pI, MW, ε₂₈₀.
113
+
114
+ A `warnings` column flags problems (small, flat, or anchorless interfaces;
115
+ buried, ambiguous, or interface-facing tag sites; hydrophobic sequences).
116
+ `qc_pass` is true when there are no *quality* warnings — tag-site advisories like
117
+ an ambiguous terminus don't count — and `--fasta` dumps exactly those binders.
118
+
119
+ <details>
120
+ <summary>Full column list</summary>
121
+
122
+ `pdb, binder_chain, target_chains, binder_len, n_interface_res, binder_bsa,
123
+ approach_angle, epitope_planarity, epitope_hydrophobic_frac, epitope_aromatic_n,
124
+ nterm_resnum, nterm_resname, nterm_relsasa, nterm_dist_to_interface,
125
+ nterm_orientation, nterm_sg_sasa, cterm_resnum, cterm_resname, cterm_relsasa,
126
+ cterm_dist_to_interface, cterm_orientation, cterm_sg_sasa, recommended_tag, mw,
127
+ gravy, net_charge_ph74, pi, ext_coeff_280, sequence_liabilities, warnings,
128
+ qc_pass, binder_sequence`
129
+ </details>
130
+
131
+ ## Tests
132
+
133
+ ```bash
134
+ pip install -e ".[test]"
135
+ pytest
136
+ ```
137
+
138
+ Runs against a bundled example, PDB 7JZU (the LCB1 minibinder on the SARS-CoV-2
139
+ RBD). `tests/pisa_correctness.py` is a separate script (not part of the unit
140
+ tests) that downloads 18 public complexes from RCSB and PDBePISA and checks the
141
+ interface area against PISA (r ≈ 1.0, ~1% median error):
142
+
143
+ ```bash
144
+ pip install -e ".[validation]"
145
+ python tests/pisa_correctness.py
146
+ ```
147
+
148
+ ## License
149
+
150
+ MIT
@@ -0,0 +1,107 @@
1
+ <h1 align="center">binderqc</h1>
2
+
3
+ <p align="center">
4
+ Quality control and tag-site scoring for designed protein binders — geometry and
5
+ sequence only, one CSV row per binder, straight from a predicted complex.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://github.com/ssiddhantsharma/binderqc/actions/workflows/ci.yml"><img src="https://github.com/ssiddhantsharma/binderqc/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
10
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
11
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <img src="docs/schematic.png" width="860"
16
+ alt="From a predicted binder–target complex, binderqc reports interface, pose, grippability, tag site, and developability">
17
+ </p>
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ pip install -e . # or: uv pip install -e .
23
+ ```
24
+
25
+ Python 3.10+. Pulls in `biotite`, `numpy`, and `pandas`.
26
+
27
+ ## Usage
28
+
29
+ ```bash
30
+ binderqc --binder-chains A --target-chains B --out out.csv complex.cif some_dir/
31
+ ```
32
+
33
+ ```python
34
+ from binderqc import score_structure
35
+ rows = score_structure("complex.pdb", binder_chains=["A"], target_chains=["B"])
36
+ ```
37
+
38
+ Inputs are PDB/CIF files, globs, or directories. Leave `--binder-chains` off to
39
+ guess the binder as the shortest chain (20–250 aa, printed for each file);
40
+ `--target-chains` defaults to the remaining chains.
41
+
42
+ | flag | default | meaning |
43
+ |---|---|---|
44
+ | `--binder-chains` | auto-guess | comma-separated binder chain ids |
45
+ | `--target-chains` | all non-binder | comma-separated target chain ids |
46
+ | `--interface-cutoff` | `5.0` | heavy-atom contact distance (Å) |
47
+ | `--exposure-cutoff` | `0.25` | relSASA below which a terminus is buried |
48
+ | `--out` | `binderqc.csv` | output CSV path |
49
+ | `--fasta` | off | also write the QC-passing binders to this FASTA |
50
+
51
+ Example output for the bundled LCB1 minibinder (a few of the columns):
52
+
53
+ | recommended_tag | binder_bsa | epitope_planarity | epitope_aromatic_n | pi | qc_pass |
54
+ |---|---|---|---|---|---|
55
+ | C | 1021.4 | 3.21 | 11 | 4.17 | True |
56
+
57
+ Its `warnings` field reads *both termini ~equidistant from interface (ambiguous)* —
58
+ a tag-site advisory, so `qc_pass` stays `True`.
59
+
60
+ ## What it reports
61
+
62
+ Per binder chain:
63
+
64
+ - **Interface** — buried surface area and interface residue count.
65
+ - **Pose** — approach angle (end-on vs. lying across the surface).
66
+ - **Grippability** — epitope planarity, hydrophobic fraction, aromatic anchors.
67
+ - **Tag site** — recommended terminus (N/C) and the numbers behind it: relative
68
+ SASA, CA–CA distance to the paratope, orientation, and a terminal cysteine's SG SASA.
69
+ - **Developability** — sequence liabilities, GRAVY, net charge, pI, MW, ε₂₈₀.
70
+
71
+ A `warnings` column flags problems (small, flat, or anchorless interfaces;
72
+ buried, ambiguous, or interface-facing tag sites; hydrophobic sequences).
73
+ `qc_pass` is true when there are no *quality* warnings — tag-site advisories like
74
+ an ambiguous terminus don't count — and `--fasta` dumps exactly those binders.
75
+
76
+ <details>
77
+ <summary>Full column list</summary>
78
+
79
+ `pdb, binder_chain, target_chains, binder_len, n_interface_res, binder_bsa,
80
+ approach_angle, epitope_planarity, epitope_hydrophobic_frac, epitope_aromatic_n,
81
+ nterm_resnum, nterm_resname, nterm_relsasa, nterm_dist_to_interface,
82
+ nterm_orientation, nterm_sg_sasa, cterm_resnum, cterm_resname, cterm_relsasa,
83
+ cterm_dist_to_interface, cterm_orientation, cterm_sg_sasa, recommended_tag, mw,
84
+ gravy, net_charge_ph74, pi, ext_coeff_280, sequence_liabilities, warnings,
85
+ qc_pass, binder_sequence`
86
+ </details>
87
+
88
+ ## Tests
89
+
90
+ ```bash
91
+ pip install -e ".[test]"
92
+ pytest
93
+ ```
94
+
95
+ Runs against a bundled example, PDB 7JZU (the LCB1 minibinder on the SARS-CoV-2
96
+ RBD). `tests/pisa_correctness.py` is a separate script (not part of the unit
97
+ tests) that downloads 18 public complexes from RCSB and PDBePISA and checks the
98
+ interface area against PISA (r ≈ 1.0, ~1% median error):
99
+
100
+ ```bash
101
+ pip install -e ".[validation]"
102
+ python tests/pisa_correctness.py
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT
Binary file
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "binderqc"
7
+ version = "0.1.0"
8
+ description = "Quality-control and tag-site scoring for designed protein binders, from a predicted complex"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Siddhant Sharma" }]
13
+ keywords = ["protein-design", "binder", "developability", "qc", "sasa", "structural-biology"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
18
+ ]
19
+ dependencies = [
20
+ "biotite>=1.0",
21
+ "numpy>=1.24",
22
+ "pandas>=2.0",
23
+ ]
24
+
25
+ [project.optional-dependencies]
26
+ test = ["pytest"]
27
+ validation = ["matplotlib", "scipy"] # for tests/pisa_correctness.py (network benchmark)
28
+
29
+ [project.scripts]
30
+ binderqc = "binderqc.cli:main"
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/ssiddhantsharma/binderqc"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/binderqc"]
@@ -0,0 +1,7 @@
1
+ """Score binder termini for tag/conjugation suitability from predicted complexes."""
2
+
3
+ from .core import score_structure
4
+ from .paths import gather_paths
5
+
6
+ __version__ = "0.1.0"
7
+ __all__ = ["score_structure", "gather_paths", "__version__"]
@@ -0,0 +1,79 @@
1
+ """Command-line entry point: `binderqc`.
2
+
3
+ binderqc --binder-chains B --target-chains A \
4
+ --out tag_metrics.csv path/to/preds/*.cif a_directory/
5
+
6
+ Inputs may be files, globs, or directories (recursively scanned for *.pdb/*.cif).
7
+ """
8
+
9
+ import argparse
10
+ import os
11
+ import sys
12
+
13
+ from .core import score_structure
14
+ from .paths import gather_paths
15
+
16
+ _DESCRIPTION = """\
17
+ Pick the terminus to tag on a designed protein binder.
18
+
19
+ For each binder chain in a predicted binder-target complex it reports, per
20
+ terminus, the relative SASA (exposure), the CA-CA distance to the paratope, the
21
+ orientation (does the chain point back at the interface?) and the Cys-SG SASA,
22
+ then recommends the terminus farther from the interface and flags buried,
23
+ ambiguous or interface-facing cases. Just geometry: no folding, no GPU, no network.
24
+ """
25
+
26
+
27
+ def main(argv=None):
28
+ ap = argparse.ArgumentParser(
29
+ prog="binderqc",
30
+ description=_DESCRIPTION,
31
+ formatter_class=argparse.RawDescriptionHelpFormatter,
32
+ )
33
+ ap.add_argument("inputs", nargs="+", help="PDB/CIF files, globs, or directories")
34
+ ap.add_argument("--binder-chains", default="", help="comma-separated; default = auto-guess")
35
+ ap.add_argument("--target-chains", default="", help="comma-separated; default = all non-binder chains")
36
+ ap.add_argument("--interface-cutoff", type=float, default=5.0,
37
+ help="heavy-atom dist (A) to call a binder residue interface (default 5.0)")
38
+ ap.add_argument("--exposure-cutoff", type=float, default=0.25,
39
+ help="relSASA below which a terminus is buried (default 0.25)")
40
+ ap.add_argument("--out", default="binderqc.csv", help="output CSV path")
41
+ ap.add_argument("--fasta", default="",
42
+ help="also write QC-passing binders (no quality warnings) to this FASTA path")
43
+ args = ap.parse_args(argv)
44
+
45
+ import pandas as pd # imported here so `--help` works without pandas
46
+
47
+ paths = gather_paths(args.inputs)
48
+ if not paths:
49
+ sys.exit("No .pdb/.cif files found in inputs.")
50
+ binder_chains = [c for c in args.binder_chains.split(",") if c]
51
+ target_chains = [c for c in args.target_chains.split(",") if c]
52
+
53
+ rows = []
54
+ for p in paths:
55
+ try:
56
+ rows.extend(score_structure(p, binder_chains, target_chains,
57
+ args.interface_cutoff, args.exposure_cutoff))
58
+ except Exception as e: # noqa: BLE001 - keep the batch going, record the failure
59
+ rows.append({"pdb": p, "error": str(e)})
60
+
61
+ df = pd.DataFrame(rows)
62
+ df.to_csv(args.out, index=False)
63
+ shown = df.drop(columns=["binder_sequence"], errors="ignore") # too wide to print
64
+ with pd.option_context("display.max_columns", None, "display.width", 220):
65
+ print(shown.to_string(index=False))
66
+ print(f"\nWrote {len(df)} rows -> {args.out}")
67
+
68
+ if args.fasta:
69
+ clean = [r for r in rows
70
+ if not r.get("error") and r.get("qc_pass") and r.get("binder_sequence")]
71
+ with open(args.fasta, "w") as fh:
72
+ for r in clean:
73
+ fh.write(f">{os.path.splitext(r['pdb'])[0]}|{r['binder_chain']}\n{r['binder_sequence']}\n")
74
+ scored = sum(1 for r in rows if not r.get("error"))
75
+ print(f"Wrote {len(clean)}/{scored} QC-passing binders -> {args.fasta}")
76
+
77
+
78
+ if __name__ == "__main__":
79
+ main()