gemmi-protools 0.1.0__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.

@@ -0,0 +1,91 @@
1
+ """
2
+ @Author: Luo Jiejian
3
+ """
4
+ from dataclasses import dataclass, field
5
+ from datetime import datetime
6
+ from typing import Dict, Optional
7
+
8
+ import gemmi
9
+ from typeguard import typechecked
10
+
11
+
12
+ @typechecked
13
+ @dataclass
14
+ class Entity:
15
+ eid2desc: Dict[str, str] = field(default_factory=dict)
16
+ eid2specie: Dict[str, str] = field(default_factory=dict)
17
+ eid2taxid: Dict[str, str] = field(default_factory=dict)
18
+ polymer2eid: Dict[str, str] = field(default_factory=dict)
19
+
20
+ @typechecked
21
+ def __setattr__(self, name: str, value: Dict[str, str]):
22
+ super().__setattr__(name, value)
23
+
24
+ @typechecked
25
+ def update(self, inputs: Dict[str, Dict[str, str]]):
26
+ for key, value in inputs.items():
27
+ if hasattr(self, key):
28
+ self.__setattr__(key, value)
29
+
30
+ def get(self, name: str, default: Optional[str] = None):
31
+ if hasattr(self, name):
32
+ return self.__getitem__(name)
33
+ else:
34
+ return default
35
+
36
+ def __getitem__(self, name: str):
37
+ return getattr(self, name)
38
+
39
+ def keys(self):
40
+ return list(self.__dict__.keys())
41
+
42
+
43
+ @typechecked
44
+ @dataclass
45
+ class Info:
46
+ cell_Z: str = ""
47
+ pdb_id: str = ""
48
+ exp_method: str = ""
49
+ deposition_date: str = "1909-01-08"
50
+ title: str = ""
51
+ keywords: str = ""
52
+ keywords_text: str = ""
53
+
54
+ @property
55
+ def __attributes_mapper(self):
56
+ return {'cell_Z': '_cell.Z_PDB',
57
+ 'pdb_id': '_entry.id',
58
+ 'exp_method': '_exptl.method',
59
+ 'deposition_date': '_pdbx_database_status.recvd_initial_deposition_date',
60
+ 'title': '_struct.title',
61
+ 'keywords': '_struct_keywords.pdbx_keywords',
62
+ 'keywords_text': '_struct_keywords.text'}
63
+
64
+ def to_gemmi_structure_infomap(self) -> gemmi.InfoMap:
65
+ outputs = dict()
66
+ for name, target_name in self.__attributes_mapper.items():
67
+ value = self.__getattribute__(name)
68
+ if isinstance(value, str):
69
+ v = str(value)
70
+ if len(v) > 1:
71
+ outputs[target_name] = v
72
+ return gemmi.InfoMap(outputs)
73
+
74
+ @typechecked
75
+ def from_gemmi_structure_infomap(self, infomap: gemmi.InfoMap):
76
+ mapper_iv = {v: k for k, v in self.__attributes_mapper.items()}
77
+ for key, val in infomap.items():
78
+ if key in mapper_iv:
79
+ name = mapper_iv[key]
80
+ self.__setattr__(name, val)
81
+
82
+ @typechecked
83
+ def __setattr__(self, name: str, value: str):
84
+ if name == "deposition_date":
85
+ try:
86
+ datetime.strptime(value, "%Y-%m-%d")
87
+ except ValueError as e:
88
+ raise ValueError(f"{e}")
89
+
90
+ if hasattr(self, name):
91
+ super().__setattr__(name, value)
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: gemmi_protools
3
+ Version: 0.1.0
4
+ Summary: An Enhanced tool to process PDB structures based on Gemmi
5
+ Author-email: Luo Jiejian <luojiejian12@mails.ucas.ac.cn>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: gemmi>=0.7.0
11
+ Requires-Dist: pandas>=2.2.3
12
+ Requires-Dist: typeguard>=4.1.2
13
+ Requires-Dist: numpy
14
+ Requires-Dist: biopython>=1.84
15
+ Requires-Dist: scipy>=1.14.1
16
+ Requires-Dist: dockq
17
+ Dynamic: license-file
18
+
19
+ # An Enhanced tool to process PDB structures based on Gemmi
@@ -0,0 +1,16 @@
1
+ gemmi_protools/__init__.py,sha256=SvBS-OBVhYsoHCWw4Rwp-6p8vaFhJC9FQMlx0vYpITQ,237
2
+ gemmi_protools/align.py,sha256=LoN2xlZbvEwceQiz6F_VQBxlsNTKfGnJQ1LM937t1qw,6925
3
+ gemmi_protools/cif_opts.py,sha256=bfJuUQSYzz_703cIgxgvEVxXalfVYEZwpVjuYEB9O2U,6351
4
+ gemmi_protools/convert.py,sha256=780sQcwhslUD4Hj5UZMVlQdbicniJ6jNjncTl_7jaMk,3841
5
+ gemmi_protools/dockq.py,sha256=JGPQ7Xs7gz9wubVVT9WSP5lZsLnfgcUH-_nLJ3c8I3U,4172
6
+ gemmi_protools/parse_pdb_header.py,sha256=UOGMsE3-d3APhO7zaAEE0NT31n-iqt55VpDh_RPOicI,14223
7
+ gemmi_protools/parser.py,sha256=QIJCOfK8FaFbLMvBG82zTOAjIvQJcf2WRwuFSxj4zvc,8982
8
+ gemmi_protools/pdb_opts.py,sha256=NbXLDNNVF7tuG_bUM0Infylf5aYnOCP2Pd-ndqm5bK4,5652
9
+ gemmi_protools/ppi.py,sha256=nRzRWv28SDjVt6hMShRL_QYKFsBO1xA5jSGIQrN0JBg,2313
10
+ gemmi_protools/reader.py,sha256=0VjMxOogqB1dccucQU2I703W5Ro4JYBakE2eXftUTPU,13194
11
+ gemmi_protools/struct_info.py,sha256=9nBj1Zer03S8_Wks7L7uRlc9PlbfCKzoaT32pKR58X8,2769
12
+ gemmi_protools-0.1.0.dist-info/licenses/LICENSE,sha256=JuQvKcgj6n11y5y6nXr9rABv3gJSswc4eTCd5WZBtSY,1062
13
+ gemmi_protools-0.1.0.dist-info/METADATA,sha256=XFZBAmfQXoij0iJFUkox30Y-acNtssncQsbR9tX6lOs,567
14
+ gemmi_protools-0.1.0.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
15
+ gemmi_protools-0.1.0.dist-info/top_level.txt,sha256=P12mYJi5O5EKIn5u-RFaWxuix431CgLacSRD7rBid_U,15
16
+ gemmi_protools-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (77.0.3)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Roger
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 @@
1
+ gemmi_protools