biobb-structure-checking 3.15.6__tar.gz → 3.16.2__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 (67) hide show
  1. {biobb_structure_checking-3.15.6/biobb_structure_checking.egg-info → biobb_structure_checking-3.16.2}/PKG-INFO +18 -5
  2. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/README.md +16 -3
  3. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/check_structure.py +1 -1
  4. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/backbone.py +4 -1
  5. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/ligands.py +41 -2
  6. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/metals.py +42 -1
  7. biobb_structure_checking-3.16.2/biobb_structure_checking/commands/water.py +109 -0
  8. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/constants.py +11 -3
  9. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/commands.hlp +5 -3
  10. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/data_lib.json +27 -5
  11. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/sequencedata.py +9 -7
  12. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/structuredata.py +11 -4
  13. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/utils.py +30 -5
  14. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/mmb_server.py +2 -0
  15. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/param_input.py +5 -3
  16. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/structure_checking.py +8 -4
  17. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/structure_manager.py +30 -13
  18. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2/biobb_structure_checking.egg-info}/PKG-INFO +18 -5
  19. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/setup.py +2 -2
  20. biobb_structure_checking-3.15.6/biobb_structure_checking/commands/water.py +0 -51
  21. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/LICENSE +0 -0
  22. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/MANIFEST.in +0 -0
  23. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/__init__.py +0 -0
  24. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/__init__.py +0 -0
  25. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/add_hydrogen.py +0 -0
  26. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/altloc.py +0 -0
  27. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/amide.py +0 -0
  28. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/chains.py +0 -0
  29. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/chiral.py +0 -0
  30. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/chiral_bck.py +0 -0
  31. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/cistransbck.py +0 -0
  32. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/clashes.py +0 -0
  33. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/fixside.py +0 -0
  34. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/getss.py +0 -0
  35. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/inscodes.py +0 -0
  36. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/models.py +0 -0
  37. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/mutateside.py +0 -0
  38. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/rem_hydrogen.py +0 -0
  39. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/commands/sequences.py +0 -0
  40. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/ADT_prm.json +0 -0
  41. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/CMIP_prm.json +0 -0
  42. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/all_residues.in +0 -0
  43. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/modRes/modSER.json +0 -0
  44. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/modRes/modTHR.json +0 -0
  45. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/modRes/modTYR.json +0 -0
  46. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/modRes/modres.json +0 -0
  47. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/dat/modRes/modres_phospho.json +0 -0
  48. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/libs/__init__.py +0 -0
  49. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/libs/data_lib_manager.py +0 -0
  50. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/libs/residue_lib_manager.py +0 -0
  51. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modeller_manager.py +0 -0
  52. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/__init__.py +0 -0
  53. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/chainsdata.py +0 -0
  54. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/modelsdata.py +0 -0
  55. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/modelling/residue_set.py +0 -0
  56. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/mutation_manager.py +0 -0
  57. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/PDBIO_extended.py +0 -0
  58. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/__init__.py +0 -0
  59. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/bare_builder.py +0 -0
  60. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/pdbio/json_writer.py +0 -0
  61. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking/py.typed +0 -0
  62. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking.egg-info/SOURCES.txt +0 -0
  63. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking.egg-info/dependency_links.txt +0 -0
  64. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking.egg-info/entry_points.txt +0 -0
  65. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking.egg-info/requires.txt +0 -0
  66. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/biobb_structure_checking.egg-info/top_level.txt +0 -0
  67. {biobb_structure_checking-3.15.6 → biobb_structure_checking-3.16.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biobb_structure_checking
3
- Version: 3.15.6
3
+ Version: 3.16.2
4
4
  Summary: BioBB_structure_checking performs MDWeb structure checking tool set as a command line utility.
5
5
  Home-page: https://github.com/bioexcel/biobb_structure_checking
6
6
  Author: Biobb developers
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3
13
13
  Classifier: License :: OSI Approved :: Apache Software License
14
14
  Classifier: Operating System :: MacOS :: MacOS X
15
15
  Classifier: Operating System :: POSIX
16
- Requires-Python: >=3.8
16
+ Requires-Python: >=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: psutil
@@ -33,6 +33,19 @@ Dynamic: requires-python
33
33
  Dynamic: summary
34
34
 
35
35
  # biobb_structure_checking
36
+ [![](https://img.shields.io/github/v/tag/bioexcel/biobb_structure_checking?label=Version)](https://GitHub.com/bioexcel/biobb_sructure_checking/tags/)
37
+ [![](https://img.shields.io/pypi/v/biobb-structure-checking.svg?label=Pypi)](https://pypi.org/project/biobb-structure-checking/)
38
+ [![](https://img.shields.io/conda/vn/bioconda/biobb_structure_checking?label=Conda)](https://anaconda.org/bioconda/biobb_structure_checking)
39
+ [![](https://img.shields.io/conda/dn/bioconda/biobb_structure_checking?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_structure_checking)
40
+ [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_structure_checking?tab=tags)
41
+
42
+ [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
43
+ [![](https://img.shields.io/badge/Open%20Source%3f-Yes!-blue)](https://github.com/bioexcel/biobb_structure_checking)
44
+
45
+ [![](https://readthedocs.org/projects/biobb-structure-checking/badge/?version=latest&label=Docs)](https://biobb-structure-checking.readthedocs.io/en/latest/?badge=latest)
46
+
47
+ [![](https://img.shields.io/github/last-commit/bioexcel/biobb_structure_checking?label=Last%20Commit)](https://github.com/bioexcel/biobb_structure_checking/commits/master)
48
+
36
49
  ### Introduction
37
50
  Biobb_structure_checking provides a series of functions to check the quality of a 3D structure intended to facilitate the setup of a molecular dynamics simulation of protein or nucleic acids systems.
38
51
 
@@ -44,7 +57,7 @@ The latest documentation of this package can be found in our readthedocs site:
44
57
  [latest package documentation](http://biobb_structure_checking.readthedocs.io/en/latest/).
45
58
 
46
59
  ### Version
47
- v3.15.6 March 2025
60
+ v3.16.2 Feb 2026
48
61
 
49
62
  ### Requirements
50
63
 
@@ -61,7 +74,7 @@ Using PIP:
61
74
 
62
75
  * Installation:
63
76
 
64
- pip install "biobb_structure_checking>=3.15.0"
77
+ pip install "biobb_structure_checking>=3.16.0"
65
78
 
66
79
  * Usage: [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html).
67
80
 
@@ -69,7 +82,7 @@ Using ANACONDA:
69
82
 
70
83
  * Installation:
71
84
 
72
- conda install -c bioconda "biobb_structure_checking>=3.15.0"
85
+ conda install -c bioconda "biobb_structure_checking>=3.16.0"
73
86
 
74
87
  * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb_structure_checking.readthedocs.io/en/latest/command_line.html)
75
88
 
@@ -1,4 +1,17 @@
1
1
  # biobb_structure_checking
2
+ [![](https://img.shields.io/github/v/tag/bioexcel/biobb_structure_checking?label=Version)](https://GitHub.com/bioexcel/biobb_sructure_checking/tags/)
3
+ [![](https://img.shields.io/pypi/v/biobb-structure-checking.svg?label=Pypi)](https://pypi.org/project/biobb-structure-checking/)
4
+ [![](https://img.shields.io/conda/vn/bioconda/biobb_structure_checking?label=Conda)](https://anaconda.org/bioconda/biobb_structure_checking)
5
+ [![](https://img.shields.io/conda/dn/bioconda/biobb_structure_checking?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_structure_checking)
6
+ [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_structure_checking?tab=tags)
7
+
8
+ [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
9
+ [![](https://img.shields.io/badge/Open%20Source%3f-Yes!-blue)](https://github.com/bioexcel/biobb_structure_checking)
10
+
11
+ [![](https://readthedocs.org/projects/biobb-structure-checking/badge/?version=latest&label=Docs)](https://biobb-structure-checking.readthedocs.io/en/latest/?badge=latest)
12
+
13
+ [![](https://img.shields.io/github/last-commit/bioexcel/biobb_structure_checking?label=Last%20Commit)](https://github.com/bioexcel/biobb_structure_checking/commits/master)
14
+
2
15
  ### Introduction
3
16
  Biobb_structure_checking provides a series of functions to check the quality of a 3D structure intended to facilitate the setup of a molecular dynamics simulation of protein or nucleic acids systems.
4
17
 
@@ -10,7 +23,7 @@ The latest documentation of this package can be found in our readthedocs site:
10
23
  [latest package documentation](http://biobb_structure_checking.readthedocs.io/en/latest/).
11
24
 
12
25
  ### Version
13
- v3.15.6 March 2025
26
+ v3.16.2 Feb 2026
14
27
 
15
28
  ### Requirements
16
29
 
@@ -27,7 +40,7 @@ Using PIP:
27
40
 
28
41
  * Installation:
29
42
 
30
- pip install "biobb_structure_checking>=3.15.0"
43
+ pip install "biobb_structure_checking>=3.16.0"
31
44
 
32
45
  * Usage: [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html).
33
46
 
@@ -35,7 +48,7 @@ Using ANACONDA:
35
48
 
36
49
  * Installation:
37
50
 
38
- conda install -c bioconda "biobb_structure_checking>=3.15.0"
51
+ conda install -c bioconda "biobb_structure_checking>=3.16.0"
39
52
 
40
53
  * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb_structure_checking.readthedocs.io/en/latest/command_line.html)
41
54
 
@@ -18,7 +18,7 @@ from biobb_structure_checking.structure_checking import StructureChecking
18
18
 
19
19
  BANNER = "================================================================================\n"\
20
20
  "= BioBB structure checking utility v{:10} =\n"\
21
- "= P. Andrio, A. Hospital, G. Bayarri, J.L. Gelpi 2018-23 =\n"\
21
+ "= P. Andrio, A. Hospital, G. Bayarri, J.L. Gelpi 2018-26 =\n"\
22
22
  "================================================================================\n"
23
23
 
24
24
 
@@ -101,6 +101,7 @@ def fix(strcheck, opts, fix_data=None):
101
101
  fix_done = not fix_data['bck_breaks_list']
102
102
 
103
103
  fixed_main_res = []
104
+
104
105
  while not fix_done:
105
106
  if opts['extra_gap'] is None:
106
107
  opts['extra_gap'] = 0
@@ -115,7 +116,9 @@ def fix(strcheck, opts, fix_data=None):
115
116
  fix_done = True
116
117
  continue
117
118
  fixed_main_res += fixed_main
118
-
119
+ for r in fixed_main_res:
120
+ print(r)
121
+ print(mu.residue_id(r))
119
122
  strcheck.summary['backbone']['main_chain_fix'] = [
120
123
  mu.residue_id(r)
121
124
  for r in fixed_main_res
@@ -18,25 +18,64 @@ def check(strcheck):
18
18
  return {}
19
19
 
20
20
  print(cts.MSGS['LIGANDS_DETECTED'].format(len(lig_list)))
21
+
22
+ lig_names = {}
23
+ for res in lig_list:
24
+ if res.get_resname() not in lig_names:
25
+ if not strcheck.args['no_network']:
26
+ lig_names[res.get_resname()] = mu.fetch_residue_name_by_id(res.get_resname())
27
+ else:
28
+ lig_names[res.get_resname()] = ''
29
+
21
30
  fix_data = {
22
31
  'lig_list': lig_list,
23
32
  'ligand_rids': set(),
24
33
  'ligand_rnums': []
25
34
  }
35
+
26
36
  strcheck.summary['ligands'] = {'detected': []}
27
37
 
28
38
  for res in sorted(lig_list, key=lambda x: x.index):
29
39
  if strcheck.strucm.models_data.has_models():
30
40
  if res.get_parent().get_parent().id > 0:
31
41
  continue
32
- print(f" {mu.residue_id(res, False)}/*")
42
+ print(f" {mu.residue_id(res, False)}/* {lig_names[res.get_resname()]} ")
33
43
  else:
34
- print(f" {mu.residue_id(res, False)}")
44
+ print(f" {mu.residue_id(res, False)} {lig_names[res.get_resname()]}" )
35
45
 
36
46
  strcheck.summary['ligands']['detected'].append(mu.residue_id(res))
37
47
  fix_data['ligand_rids'].add(res.get_resname())
38
48
  fix_data['ligand_rnums'].append(mu.residue_num(res))
39
49
 
50
+ lig_contacts = {lig: set() for lig in lig_list}
51
+
52
+ for _, contacts in strcheck.strucm.check_r_list_clashes(
53
+ lig_list,
54
+ contact_types= ['ligand'],
55
+ use_wat=True
56
+ ).items():
57
+ if contacts:
58
+ for atom1, atom2, dist in contacts.values():
59
+ if atom1.serial_number > atom2.serial_number:
60
+ atom2, atom1 = atom1, atom2
61
+ res1 = atom1.get_parent()
62
+ res2 = atom2.get_parent()
63
+ if mu.is_hetatm(res1) and res1 in lig_contacts:
64
+ lig_contacts[res1].add(atom2)
65
+ if mu.is_hetatm(res2) and res2 in lig_contacts:
66
+ lig_contacts[res2].add(atom1)
67
+
68
+ strcheck.summary['ligands']['contacts'] = {}
69
+ for lig in sorted(lig_contacts, key=lambda x:(x.get_parent().id, mu.residue_num(x))):
70
+ contacts = sorted(
71
+ lig_contacts[lig],
72
+ key=lambda x: (
73
+ x.get_parent().get_parent().id,
74
+ mu.residue_num(x.get_parent())
75
+ )
76
+ )
77
+ strcheck.summary['ligands']['contacts'][mu.residue_id(lig)] = [mu.atom_id(c) for c in contacts]
78
+ print(f"Contacts for {mu.residue_id(lig)}: {', '.join([mu.atom_id(c) for c in contacts])}")
40
79
  return fix_data
41
80
 
42
81
 
@@ -23,14 +23,55 @@ def check(strcheck):
23
23
  'met_rids': [],
24
24
  'at_groups': {}
25
25
  }
26
+ met_names = {}
27
+ met_res_list = []
28
+ for atom in met_list:
29
+ res = atom.get_parent()
30
+ met_res_list.append(res)
31
+ if res.get_resname() not in met_names:
32
+ if strcheck.args['no_network']:
33
+ met_names[res.get_resname()] = ''
34
+ else:
35
+ met_names[res.get_resname()] = mu.fetch_residue_name_by_id(res.get_resname())
36
+
26
37
  for atm in sorted(met_list, key=lambda x: x.serial_number):
27
- print(f" {mu.atom_id(atm):12}")
38
+ print(f" {mu.atom_id(atm):12} {met_names[atm.get_parent().get_resname()]}")
28
39
  res = atm.get_parent()
29
40
  fix_data['met_rids'].append(mu.residue_num(res))
30
41
  if atm.id not in fix_data['at_groups']:
31
42
  fix_data['at_groups'][atm.id] = []
32
43
  fix_data['at_groups'][atm.id].append(atm)
33
44
  strcheck.summary['metals']['detected'].append(mu.residue_id(res))
45
+
46
+ met_contacts = {met: set() for met in met_res_list}
47
+
48
+ for _, contacts in strcheck.strucm.check_r_list_clashes(
49
+ met_res_list,
50
+ contact_types= ['ligand'],
51
+ use_wat=True
52
+ ).items():
53
+ if contacts:
54
+ for atom1, atom2, dist in contacts.values():
55
+ if atom1.serial_number > atom2.serial_number:
56
+ atom2, atom1 = atom1, atom2
57
+ res1 = atom1.get_parent()
58
+ res2 = atom2.get_parent()
59
+ if mu.is_hetatm(res1) and res1 in met_contacts:
60
+ met_contacts[res1].add(atom2)
61
+ if mu.is_hetatm(res2) and res2 in met_contacts:
62
+ met_contacts[res2].add(atom1)
63
+
64
+ strcheck.summary['metals']['contacts'] = {}
65
+ for lig in sorted(met_contacts, key=lambda x:(x.get_parent().id, mu.residue_num(x))):
66
+ contacts = sorted(
67
+ met_contacts[lig],
68
+ key=lambda x: (
69
+ x.get_parent().get_parent().id,
70
+ mu.residue_num(x.get_parent())
71
+ )
72
+ )
73
+ strcheck.summary['metals']['contacts'][mu.residue_id(lig)] = [mu.atom_id(c) for c in contacts]
74
+ print(f"Contacts for {mu.residue_id(lig)}: {', '.join([mu.atom_id(c) for c in contacts])}")
34
75
 
35
76
  return fix_data
36
77
 
@@ -0,0 +1,109 @@
1
+ """ Module supporting models command"""
2
+ import biobb_structure_checking.constants as cts
3
+ import biobb_structure_checking.modelling.utils as mu
4
+ from biobb_structure_checking.pdbio.param_input import ParamInput
5
+
6
+
7
+ def check(strcheck):
8
+ wat_list = [
9
+ res
10
+ for res in mu.get_ligands(strcheck.strucm.st, incl_water=True)
11
+ if mu.is_wat(res)
12
+ ]
13
+
14
+ if not wat_list:
15
+ if not strcheck.args['quiet']:
16
+ print(cts.MSGS['NO_WATERS'])
17
+ return {}
18
+
19
+ print(cts.MSGS['WATERS_FOUND'].format(len(wat_list)))
20
+ strcheck.summary['water']['n_detected'] = len(wat_list)
21
+ water_contacts = {wat: set() for wat in wat_list}
22
+
23
+ for contact_type, contacts in strcheck.strucm.check_r_list_clashes(
24
+ wat_list,
25
+ contact_types= mu.HB_CONTACT_TYPES,
26
+ use_wat=True
27
+ ).items():
28
+ if contacts:
29
+ for atom1, atom2, dist in contacts.values():
30
+ if atom1.serial_number > atom2.serial_number:
31
+ atom2, atom1 = atom1, atom2
32
+ res1 = atom1.get_parent()
33
+ res2 = atom2.get_parent()
34
+ if mu.is_wat(res1) and mu.is_wat(res2):
35
+ continue
36
+ if mu.is_wat(res1):
37
+ water_contacts[res1].add(res2)
38
+ if mu.is_wat(res2):
39
+ water_contacts[res2].add(res1)
40
+
41
+ strcheck.summary['water']['contacts'] = {}
42
+ for wat, contacts in water_contacts.items():
43
+ strcheck.summary['water']['contacts'][mu.residue_id(wat)] = sorted(mu.residue_id(res) for res in contacts)
44
+
45
+ wats_per_n_contacts = [set() for s in range(0, 5)]
46
+
47
+ for wat, contacts in sorted(water_contacts.items()):
48
+ n_contacts = len(contacts)
49
+ if n_contacts < 5:
50
+ wats_per_n_contacts[n_contacts].add(wat)
51
+ for n_contacts, wat_set in enumerate(wats_per_n_contacts):
52
+ if len(wat_set) > 0:
53
+ print(f"Water molecules in contact with {n_contacts} residues: {', '.join(mu.residue_id(wat) for wat in sorted(wat_set))}")
54
+ return {'wat_list': wat_list, 'water_contacts': water_contacts}
55
+
56
+
57
+ def fix(strcheck, opts, fix_data=None):
58
+
59
+ if opts['remove'] is not None:
60
+ if isinstance(opts, str):
61
+ remove_wat = opts
62
+ else:
63
+ remove_wat = opts['remove']
64
+ else:
65
+ remove_wat = opts['keep'] if opts['keep'] is not None else None
66
+
67
+ input_line = ParamInput(
68
+ 'Remove',
69
+ strcheck.args['non_interactive'],
70
+ set_none='no'
71
+ )
72
+ input_line.add_option_yes_no()
73
+ input_line.add_option_numeric(
74
+ 'keep',
75
+ [0, 1, 2, 3, 4],
76
+ 'int',
77
+ 0,
78
+ 4,
79
+ multiple=False,
80
+ label_text="Keep contacts with at least N residues"
81
+ )
82
+
83
+ input_line.set_default('yes')
84
+ input_option, remove_wat = input_line.run(remove_wat)
85
+
86
+ if input_option == 'error':
87
+ return cts.MSGS['UNKNOWN_SELECTION'], remove_wat
88
+
89
+ if input_option == 'yes':
90
+ rmw_num = 0
91
+ for res in fix_data['wat_list']:
92
+ strcheck.strucm.remove_residue(res, False)
93
+ rmw_num += 1
94
+ strcheck.strucm.update_internals()
95
+ print(cts.MSGS['WATER_REMOVED'].format(rmw_num))
96
+ strcheck.summary['water']['n_removed'] = rmw_num
97
+
98
+ elif input_option == 'keep':
99
+ strcheck.summary['water']['removed'] = []
100
+ n_removed = 0
101
+ for res in fix_data['water_contacts']:
102
+ if len(fix_data['water_contacts'][res]) < int(remove_wat):
103
+ strcheck.summary['water']['removed'].append(mu.residue_id(res))
104
+ strcheck.strucm.remove_residue(res, False)
105
+ n_removed += 1
106
+ print(cts.MSGS['WATER_KEEP'].format(n_removed, remove_wat))
107
+ strcheck.strucm.update_internals()
108
+
109
+ return False
@@ -9,7 +9,7 @@ from os.path import join as opj
9
9
 
10
10
  from biobb_structure_checking.pdbio.param_input import Dialog
11
11
 
12
- VERSION = '3.15.6'
12
+ VERSION = '3.16.2'
13
13
 
14
14
  # Default locations and settings
15
15
  DATA_DIR_DEFAULT_PATH = 'dat'
@@ -136,8 +136,7 @@ CMD_LINE.add_argument(
136
136
  CMD_LINE.add_argument(
137
137
  '--pdb_server',
138
138
  dest='pdb_server',
139
- help='Server for retrieving structures (default(ftp at wwPDB)|MMB|BSC), '
140
- 'use alternate server for http(s) download'
139
+ help='Server for retrieving structures (default(wwPDB)| BSC)'
141
140
  )
142
141
 
143
142
  CMD_LINE.add_argument(
@@ -289,6 +288,13 @@ CMD_LINE.add_argument(
289
288
  help='Do not prompt for missing parameters'
290
289
  )
291
290
 
291
+ CMD_LINE.add_argument(
292
+ '--no_network',
293
+ action='store_true',
294
+ dest='no_network',
295
+ help='Network disabled, do not try to download missing parameters'
296
+ )
297
+
292
298
  CMD_LINE.add_argument(
293
299
  'command',
294
300
  help="Command to execute (help: check_structure commands) ",
@@ -406,6 +412,7 @@ DIALOGS.add_option('metals', '--remove', 'remove', 'Remove Metal ions')
406
412
 
407
413
  DIALOGS.add_entry('water', 'Checks and optionally removes water molecules')
408
414
  DIALOGS.add_option('water', '--remove', 'remove', 'Remove All Water molecules')
415
+ DIALOGS.add_option('water', '--keep_min_contacts', 'keep', 'Remove All Water molecules with less contacts')
409
416
 
410
417
  DIALOGS.add_entry(
411
418
  'ligands',
@@ -683,6 +690,7 @@ MSGS = {
683
690
  # Waters
684
691
  'WATERS_FOUND': 'Detected {} Water molecules',
685
692
  'WATER_REMOVED': 'Removed {} Water molecules',
693
+ 'WATER_KEEP': 'Removed {} Water molecules with less than {} contacts',
686
694
  'NO_WATERS': 'No water molecules found',
687
695
  # ligands
688
696
  'LIGANDS_DETECTED': 'Detected {} Ligands',
@@ -24,6 +24,7 @@ chains [--select chain_ids | molecule_type] [--rename (auto|new label)]
24
24
  --rename allow to fix unlabelled chains
25
25
  --renumber allow to reorganize residues and chains by moving or renunbering fragments. Auto generate consecutive residue numbers.
26
26
  --rem_inscodes removes insertion codes when renumbering chains
27
+ --rebuild rebuild chains from coordinates
27
28
  inscodes
28
29
  Detects residues with insertion codes.
29
30
  --renumber fix insertion codes by renumbering chain residues
@@ -35,8 +36,9 @@ ligands [--remove All | None | Res_type_list | Residue_list]
35
36
  Detect/Remove Ligands
36
37
  getss Detect SS Bonds
37
38
  --mark Replace relevant CYS by CYX to mark SS Bond (HG atom removed if present)
38
- water [--remove Yes|No]
39
- Remove Water molecules
39
+ water [--remove Yes|No] [--keep_min_contacts KEEP]
40
+ --remove Remove Water molecules
41
+ --keep_min_contacts KEEP - Remove All Water molecules with less then KEEP contacts (0-4)
40
42
  rem_hydrogen [--remove Yes|No]
41
43
  Remove Hydrogen atoms from structure
42
44
  mutateside [--mut mutation_list|file:mutations_file] [--no_check_clashes]
@@ -81,5 +83,5 @@ backbone [--fix_atoms All|None|Residue List]
81
83
  3. Structure Warnings (no fix)
82
84
 
83
85
  cistransbck Analyzes cis-trans dihedrals on backbone atoms
84
- clashes Steric clashes (Severe, Apolar, Polar Donors, Polar Acceptors,
86
+ clashes Steric clashes (Severe/Covalent, Apolar, Polar Donors, Polar Acceptors,
85
87
  Ionic Positive, Ionic Negative)
@@ -91,9 +91,16 @@
91
91
  },
92
92
  "atom_data": {
93
93
  "metal_atoms": [
94
- "MG", "MN", "MO", "Mg2", "Mn2", "Ca2", "ZN", "NI", "FE",
95
- "Zn2", "Ni2", "Fe2", "CO", "CU", "HG", "Co2", "Cu2",
96
- "CD", "AG", "AU", "Cd2", "CA", "Ca"
94
+ "AG", "AL", "AM", "AR", "AS", "AU", "BA", "BE",
95
+ "BI", "CA", "CD", "CE", "CF", "CM",
96
+ "CO", "CR", "CS", "CU", "DY", "ER", "EU",
97
+ "FE", "GA", "GD", "HG", "HO",
98
+ "IN", "IR", "K", "KR", "LA", "LI", "LU", "MG",
99
+ "MN", "MO", "NA", "NI", "OS", "PB",
100
+ "PD", "PR", "PT", "PU", "RB", "RE",
101
+ "RU", "SB", "SM", "SR", "TA", "TB",
102
+ "TE", "TH", "TI", "TL", "U", "V", "W",
103
+ "XE", "YB", "ZN", "ZR"
97
104
  ]
98
105
  },
99
106
  "atom_type_ff": ["ADT", "CMIP"],
@@ -2523,7 +2530,21 @@
2523
2530
  },
2524
2531
  "DT": {}
2525
2532
  }
2533
+ },
2534
+ "HOH": {
2535
+ "polar_acceptor_atoms": ["O"],
2536
+ "polar_donor_atoms": ["O"],
2537
+ "side_atoms": [],
2538
+ "hydrogen_atoms": ["HO1", "HO2"],
2539
+ "addH_rules": {
2540
+ "*": {
2541
+ "mode": "L",
2542
+ "ats": ["HO1", "HO2"]
2543
+ }
2544
+ },
2545
+ "mutation_rules": {}
2526
2546
  }
2547
+
2527
2548
  },
2528
2549
  "distances": {
2529
2550
  "SS_DIST": 2.5,
@@ -2536,7 +2557,8 @@
2536
2557
  "polar_donor": 3.1,
2537
2558
  "polar_acceptor": 3.1,
2538
2559
  "positive": 3.5,
2539
- "negative": 3.5
2560
+ "negative": 3.5,
2561
+ "ligand": 3.1
2540
2562
  },
2541
2563
  "MAX_DIST": 4.5,
2542
2564
  "R_R_CUTOFF": { "PROT": 15.0, "NA": 21.0 },
@@ -2545,4 +2567,4 @@
2545
2567
  }
2546
2568
 
2547
2569
  }
2548
- }
2570
+ }
@@ -66,7 +66,7 @@ class SequenceData():
66
66
  'pdb': {}
67
67
  }
68
68
 
69
- def load_sequence_from_fasta(self, fasta_sequence_path):
69
+ def load_sequence_from_fasta(self, fasta_sequence_path, no_network=False):
70
70
  """ SequenceData.load_sequence_from_fasta
71
71
  Load canonical sequence from external FASTA file
72
72
 
@@ -77,6 +77,9 @@ class SequenceData():
77
77
  self.fasta = []
78
78
  remove_fasta = False
79
79
  if fasta_sequence_path:
80
+ if no_network and (fasta_sequence_path.startswith(('pdb:', 'http'))):
81
+ print("Error: no network access to retrieve FASTA sequence, but path requires it")
82
+ return False
80
83
  if fasta_sequence_path.startswith('pdb:'):
81
84
  fasta_sequence_path = fasta_sequence_path[4:]
82
85
  try:
@@ -448,12 +451,10 @@ class SequenceData():
448
451
  tgt_seq = data[ch_id]['can'].seq
449
452
  frgs = data[ch_id]['pdb']['frgs']
450
453
  pdb_seq = frgs[0].seq
451
- if len(frgs) == 1:
452
- frags_num = [
453
- f"{frgs[0].features[0].location.start}-{frgs[0].features[0].location.end}"
454
- ]
455
- else:
456
- frags_num = []
454
+ frags_num = [
455
+ f"{frgs[0].features[0].location.start}-{frgs[0].features[0].location.end}"
456
+ ]
457
+ if len(frgs) > 1:
457
458
  for i in range(1, len(frgs)):
458
459
  frag_seq = frgs[i].seq
459
460
  pdb_seq += frag_seq
@@ -479,6 +480,7 @@ class SequenceData():
479
480
  f"Frags: {','.join(frags_num)}"
480
481
  )
481
482
  outseq += SeqIO.FastaIO.as_fasta(seq)
483
+
482
484
  elif data[ch_id]['pdb']:
483
485
  last_pos = 0
484
486
  start_pos = 0
@@ -4,7 +4,7 @@ import biobb_structure_checking.modelling.utils as mu
4
4
 
5
5
  class StructureData():
6
6
  '''Class to manage internal Structure data'''
7
- def __init__(self, st, input_format, headers, biounit=False):
7
+ def __init__(self, st, input_format, headers, biounit=False, no_network=False):
8
8
  self.st = st
9
9
  self.input_format = input_format
10
10
  self.backbone_links = []
@@ -14,7 +14,7 @@ class StructureData():
14
14
  self.headers = headers
15
15
  self.biounit = biounit
16
16
  self.fixed_side = False
17
-
17
+ self.no_network = no_network
18
18
  self.hetatm = {}
19
19
  self.stats = {
20
20
  'num_res': 0,
@@ -34,6 +34,7 @@ class StructureData():
34
34
  self.non_canonical_residue_list = []
35
35
  self.next_residue = {}
36
36
  self.prev_residue = {}
37
+
37
38
 
38
39
  def residue_renumbering(self, data_library):
39
40
  """ Sets the Bio.PDB.Residue.index attribute to residues for a unique,
@@ -220,11 +221,17 @@ class StructureData():
220
221
  if self.hetatm[mu.METAL]:
221
222
  print('Metal/Ion residues found')
222
223
  for res in self.hetatm[mu.METAL]:
223
- print(mu.residue_id(res))
224
+ if self.no_network:
225
+ print(mu.residue_id(res))
226
+ else:
227
+ print(f"{mu.residue_id(res)} ({mu.fetch_residue_name_by_id(res.get_resname())})")
224
228
  if self.hetatm[mu.ORGANIC]:
225
229
  print('Small mol ligands found')
226
230
  for res in self.hetatm[mu.ORGANIC]:
227
- print(mu.residue_id(res))
231
+ if self.no_network:
232
+ print(mu.residue_id(res))
233
+ else:
234
+ print(f"{mu.residue_id(res)} ({mu.fetch_residue_name_by_id(res.get_resname())})")
228
235
 
229
236
  def _check_ca_only(self):
230
237
  ca_only = True
@@ -5,6 +5,8 @@
5
5
 
6
6
  import re
7
7
  import sys
8
+ import json
9
+ import urllib.request
8
10
  # from typing import List, Dict, Tuple, Iterable, Mapping, Union, Set
9
11
 
10
12
  import numpy as np
@@ -18,6 +20,8 @@ from Bio.PDB.vectors import Vector, rotaxis
18
20
 
19
21
  from biobb_structure_checking.constants import MSGS
20
22
 
23
+
24
+ MONOMERS_API_PREFIX = 'https://mdb-login.bsc.es/api/pdbmonomer/'
21
25
  # chain types
22
26
  PROTEIN = 1
23
27
  DNA = 2
@@ -82,6 +86,10 @@ ALL_CONTACT_TYPES = [
82
86
  'positive',
83
87
  'negative'
84
88
  ]
89
+ HB_CONTACT_TYPES = [
90
+ 'polar_acceptor',
91
+ 'polar_donor'
92
+ ]
85
93
  ALL_CONTACT_TYPES_TEXT = {
86
94
  'severe': 'Severe Steric clashes/covalent bonds',
87
95
  'apolar': 'Apolar steric clashes',
@@ -121,6 +129,9 @@ DNA_RESIDUE_CODE = {'DA', 'DC', 'DG', 'DT'}
121
129
  RNA_RESIDUE_CODE = {'A', 'C', 'G', 'U'}
122
130
  NA_RESIDUE_CODE = DNA_RESIDUE_CODE.union(RNA_RESIDUE_CODE)
123
131
  COMPLEMENT_TAB = str.maketrans('ACGTU', 'TGCAA')
132
+
133
+ MONOMER_NAME_CACHE = {}
134
+
124
135
  # Residue & Atom friendly ids
125
136
 
126
137
 
@@ -144,6 +155,16 @@ def residue_num(res, models='auto'):
144
155
  rnum += "/" + str(res.get_parent().get_parent().id + 1)
145
156
  return rnum
146
157
 
158
+ def fetch_residue_name_by_id(res_id):
159
+ ''' Fetch residue name from monomers API, with caching '''
160
+ if res_id in MONOMER_NAME_CACHE:
161
+ return MONOMER_NAME_CACHE[res_id]
162
+ with urllib.request.urlopen(f"{MONOMERS_API_PREFIX}{res_id}/entry", timeout=10) as response:
163
+ residue_data = json.load(response)
164
+ name = residue_data.get('name', '').replace(res_id, '', 1).strip()
165
+ MONOMER_NAME_CACHE[res_id] = name
166
+ return name
167
+
147
168
 
148
169
  def atom_id(atm, models='auto'):
149
170
  """ Friendly replacement for atom ids like ASN A324/0.CA """
@@ -645,16 +666,21 @@ def check_r_list_clashes(
645
666
  atom_lists,
646
667
  join_models=True,
647
668
  severe=True,
648
- get_all_contacts=False
669
+ get_all_contacts=False,
670
+ use_wat=False
649
671
  ):
650
672
  """ Check clashes generated by a list of residues """
673
+
651
674
  clash_list = {cls: {} for cls in atom_lists}
652
675
  clash_list['severe'] = {}
676
+
653
677
  for r_pair in rr_list:
654
678
  res1, res2 = r_pair[0:2]
655
679
 
656
- if (res1 in r_list or res2 in r_list) and\
657
- not is_wat(res1) and not is_wat(res2):
680
+ if (res1 in r_list or res2 in r_list):
681
+ if not use_wat:
682
+ if is_wat(res1) or is_wat(res2):
683
+ continue
658
684
  c_list = check_rr_clashes(
659
685
  res1,
660
686
  res2,
@@ -699,7 +725,6 @@ def check_rr_clashes(
699
725
  clash_dist2[cls] = clash_dist[cls]**2
700
726
  ats_list1[cls] = set()
701
727
  ats_list2[cls] = set()
702
-
703
728
  for atm in res1.get_atoms():
704
729
  for cls in atom_lists:
705
730
  if is_at_in_list(atm, atom_lists[cls], res1.get_resname()):
@@ -725,7 +750,7 @@ def check_rr_clashes(
725
750
  if at1.id == 'CA' and is_hetatm(res1) or\
726
751
  at2.id == 'CA' and is_hetatm(res2):
727
752
  continue
728
- elif cls != 'severe':
753
+ elif cls in ['positive', 'negative', 'polar_acceptor', 'polar_donor']:
729
754
  # Both atoms should be of the same kind
730
755
  if at1.id not in ats_list1[cls] or \
731
756
  at2.id not in ats_list2[cls]:
@@ -82,6 +82,7 @@ class MMBPDBList(PDBList):
82
82
  # Where does the final PDB file get saved?
83
83
 
84
84
  url = f'{ALT_SERVERS[self.pdb_server.lower()]}/{code}.{file_format}'
85
+ print(f"Retrieving structure from {url}")
85
86
  if pdir is None:
86
87
  path = self.local_pdb if not obsolete else self.obsolete_pdb
87
88
  if not self.flat_tree: # Put in PDB-style directory tree
@@ -166,6 +167,7 @@ class MMBPDBList(PDBList):
166
167
 
167
168
  pdb_code = pdb_code.lower()
168
169
 
170
+
169
171
  assembly_num = int(assembly_num)
170
172
  archive = {
171
173
  "pdb": f"{pdb_code}.pdb{assembly_num}.gz",
@@ -66,7 +66,8 @@ class ParamInput():
66
66
  opt_type,
67
67
  min_val,
68
68
  max_val,
69
- multiple=False
69
+ multiple=False,
70
+ label_text=None
70
71
  ):
71
72
  """ Add a numeric option to dialog """
72
73
  self.options.append({
@@ -75,7 +76,8 @@ class ParamInput():
75
76
  'type':opt_type,
76
77
  'min':min_val,
77
78
  'max':max_val,
78
- 'multiple':multiple
79
+ 'multiple':multiple,
80
+ 'label_text': label_text
79
81
  })
80
82
 
81
83
  def add_option_free_text(self, label):
@@ -98,7 +100,7 @@ class ParamInput():
98
100
  opt_strs.append(','.join(opt['opt_list']))
99
101
  elif opt['type'] in ('int', 'float'):
100
102
  if opt['min'] != 0 or opt['max'] != 0:
101
- opt_strs.append(f"{opt['min']} - {opt['max']}")
103
+ opt_strs.append(f"{opt['label_text']} {opt['min']} - {opt['max']}")
102
104
  elif opt['type'] == 'input':
103
105
  opt_strs.append('Enter text')
104
106
  elif opt['type'] == 'pair_list':
@@ -376,7 +376,8 @@ class StructureChecking():
376
376
  nowarn=not self.args['build_warnings'],
377
377
  coords_only=self.args['coords_only'],
378
378
  overwrite=self.args['overwrite'],
379
- atom_limit=self.args['atom_limit']
379
+ atom_limit=self.args['atom_limit'],
380
+ no_network=self.args['no_network']
380
381
  )
381
382
 
382
383
  self.summary['loaded_structure'] = input_structure_path
@@ -463,7 +464,7 @@ class StructureChecking():
463
464
 
464
465
  return output_structure_path
465
466
 
466
- def check_report_clashes(self, residue_list=None, contact_types=None):
467
+ def check_report_clashes(self, residue_list=None, contact_types=None, use_wat=False):
467
468
  """ StructureChecking.check_report_clashes
468
469
  Check and reports clashes
469
470
 
@@ -475,9 +476,10 @@ class StructureChecking():
475
476
  contact_types = mu.ALL_CONTACT_TYPES
476
477
  if not residue_list:
477
478
  residue_list = self.strucm.st_data.all_residues
479
+ print(use_wat)
478
480
  return self._clash_report(
479
481
  contact_types,
480
- self.strucm.check_r_list_clashes(residue_list, contact_types)
482
+ self.strucm.check_r_list_clashes(residue_list, contact_types, use_wat=use_wat)
481
483
  )
482
484
 
483
485
  def _clash_report(self, contact_types, clash_list):
@@ -608,11 +610,13 @@ class StructureChecking():
608
610
 
609
611
  def water(self, opts=None):
610
612
  """ StructureChecking.water
611
- Detect/Select Remove Water molecules. Check only with no options. Options accepted as command-line string, or python dictionary.
613
+ Detect/Select Remove Water molecules. Check only with no options.
614
+ Options accepted as command-line string, or python dictionary.
612
615
 
613
616
  Args:
614
617
  opts (str | dict - Options dictionary):
615
618
  * remove: Yes - Remove All Water molecules
619
+ * keep_min_contacts: (int) Keep water molecules with at least indicated number of contacts with other residues
616
620
  """
617
621
  self._run_method('water', opts)
618
622
 
@@ -66,7 +66,8 @@ class StructureManager:
66
66
  nowarn: bool = True,
67
67
  coords_only: bool = False,
68
68
  overwrite: bool = False,
69
- atom_limit: int = 0
69
+ atom_limit: int = 0,
70
+ no_network: bool = False
70
71
  ) -> None:
71
72
  """
72
73
  Class constructor. Sets an empty object and loads a structure
@@ -84,6 +85,7 @@ class StructureManager:
84
85
  **file_format** (str): structure file format to use
85
86
  **fasta_sequence_path** (str): path to canonical sequence file (needed for PDB input)
86
87
  **nowarn** (bool): No warnings on Structure Building
88
+ **no_network** (bool): Do not use network to fetch data
87
89
 
88
90
  """
89
91
  self.data_library = DataLibManager(data_library_path)
@@ -97,7 +99,7 @@ class StructureManager:
97
99
  self.sequence_data = SequenceData()
98
100
 
99
101
  if fasta_sequence_path:
100
- self.sequence_data.load_sequence_from_fasta(fasta_sequence_path)
102
+ self.sequence_data.load_sequence_from_fasta(fasta_sequence_path, no_network=no_network)
101
103
 
102
104
  self.st, headers, input_format, biounit = self._load_structure_file(
103
105
  input_pdb_path,
@@ -108,21 +110,22 @@ class StructureManager:
108
110
  file_format,
109
111
  QUIET=nowarn,
110
112
  coords_only=coords_only,
111
- overwrite=overwrite
113
+ overwrite=overwrite,
114
+ atom_limit=atom_limit,
115
+ no_network=no_network
112
116
  )
113
- # Check limit of atoms now to avoid delays
114
- num_ats = len(list(self.st.get_atoms()))
115
- if atom_limit and num_ats > atom_limit:
117
+
118
+ if self.st == 'atom_limit_error':
116
119
  sys.exit(
117
120
  cts.MSGS['ATOM_LIMIT'].format(
118
- num_ats,
121
+ headers,
119
122
  atom_limit
120
123
  )
121
124
  )
122
125
 
123
126
  self.models_data = ModelsData(self.st)
124
127
  self.chains_data = ChainsData(self.st)
125
- self.st_data = StructureData(self.st, input_format, headers, biounit)
128
+ self.st_data = StructureData(self.st, input_format, headers, biounit, no_network=no_network)
126
129
  self.modified = False
127
130
 
128
131
  # Calc internal data
@@ -138,12 +141,16 @@ class StructureManager:
138
141
  file_format,
139
142
  QUIET=False,
140
143
  coords_only=False,
141
- overwrite=False
142
-
144
+ overwrite=False,
145
+ atom_limit=0,
146
+ no_network=False
143
147
  ):
144
148
  """ Load structure file """
145
149
  biounit = False
146
150
  self.pdb_id = 'User'
151
+ if no_network and (input_pdb_path.startswith(('pdb:', 'http'))):
152
+ print("Error: no network access to retrieve structure, but path requires it")
153
+ return None, None, None, None
147
154
  if input_pdb_path.startswith('pdb:'):
148
155
  input_pdb_path = input_pdb_path[4:]
149
156
  pdbl = MMBPDBList(pdb=cache_dir, server=pdb_server)
@@ -259,13 +266,20 @@ class StructureManager:
259
266
  else:
260
267
  pdb_file_handle = open(real_pdb_path, 'r')
261
268
 
269
+ if atom_limit > 0:
270
+ num_ats = sum(1 for _ in pdb_file_handle if _.startswith('ATOM') or _.startswith('HETATM'))
271
+ if num_ats > atom_limit:
272
+ pdb_file_handle.close()
273
+ return 'atom_limit_error', num_ats, None, None
274
+ pdb_file_handle.seek(0) # rewind file handle
275
+
262
276
  try:
263
277
  new_st = parser.get_structure(self.pdb_id, pdb_file_handle)
264
278
  except ValueError as err:
265
279
  raise ParseError('ValueError', err) from err
266
280
  except PDBConstructionException as err:
267
281
  raise ParseError('PDBBuildError', err) from err
268
- rewind = pdb_file_handle.seek(0)
282
+ pdb_file_handle.seek(0)
269
283
 
270
284
  if input_format in ['pdb', 'pqr']:
271
285
  headers = parse_pdb_header(pdb_file_handle)
@@ -277,7 +291,7 @@ class StructureManager:
277
291
  shutil.copy(real_pdb_path, copy_dir)
278
292
  print(
279
293
  f"Storing a copy of the input structure as "
280
- f"{opj(copy_dir, os.path.basename(real_pdb_path))}"
294
+ f"{copy_dir, os.path.basename(real_pdb_path)}"
281
295
  )
282
296
  except Exception:
283
297
  print(
@@ -455,9 +469,11 @@ class StructureManager:
455
469
  self,
456
470
  residue_list: Iterable[Residue],
457
471
  contact_types: Iterable[str],
458
- get_all_contacts=False
472
+ get_all_contacts=False,
473
+ use_wat=False
459
474
  ) -> Dict[str, Dict[str, Tuple[Residue, Residue, float]]]:
460
475
  """ Checks clashes originated by a list of residues"""
476
+
461
477
  return mu.check_r_list_clashes(
462
478
  residue_list,
463
479
  self.rr_dist,
@@ -465,6 +481,7 @@ class StructureManager:
465
481
  self.data_library.get_atom_lists(contact_types),
466
482
  not self.models_data.has_superimp_models(),
467
483
  severe='severe' in contact_types,
484
+ use_wat=use_wat,
468
485
  get_all_contacts=get_all_contacts
469
486
  )
470
487
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biobb_structure_checking
3
- Version: 3.15.6
3
+ Version: 3.16.2
4
4
  Summary: BioBB_structure_checking performs MDWeb structure checking tool set as a command line utility.
5
5
  Home-page: https://github.com/bioexcel/biobb_structure_checking
6
6
  Author: Biobb developers
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3
13
13
  Classifier: License :: OSI Approved :: Apache Software License
14
14
  Classifier: Operating System :: MacOS :: MacOS X
15
15
  Classifier: Operating System :: POSIX
16
- Requires-Python: >=3.8
16
+ Requires-Python: >=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: psutil
@@ -33,6 +33,19 @@ Dynamic: requires-python
33
33
  Dynamic: summary
34
34
 
35
35
  # biobb_structure_checking
36
+ [![](https://img.shields.io/github/v/tag/bioexcel/biobb_structure_checking?label=Version)](https://GitHub.com/bioexcel/biobb_sructure_checking/tags/)
37
+ [![](https://img.shields.io/pypi/v/biobb-structure-checking.svg?label=Pypi)](https://pypi.org/project/biobb-structure-checking/)
38
+ [![](https://img.shields.io/conda/vn/bioconda/biobb_structure_checking?label=Conda)](https://anaconda.org/bioconda/biobb_structure_checking)
39
+ [![](https://img.shields.io/conda/dn/bioconda/biobb_structure_checking?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_structure_checking)
40
+ [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_structure_checking?tab=tags)
41
+
42
+ [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
43
+ [![](https://img.shields.io/badge/Open%20Source%3f-Yes!-blue)](https://github.com/bioexcel/biobb_structure_checking)
44
+
45
+ [![](https://readthedocs.org/projects/biobb-structure-checking/badge/?version=latest&label=Docs)](https://biobb-structure-checking.readthedocs.io/en/latest/?badge=latest)
46
+
47
+ [![](https://img.shields.io/github/last-commit/bioexcel/biobb_structure_checking?label=Last%20Commit)](https://github.com/bioexcel/biobb_structure_checking/commits/master)
48
+
36
49
  ### Introduction
37
50
  Biobb_structure_checking provides a series of functions to check the quality of a 3D structure intended to facilitate the setup of a molecular dynamics simulation of protein or nucleic acids systems.
38
51
 
@@ -44,7 +57,7 @@ The latest documentation of this package can be found in our readthedocs site:
44
57
  [latest package documentation](http://biobb_structure_checking.readthedocs.io/en/latest/).
45
58
 
46
59
  ### Version
47
- v3.15.6 March 2025
60
+ v3.16.2 Feb 2026
48
61
 
49
62
  ### Requirements
50
63
 
@@ -61,7 +74,7 @@ Using PIP:
61
74
 
62
75
  * Installation:
63
76
 
64
- pip install "biobb_structure_checking>=3.15.0"
77
+ pip install "biobb_structure_checking>=3.16.0"
65
78
 
66
79
  * Usage: [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html).
67
80
 
@@ -69,7 +82,7 @@ Using ANACONDA:
69
82
 
70
83
  * Installation:
71
84
 
72
- conda install -c bioconda "biobb_structure_checking>=3.15.0"
85
+ conda install -c bioconda "biobb_structure_checking>=3.16.0"
73
86
 
74
87
  * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb_structure_checking.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb_structure_checking.readthedocs.io/en/latest/command_line.html)
75
88
 
@@ -8,7 +8,7 @@ with open("README.md", "r") as fh:
8
8
 
9
9
  setuptools.setup(
10
10
  name="biobb_structure_checking",
11
- version="3.15.6",
11
+ version="3.16.2",
12
12
 
13
13
  author="Biobb developers",
14
14
  author_email="gelpi@ub.edu",
@@ -25,7 +25,7 @@ setuptools.setup(
25
25
  package_data={'biobb_structure_checking': ['py.typed']},
26
26
  include_package_data=True,
27
27
  install_requires=['psutil', 'numpy', 'biopython>=1.79'],
28
- python_requires='>=3.8',
28
+ python_requires='>=3.9',
29
29
  extras_require={},
30
30
  entry_points={
31
31
  "console_scripts": [
@@ -1,51 +0,0 @@
1
- """ Module supporting models command"""
2
- import biobb_structure_checking.constants as cts
3
- import biobb_structure_checking.modelling.utils as mu
4
- from biobb_structure_checking.pdbio.param_input import ParamInput
5
-
6
-
7
- def check(strcheck):
8
- wat_list = [
9
- res
10
- for res in mu.get_ligands(strcheck.strucm.st, incl_water=True)
11
- if mu.is_wat(res)
12
- ]
13
-
14
- if not wat_list:
15
- if not strcheck.args['quiet']:
16
- print(cts.MSGS['NO_WATERS'])
17
- return {}
18
-
19
- print(cts.MSGS['WATERS_FOUND'].format(len(wat_list)))
20
- strcheck.summary['water']['n_detected'] = len(wat_list)
21
-
22
- return {'wat_list': wat_list}
23
-
24
-
25
- def fix(strcheck, opts, fix_data=None):
26
- if isinstance(opts, str):
27
- remove_wat = opts
28
- else:
29
- remove_wat = opts['remove']
30
-
31
- input_line = ParamInput(
32
- 'Remove',
33
- strcheck.args['non_interactive'],
34
- set_none='no'
35
- )
36
- input_line.add_option_yes_no()
37
- input_line.set_default('yes')
38
- input_option, remove_wat = input_line.run(remove_wat)
39
-
40
- if input_option == 'error':
41
- return cts.MSGS['UNKNOWN_SELECTION'], remove_wat
42
-
43
- if input_option == 'yes':
44
- rmw_num = 0
45
- for res in fix_data['wat_list']:
46
- strcheck.strucm.remove_residue(res, False)
47
- rmw_num += 1
48
- strcheck.strucm.update_internals()
49
- print(cts.MSGS['WATER_REMOVED'].format(rmw_num))
50
- strcheck.summary['water']['n_removed'] = rmw_num
51
- return False