biointerface 0.2.2__tar.gz → 0.3.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.
Files changed (34) hide show
  1. biointerface-0.3.0/HISTORY.rst +47 -0
  2. {biointerface-0.2.2 → biointerface-0.3.0}/PKG-INFO +5 -5
  3. {biointerface-0.2.2 → biointerface-0.3.0}/README.rst +2 -2
  4. {biointerface-0.2.2 → biointerface-0.3.0}/docs/usage.rst +33 -2
  5. {biointerface-0.2.2 → biointerface-0.3.0}/pyproject.toml +9 -19
  6. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface/__init__.py +1 -1
  7. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface/core.py +79 -4
  8. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface.egg-info/PKG-INFO +5 -5
  9. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface.egg-info/requires.txt +1 -1
  10. biointerface-0.2.2/HISTORY.rst +0 -14
  11. {biointerface-0.2.2 → biointerface-0.3.0}/AUTHORS.rst +0 -0
  12. {biointerface-0.2.2 → biointerface-0.3.0}/CONTRIBUTING.rst +0 -0
  13. {biointerface-0.2.2 → biointerface-0.3.0}/LICENSE +0 -0
  14. {biointerface-0.2.2 → biointerface-0.3.0}/MANIFEST.in +0 -0
  15. {biointerface-0.2.2 → biointerface-0.3.0}/docs/Makefile +0 -0
  16. {biointerface-0.2.2 → biointerface-0.3.0}/docs/_build/html/_static/file.png +0 -0
  17. {biointerface-0.2.2 → biointerface-0.3.0}/docs/_build/html/_static/minus.png +0 -0
  18. {biointerface-0.2.2 → biointerface-0.3.0}/docs/_build/html/_static/plus.png +0 -0
  19. {biointerface-0.2.2 → biointerface-0.3.0}/docs/authors.rst +0 -0
  20. {biointerface-0.2.2 → biointerface-0.3.0}/docs/biointerface.rst +0 -0
  21. {biointerface-0.2.2 → biointerface-0.3.0}/docs/conf.py +0 -0
  22. {biointerface-0.2.2 → biointerface-0.3.0}/docs/contributing.rst +0 -0
  23. {biointerface-0.2.2 → biointerface-0.3.0}/docs/history.rst +0 -0
  24. {biointerface-0.2.2 → biointerface-0.3.0}/docs/index.rst +0 -0
  25. {biointerface-0.2.2 → biointerface-0.3.0}/docs/installation.rst +0 -0
  26. {biointerface-0.2.2 → biointerface-0.3.0}/docs/make.bat +0 -0
  27. {biointerface-0.2.2 → biointerface-0.3.0}/docs/modules.rst +0 -0
  28. {biointerface-0.2.2 → biointerface-0.3.0}/docs/readme.rst +0 -0
  29. {biointerface-0.2.2 → biointerface-0.3.0}/setup.cfg +0 -0
  30. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface.egg-info/SOURCES.txt +0 -0
  31. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface.egg-info/dependency_links.txt +0 -0
  32. {biointerface-0.2.2 → biointerface-0.3.0}/src/biointerface.egg-info/top_level.txt +0 -0
  33. {biointerface-0.2.2 → biointerface-0.3.0}/tests/__init__.py +0 -0
  34. {biointerface-0.2.2 → biointerface-0.3.0}/tests/test_biointerface.py +0 -0
@@ -0,0 +1,47 @@
1
+ =======
2
+ History
3
+ =======
4
+
5
+ 0.1.0 (2025-02-08)
6
+ ------------------
7
+
8
+ * First release on PyPI.
9
+
10
+
11
+ 0.2.0 (2025-02-28)
12
+ ------------------
13
+
14
+ * Features: Interface class, with getter methods for atoms, dataframes etc
15
+
16
+
17
+ 0.2.1 (2025-03-1)
18
+ ------------------
19
+
20
+ * Gitlab CI
21
+
22
+
23
+ 0.2.2 (2025-03-04)
24
+ ------------------
25
+
26
+ * Interface methods to get residues
27
+
28
+ * Interface raise error condition in case of no protein in the structure
29
+
30
+ * Coverage badge on README
31
+
32
+ * Full documentation
33
+
34
+
35
+ 0.2.3 (2025-03-05)
36
+ ------------------
37
+
38
+ * fix: bump-my-version was updating pdbnucleicacids version too
39
+
40
+ * fix: import classes instead of modules
41
+
42
+ * chore: remove old tox environments
43
+
44
+
45
+ 0.3.0 (2025-03-05)
46
+
47
+ * Feature: get all continous protein-bound double-strand nucleic acids;
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: biointerface
3
- Version: 0.2.2
4
- Summary: BioInterface is a python package capable of extracting Protein-DNA interfaces from PDB/mmCif structures.
3
+ Version: 0.3.0
4
+ Summary: BioInterface is a Biopython based package that extracts Protein-DNA interfaces in a PDB structures.
5
5
  Author-email: Alessandro Pandolfi <alessandro.pandolfi@protonmail.com>
