gemmi-protools 0.1.7__py3-none-any.whl → 0.1.8__py3-none-any.whl

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.

Potentially problematic release.


This version of gemmi-protools might be problematic. Click here for more details.

@@ -14,6 +14,7 @@ from typing import Union, Optional
14
14
 
15
15
  import pdbfixer
16
16
  from openmm import app
17
+ import openmm
17
18
  from typeguard import typechecked
18
19
 
19
20
  from gemmi_protools.io.cif_opts import _is_cif
@@ -21,7 +22,21 @@ from gemmi_protools.io.pdb_opts import _is_pdb
21
22
 
22
23
 
23
24
  @typechecked
24
- def _load_by_pbdfixer(path: Union[str, pathlib.Path]) -> pdbfixer.PDBFixer:
25
+ def _load_by_pbdfixer(path: Union[str, pathlib.Path], use_platform=True) -> pdbfixer.PDBFixer:
26
+ """
27
+
28
+ Args:
29
+ path:
30
+ use_platform: default True, if False, auto select platform
31
+
32
+ Returns:
33
+
34
+ """
35
+ if use_platform:
36
+ platform = openmm.Platform.getPlatformByName('CPU')
37
+ else:
38
+ platform = None
39
+
25
40
  cur_path = pathlib.Path(path)
26
41
  if _is_pdb(path) or _is_cif(path):
27
42
  s1 = cur_path.suffixes[-1]
@@ -29,15 +44,15 @@ def _load_by_pbdfixer(path: Union[str, pathlib.Path]) -> pdbfixer.PDBFixer:
29
44
 
30
45
  if s1 in [".pdb", ".cif"]:
31
46
  # s1 suffix
32
- fixer = pdbfixer.PDBFixer(filename=path)
47
+ fixer = pdbfixer.PDBFixer(filename=path, platform=platform)
33
48
  else:
34
49
  # s2 suffix
35
50
  with gzip.open(path, "rb") as gz_handle:
36
51
  with io.TextIOWrapper(gz_handle, encoding="utf-8") as text_io:
37
52
  if s2 == ".pdb.gz":
38
- fixer = pdbfixer.PDBFixer(pdbfile=text_io)
53
+ fixer = pdbfixer.PDBFixer(pdbfile=text_io, platform=platform)
39
54
  else:
40
- fixer = pdbfixer.PDBFixer(pdbxfile=text_io)
55
+ fixer = pdbfixer.PDBFixer(pdbxfile=text_io, platform=platform)
41
56
  else:
42
57
  raise ValueError("Only support .cif, .cif.gz, .pdb or .pdb.gz file, but got %s" % path)
43
58
  return fixer
@@ -53,6 +68,7 @@ def clean_structure(input_file: Union[str, pathlib.Path],
53
68
  ph: Union[float, int] = 7.0,
54
69
  check_mode: bool = True,
55
70
  threshold: float = 0.3,
71
+ use_platform=True
56
72
  ):
57
73
  """
58
74
 
@@ -73,6 +89,7 @@ def clean_structure(input_file: Union[str, pathlib.Path],
73
89
  :param ph: default 7.0, ph values to add missing hydrogen atoms
74
90
  :param check_mode: default True to check the ratio of residues with missing atoms
75
91
  :param threshold: float, default 0.3, only use when check_mode=True
92
+ :param use_platform: default True to use CPU platform, if False, auto select platform
76
93
 
77
94
  :return:
78
95
  str, status message of fixing
@@ -85,7 +102,7 @@ def clean_structure(input_file: Union[str, pathlib.Path],
85
102
  ######################################################
86
103
  # load structure
87
104
  ######################################################
88
- fixer = _load_by_pbdfixer(input_file)
105
+ fixer = _load_by_pbdfixer(input_file, use_platform=use_platform)
89
106
 
90
107
  ######################################################
91
108
  # check
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gemmi_protools
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: An Enhanced tool to process PDB structures based on Gemmi
5
5
  Author-email: Luo Jiejian <luojiejian12@mails.ucas.ac.cn>
6
6
  License-Expression: MIT
@@ -11,10 +11,10 @@ gemmi_protools/io/struct_info.py,sha256=9nBj1Zer03S8_Wks7L7uRlc9PlbfCKzoaT32pKR5
11
11
  gemmi_protools/utils/__init__.py,sha256=F6e1xNT_7lZAWQgNIneH06o2qtWYrHNr_xPUPTwwx5E,29
12
12
  gemmi_protools/utils/align.py,sha256=CZcrvjy-ZbX2u7OAn-YGblbxaj9YFUDX4CFZcpbpnB8,6959
13
13
  gemmi_protools/utils/dockq.py,sha256=XmMwVEy-H4p6sH_HPcDWA3TP77OWdih0fE_BQJDr4pU,4189
14
- gemmi_protools/utils/fixer.py,sha256=WUiIoK8dFPGUkXlK-wiiWyorYD8T71rN7WDE2psGSiE,9061
14
+ gemmi_protools/utils/fixer.py,sha256=oiNtLCjQLFk4JHeO4exEkMH8QoEiKsJZIJRebkGGfBM,9545
15
15
  gemmi_protools/utils/ppi.py,sha256=VWYsdxWwQoS1xwEYj5KB96Zz3F8r5Eyuw6NT3ReD-wc,2330
16
- gemmi_protools-0.1.7.dist-info/licenses/LICENSE,sha256=JuQvKcgj6n11y5y6nXr9rABv3gJSswc4eTCd5WZBtSY,1062
17
- gemmi_protools-0.1.7.dist-info/METADATA,sha256=tsp4fzE0T7lTsmPaRYK5UzgqS4OjrvOSfESFMqbkk0Y,567
18
- gemmi_protools-0.1.7.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
19
- gemmi_protools-0.1.7.dist-info/top_level.txt,sha256=P12mYJi5O5EKIn5u-RFaWxuix431CgLacSRD7rBid_U,15
20
- gemmi_protools-0.1.7.dist-info/RECORD,,
16
+ gemmi_protools-0.1.8.dist-info/licenses/LICENSE,sha256=JuQvKcgj6n11y5y6nXr9rABv3gJSswc4eTCd5WZBtSY,1062
17
+ gemmi_protools-0.1.8.dist-info/METADATA,sha256=j0xy5aqbEvdlqoNrEdCSiBpmLVOpe3URit-85PBWa1s,567
18
+ gemmi_protools-0.1.8.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
19
+ gemmi_protools-0.1.8.dist-info/top_level.txt,sha256=P12mYJi5O5EKIn5u-RFaWxuix431CgLacSRD7rBid_U,15
20
+ gemmi_protools-0.1.8.dist-info/RECORD,,