6
6
  Maintainer-email: Alessandro Pandolfi <alessandro.pandolfi@protonmail.com>
7
7
  License: MIT license
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  License-File: AUTHORS.rst
15
15
  Requires-Dist: pandas
16
16
  Requires-Dist: biopython
17
- Requires-Dist: pdbnucleicacids>=0.2
17
+ Requires-Dist: pdbnucleicacids>=0.2.1
18
18
  Provides-Extra: dev
19
19
  Requires-Dist: coverage; extra == "dev"
20
20
  Requires-Dist: mypy; extra == "dev"
@@ -101,12 +101,12 @@ Feaures
101
101
 
102
102
  * Interface data as ``pandas`` DataFrame;
103
103
 
104
+ * Get all continous protein-bound double-strand nucleic acids;
105
+
104
106
 
105
107
  TODO
106
108
  --------
107
109
 
108
- * Extract continous bound DNA sequence
109
-
110
110
  * Proper tests (WIP)
111
111
 
112
112
 
@@ -78,12 +78,12 @@ Feaures
78
78
 
79
79
  * Interface data as ``pandas`` DataFrame;
80
80
 
81
+ * Get all continous protein-bound double-strand nucleic acids;
82
+
81
83
 
82
84
  TODO
83
85
  --------
84
86
 
85
- * Extract continous bound DNA sequence
86
-
87
87
  * Proper tests (WIP)
88
88
 
89
89
 
@@ -35,7 +35,7 @@ You can extract a single Protein-DNA interface from a single protein chain.
35
35
  # extract interface from a specific protein chain
36
36
  face = Interface(
37
37
  structure=structure,
38
- protein_chain_id="A",
38
+ protein_chain_id="F",
39
39
  search_radius=5.0
40
40
  )
41
41
  face
@@ -119,7 +119,7 @@ First of all you can get all interacting atoms as atom pairs.
119
119
 
120
120
  .. code-block:: python
121
121
 
122
- contacts = face.get_get_atomic_contacts()
122
+ contacts = face.get_atomic_contacts()
123
123
  contacts[:5]
124
124
 
125
125
  .. code-block:: console
@@ -192,3 +192,34 @@ You can get all Protein-DNA interface features as a ``pandas`` DataFrame.
192
192
  257 F 157 ... 4.299844
193
193
 
194
194
  [258 rows x 23 columns]
195
+
196
+
197
+ Protein-Bound Nucleic Acids
198
+ ---------------------------
199
+
200
+ BioInterface can extract all double-strand nucleic acids bound by
201
+ the input protein, as a ``DoubleStrandNucleicAcid`` class from the package
202
+ PDBNucleicAcids_.
203
+
204
+ .. code-block:: python
205
+
206
+ bound_dsna_list = face.get_bound_double_strands()
207
+ bound_dsna = dsna_list[0]
208
+ bound_dsna
209
+
210
+ .. code-block:: console
211
+
212
+ <DoubleStrandNucleicAcid type='dsDNA' i-th strand='A' j-th strand='B'
213
+ length=9>
214
+
215
+ The ``DoubleStrandNucleicAcid`` class has other useful methods.
216
+
217
+ .. code-block:: python
218
+
219
+ bound_dsna.get_i_strand().get_seq()
220
+
221
+ .. code-block:: console
222
+
223
+ Seq('GTTTCATAG')
224
+
225
+ .. _PDBNucleicAcids: https://gitlab.com/MorfeoRenai/pdbnucleicacids
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "biointerface"
7
- version = "0.2.2"
8
- description = "BioInterface is a python package capable of extracting Protein-DNA interfaces from PDB/mmCif structures."
7
+ version = "0.3.0"
8
+ description = "BioInterface is a Biopython based package that extracts Protein-DNA interfaces in a PDB structures."
9
9
  readme = "README.rst"
10
10
  authors = [
11
11
  {name = "Alessandro Pandolfi", email = "alessandro.pandolfi@protonmail.com"}
@@ -20,7 +20,7 @@ license = {text = "MIT license"}
20
20
  dependencies = [
21
21
  "pandas",
22
22
  "biopython",
23
- "pdbnucleicacids >= 0.2",
23
+ "pdbnucleicacids >= 0.2.1",
24
24
  ]
25
25
 
26
26
  [project.optional-dependencies]
@@ -32,7 +32,6 @@ dev = [
32
32
  ]
33
33
 
34
34
  [project.urls]
35
-
36
35
  bugs = "https://gitlab.com/MorfeoRenai/biointerface/-/issues"
37
36
  changelog = "https://gitlab.com/MorfeoRenai/biointerface/-/blob/main/HISTORY.rst"
38
37
  homepage = "https://gitlab.com/MorfeoRenai/biointerface"
@@ -44,8 +43,6 @@ package-dir = {"" = "src"}
44
43
  "*" = ["*.*"]
45
44
 
46
45
 
47
-
48
-
49
46
  # Mypy
50
47
  # ----
51
48
 
@@ -64,8 +61,6 @@ allow_untyped_defs = true
64
61
  disable_error_code = "attr-defined"
65
62
 
66
63
 
67
-
68
-
69
64
  # pytest
70
65
  # ----
71
66
 
@@ -77,13 +72,11 @@ testpaths = [
77
72
  ]
78
73
 
79
74
 
80
-
81
-
82
75
  # bump-my-version
83
76
  # ----
84
77
 
85
78
  [tool.bumpversion]
86
- current_version = "0.2.2"
79
+ current_version = "0.3.0"
87
80
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
88
81
  serialize = ["{major}.{minor}.{patch}"]
89
82
  search = "{current_version}"
@@ -91,7 +84,7 @@ replace = "{new_version}"
91
84
  regex = false
92
85
  ignore_missing_version = false
93
86
  ignore_missing_files = false
94
- tag = false
87
+ tag = true
95
88
  sign_tags = false
96
89
  tag_name = "v{new_version}"
97
90
  tag_message = "Bump version: {current_version} → {new_version}"
@@ -110,10 +103,8 @@ replace = "{new_version}"
110
103
 
111
104
  [[tool.bumpversion.files]]
112
105
  filename = "pyproject.toml"
113
- search = "{current_version}"
114
- replace = "{new_version}"
115
-
116
-
106
+ search = 'version = "{current_version}"'
107
+ replace = 'version = "{new_version}"'
117
108
 
118
109
 
119
110
  # ruff
@@ -131,8 +122,6 @@ show-fixes = true
131
122
  extend-select = ["E501"]
132
123
 
133
124
 
134
-
135
-
136
125
  # tox
137
126
  # ----
138
127
 
@@ -140,7 +129,7 @@ extend-select = ["E501"]
140
129
  #requires = ["tox>=4.19"]
141
130
  requires = ["tox"]
142
131
  # Elenco delle versioni di Python con cui testare
143
- envlist = ["py38", "py39", "py310", "py311", "py312", "py313"]
132
+ envlist = ["py310", "py311", "py312", "py313"]
144
133
 
145
134
  [tool.tox.env_run_base] # Configurazione generale per tutti gli ambienti di test
146
135
  description = "Run the tests with pytest"
@@ -172,3 +161,4 @@ description = "Run the tests on Python 3.13"
172
161
  #description = "Run linting"
173
162
  #deps = ["flake8"]
174
163
  #commands = ["flake8 src tests"]
164
+
@@ -4,6 +4,6 @@ from biointerface.core import Interface, build_interfaces
4
4
 
5
5
  __author__ = """Alessandro Pandolfi"""
6
6
  __email__ = "alessandro.pandolfi@protonmail.com"
7
- __version__ = "0.2.2"
7
+ __version__ = "0.3.0"
8
8
 
9
9
  __all__ = ["Interface", "build_interfaces"]
@@ -2,15 +2,26 @@
2
2
 
3
3
  from Bio.PDB.Polypeptide import PPBuilder
4
4
  from Bio.PDB.NeighborSearch import NeighborSearch
5
- from Bio.PDB import Atom, Residue
5
+ from Bio.PDB.Residue import Residue
6
+ from Bio.PDB.Atom import Atom
6
7
  from Bio.PDB.PDBExceptions import PDBConstructionException
7
8
 
8
- # from Bio.PDB import Structure, Model, Chain
9
+ # from Bio.PDB.Structure import Structure
10
+ # from Bio.PDB.Model import Model
11
+ # from Bio.PDB.Chain import Chain
9
12
  # from Bio.PDB import MMCIFIO
10
13
 
11
14
  import pandas as pd
12
15
 
13
- from PDBNucleicAcids.NucleicAcid import NABuilder
16
+ from PDBNucleicAcids.NucleicAcid import (
17
+ NABuilder,
18
+ DSNABuilder,
19
+ DoubleStrandNucleicAcid,
20
+ )
21
+
22
+ import copy
23
+
24
+ import warnings
14
25
 
15
26
 
16
27
  def build_interfaces(structure, search_radius=5.0) -> list:
@@ -95,7 +106,7 @@ class Interface:
95
106
 
96
107
  def _extract_contacts(self) -> list[tuple[Atom]]:
97
108
  """
98
- Extract interface contacts.
109
+ Extract interface contacts (PRIVATE).
99
110
 
100
111
  Raises
101
112
  ------
@@ -355,6 +366,70 @@ chain id: {self.protein_chain_id}"
355
366
 
356
367
  return df
357
368
 
369
+ def get_bound_double_strands(self) -> list[DoubleStrandNucleicAcid]:
370
+ """
371
+ Get all double-strand nucleic acids bound by the protein.
372
+
373
+ The output double stranded nucleic acids (DSNAs) are subsequences
374
+ of the full DSNAs found in the structure,
375
+ since proteins usually do not bind the whole DSNA.
376
+
377
+ This method allows for "gaps" of unbound base-pairs inside the
378
+ DSNA, only the base pairs at the ends are trimmed accourding
379
+ to being protein-bound or not.
380
+
381
+ A visual example of "gaps":
382
+ ```
383
+ Input full DSNA: GATATACAAGCCA
384
+ Protein-bound: **** **
385
+ Output protein-bound DSNA: TATACAAG
386
+ ```
387
+
388
+ Returns
389
+ -------
390
+ bound_dsna_list : list[DoubleStrandNucleicAcid]
391
+ List of double-strand nucleic acids bound by the protein.
392
+
393
+ """
394
+ bound_nucleotides = self.get_nucleotides()
395
+
396
+ builder = DSNABuilder()
397
+ dsna_list = builder.build_double_strands(self.structure)
398
+ bound_dsna_list = []
399
+ for dsna in dsna_list:
400
+ bound_dsna = copy.copy(dsna)
401
+ while (
402
+ bound_dsna[0].i_res not in bound_nucleotides
403
+ and bound_dsna[0].j_res not in bound_nucleotides
404
+ ):
405
+ # if the FIRST base pair isn't bound by protein
406
+ # then discard it and check the next FIRST base pair
407
+ bound_dsna.pop(0)
408
+
409
+ while (
410
+ bound_dsna[-1].i_res not in bound_nucleotides
411
+ and bound_dsna[-1].j_res not in bound_nucleotides
412
+ ):
413
+ # if the LAST base pair isn't bound by protein
414
+ # then discard it and check the next LAST base pair
415
+ bound_dsna.pop(-1)
416
+
417
+ if len(bound_dsna) > 0:
418
+ # in this case, there is an actual bound DSNA
419
+ bound_dsna_list.append(bound_dsna)
420
+
421
+ for bp in bound_dsna:
422
+ if (
423
+ bp.i_res not in bound_nucleotides
424
+ and bp.j_res not in bound_nucleotides
425
+ ):
426
+ warnings.warn(
427
+ f"Warning: there are unbound base-pairs \
428
+ inside the resulting DoubleStrandNucleicAcid - {bp}"
429
+ )
430
+
431
+ return bound_dsna_list
432
+
358
433
 
359
434
  # def export_atom_list(structure_id, atom_list, out_filepath):
360
435
  # """Export atom list."""
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: biointerface
3
- Version: 0.2.2
4
- Summary: BioInterface is a python package capable of extracting Protein-DNA interfaces from PDB/mmCif structures.
3
+ Version: 0.3.0
4
+ Summary: BioInterface is a Biopython based package that extracts Protein-DNA interfaces in a PDB structures.
5
5
  Author-email: Alessandro Pandolfi <alessandro.pandolfi@protonmail.com>
6
6
  Maintainer-email: Alessandro Pandolfi <alessandro.pandolfi@protonmail.com>
7
7
  License: MIT license
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  License-File: AUTHORS.rst
15
15
  Requires-Dist: pandas
16
16
  Requires-Dist: biopython
17
- Requires-Dist: pdbnucleicacids>=0.2
17
+ Requires-Dist: pdbnucleicacids>=0.2.1
18
18
  Provides-Extra: dev
19
19
  Requires-Dist: coverage; extra == "dev"
20
20
  Requires-Dist: mypy; extra == "dev"
@@ -101,12 +101,12 @@ Feaures
101
101
 
102
102
  * Interface data as ``pandas`` DataFrame;
103
103
 
104
+ * Get all continous protein-bound double-strand nucleic acids;
105
+
104
106
 
105
107
  TODO
106
108
  --------
107
109
 
108
- * Extract continous bound DNA sequence
109
-
110
110
  * Proper tests (WIP)
111
111
 
112
112
 
@@ -1,6 +1,6 @@
1
1
  pandas
2
2
  biopython
3
- pdbnucleicacids>=0.2
3
+ pdbnucleicacids>=0.2.1
4
4
 
5
5
  [dev]
6
6
  coverage
@@ -1,14 +0,0 @@
1
- =======
2
- History
3
- =======
4
-
5
- 0.1.0 (2025-02-08)
6
- ------------------
7
-
8
- * First release on PyPI.
9
-
10
-
11
- 0.2.0 (2025-02-28)
12
- ------------------
13
-
14
- * Feature: Interface class, with getter methods for atoms, dataframes etc
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes