pidibble 1.1.2__tar.gz → 1.1.4__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.
- {pidibble-1.1.2 → pidibble-1.1.4}/.readthedocs.yaml +3 -3
- {pidibble-1.1.2 → pidibble-1.1.4}/PKG-INFO +5 -1
- {pidibble-1.1.2 → pidibble-1.1.4}/README.md +4 -0
- pidibble-1.1.4/docs/requirements.txt +8 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/conf.py +2 -2
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/index.rst +4 -3
- pidibble-1.1.4/pidibble/hex.py +7 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/pdbparse.py +34 -2
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/resources/pdb_format.yaml +5 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pyproject.toml +1 -1
- pidibble-1.1.4/tests/unit/test_hex/my_system.pdb +6 -0
- pidibble-1.1.4/tests/unit/test_hex.py +20 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb.py +0 -1
- {pidibble-1.1.2 → pidibble-1.1.4}/.gitignore +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/LICENSE +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/MANIFEST.in +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/Makefile +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/make.bat +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/api.rst +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/generated/pidibble.rst +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/notes.md +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/docs/source/usage.rst +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/__init__.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/baseparsers.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/baserecord.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/mmcif_parse.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/pdbrecord.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/resources/__init__.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/pidibble/resources/mmcif_format.yaml +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/__init__.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/conftest.py +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/4tvp.cif +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/4tvp.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/4zmj-newresnames.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/4zmj.cif +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/4zmj.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/6m0j.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/G.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/GG.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/test.pdb +0 -0
- {pidibble-1.1.2 → pidibble-1.1.4}/tests/unit/test_rcsb/test_pdb_format.yaml +0 -0
|
@@ -27,6 +27,6 @@ sphinx:
|
|
|
27
27
|
# Optional but recommended, declare the Python requirements required
|
|
28
28
|
# to build your documentation
|
|
29
29
|
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
python:
|
|
31
|
+
install:
|
|
32
|
+
- requirements: docs/requirements.txt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pidibble
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.4
|
|
4
4
|
Summary: A complete Protein Data Bank (PDB) file parser
|
|
5
5
|
Project-URL: Source, https://github.com/cameronabrams/pidibble
|
|
6
6
|
Project-URL: Documentation, https://pidibble.readthedocs.io/en/latest/
|
|
@@ -88,6 +88,10 @@ ATOM
|
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
## Release History
|
|
91
|
+
* 1.1.4
|
|
92
|
+
* Added ability to read hexadecimal atom indices for files with > 99999 atoms
|
|
93
|
+
* 1.1.3
|
|
94
|
+
* Added ability to group into models for multiple-model entries
|
|
91
95
|
* 1.1.2
|
|
92
96
|
* Added ability to retrieve pdbs from AlphaFold database
|
|
93
97
|
* 1.1.1
|
|
@@ -70,6 +70,10 @@ ATOM
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## Release History
|
|
73
|
+
* 1.1.4
|
|
74
|
+
* Added ability to read hexadecimal atom indices for files with > 99999 atoms
|
|
75
|
+
* 1.1.3
|
|
76
|
+
* Added ability to group into models for multiple-model entries
|
|
73
77
|
* 1.1.2
|
|
74
78
|
* Added ability to retrieve pdbs from AlphaFold database
|
|
75
79
|
* 1.1.1
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
# -- Project information
|
|
4
4
|
|
|
5
5
|
project = 'Pidibble'
|
|
6
|
-
copyright = '2023, Cameron F. Abrams'
|
|
6
|
+
copyright = '2023-2024, Cameron F. Abrams'
|
|
7
7
|
author = 'cfa22@drexel.edu'
|
|
8
8
|
|
|
9
9
|
release = '1.1'
|
|
10
|
-
version = '1.1.
|
|
10
|
+
version = '1.1.4'
|
|
11
11
|
|
|
12
12
|
# -- General configuration
|
|
13
13
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Welcome to Pidibble's documentation!
|
|
2
2
|
====================================
|
|
3
3
|
|
|
4
|
-
**Pidibble** is a Python package for parsing
|
|
4
|
+
**Pidibble** is a Python package for parsing Protein Data Bank (PDB) files. It conforms to the `most recent standard <https://www.wwpdb.org/documentation/file-format-content/format33/v3.3.html>`_ (v.3.3 Atomic Coordinate Entry Format, ca. 2011).
|
|
5
5
|
|
|
6
6
|
Unlike parsers like that found in packages like `BioPython <https://biopython.org/wiki/PDBParser>`_, ``pidibble`` provides meaningfully parsed objects from *all* standard PDB record types, not just ATOMs and CONECTs.
|
|
7
7
|
|
|
@@ -9,8 +9,9 @@ Once installed, the user has access to the ``PDBParser`` class in the ``pidibble
|
|
|
9
9
|
|
|
10
10
|
Pidibble can fetch coordinate files from the RSCB PDB and from the AlphaFold model database.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Pidibble can handle hexadecimal serial numbers in all record types.
|
|
13
|
+
|
|
14
|
+
Check out the :doc:`usage` section for further information, including on :ref:`installation` of the package.
|
|
14
15
|
|
|
15
16
|
.. note::
|
|
16
17
|
|
|
@@ -21,11 +21,13 @@ from pidibble import resources
|
|
|
21
21
|
logger=logging.getLogger(__name__)
|
|
22
22
|
import importlib.metadata
|
|
23
23
|
import json
|
|
24
|
+
from .hex import int_or_hex
|
|
24
25
|
|
|
25
26
|
__version__ = importlib.metadata.version("pidibble")
|
|
26
27
|
|
|
27
28
|
class PDBParser:
|
|
28
|
-
mappers={'Integer':int,'String':str,'Float':float}
|
|
29
|
+
# mappers={'Integer':int,'String':str,'Float':float}
|
|
30
|
+
mappers={'Integer':int_or_hex,'String':str,'Float':float}
|
|
29
31
|
mappers.update(ListParsers)
|
|
30
32
|
comment_lines=[]
|
|
31
33
|
comment_chars=['#']
|
|
@@ -144,6 +146,7 @@ class PDBParser:
|
|
|
144
146
|
record_formats=self.pdb_format_dict['record_formats']
|
|
145
147
|
key=''
|
|
146
148
|
record_format={}
|
|
149
|
+
group_open_record=None
|
|
147
150
|
for i,pdbrecord_line in enumerate(self.pdb_lines):
|
|
148
151
|
tc=pdbrecord_line[0]
|
|
149
152
|
if tc in PDBParser.comment_chars:
|
|
@@ -167,6 +170,18 @@ class PDBParser:
|
|
|
167
170
|
elif record_type in [3,4,5]:
|
|
168
171
|
if not key in self.parsed:
|
|
169
172
|
# this is necessarily the first occurance of a record with this key, but since there can be multiple instances this must be a list of records
|
|
173
|
+
if 'groupuntil' in record_format:
|
|
174
|
+
group_open_record=new_record
|
|
175
|
+
logger.debug(f'opening group {group_open_record.serial} until {group_open_record.format["groupuntil"]}')
|
|
176
|
+
if group_open_record!=None and key==group_open_record.format['groupuntil']:
|
|
177
|
+
logger.debug(f'closing group {group_open_record.serial}')
|
|
178
|
+
group_open_record=None
|
|
179
|
+
if 'groupby' in record_format:
|
|
180
|
+
tok=new_record.format['groupby'].split('.')
|
|
181
|
+
if group_open_record!=None:
|
|
182
|
+
if tok[0]==group_open_record.key:
|
|
183
|
+
groupid=getattr(group_open_record,tok[1])
|
|
184
|
+
setattr(new_record,group_open_record.key.lower(),groupid)
|
|
170
185
|
self.parsed[key]=[new_record]
|
|
171
186
|
else:
|
|
172
187
|
# this is either
|
|
@@ -189,15 +204,32 @@ class PDBParser:
|
|
|
189
204
|
root_record.continue_record(new_record,record_format)
|
|
190
205
|
else:
|
|
191
206
|
# case (b)
|
|
207
|
+
if 'groupuntil' in record_format:
|
|
208
|
+
group_open_record=new_record
|
|
209
|
+
logger.debug(f'opening group {group_open_record.serial} until {group_open_record.format["groupuntil"]}')
|
|
210
|
+
if group_open_record!=None and key==group_open_record.format['groupuntil']:
|
|
211
|
+
logger.debug(f'closing group {group_open_record.serial}')
|
|
212
|
+
group_open_record=None
|
|
213
|
+
if 'groupby' in record_format:
|
|
214
|
+
tok=new_record.format['groupby'].split('.')
|
|
215
|
+
if group_open_record!=None:
|
|
216
|
+
if tok[0]==group_open_record.key:
|
|
217
|
+
groupid=getattr(group_open_record,tok[1])
|
|
218
|
+
setattr(new_record,group_open_record.key.lower(),groupid)
|
|
192
219
|
self.parsed[key].append(new_record)
|
|
193
220
|
|
|
194
|
-
|
|
195
221
|
def post_process(self):
|
|
196
222
|
if self.input_format!='mmCIF':
|
|
197
223
|
self.parse_embedded_records()
|
|
198
224
|
self.parse_tokens()
|
|
199
225
|
self.parse_tables()
|
|
200
226
|
|
|
227
|
+
# def parse_models(self):
|
|
228
|
+
# n_models=self.parsed.get('NUMMDL',1)
|
|
229
|
+
# for i in range(n_models):
|
|
230
|
+
# self.parsed['MODEL'][i+1]={}
|
|
231
|
+
# # in progress
|
|
232
|
+
|
|
201
233
|
def parse_embedded_records(self):
|
|
202
234
|
new_parsed_records={}
|
|
203
235
|
for key,p in self.parsed.items():
|
|
@@ -303,6 +303,7 @@ record_formats:
|
|
|
303
303
|
- sidCodes
|
|
304
304
|
ANISOU:
|
|
305
305
|
type: 3
|
|
306
|
+
groupby: MODEL.serial
|
|
306
307
|
fields:
|
|
307
308
|
serial: [Integer,[7,11]]
|
|
308
309
|
name: [String,[13,16]]
|
|
@@ -318,6 +319,7 @@ record_formats:
|
|
|
318
319
|
charge: [Float,[79,80]] # String?
|
|
319
320
|
ATOM:
|
|
320
321
|
type: 3
|
|
322
|
+
groupby: MODEL.serial
|
|
321
323
|
fields:
|
|
322
324
|
serial: [Integer,[7,11]]
|
|
323
325
|
name: [String,[13,16]]
|
|
@@ -332,6 +334,7 @@ record_formats:
|
|
|
332
334
|
charge: [Float,[79,80]] # String?
|
|
333
335
|
HETATM:
|
|
334
336
|
type: 3
|
|
337
|
+
groupby: MODEL.serial
|
|
335
338
|
fields:
|
|
336
339
|
serial: [Integer,[7,11]]
|
|
337
340
|
name: [String,[13,16]]
|
|
@@ -593,9 +596,11 @@ record_formats:
|
|
|
593
596
|
type: 5
|
|
594
597
|
MODEL:
|
|
595
598
|
type: 5
|
|
599
|
+
groupuntil: ENDMDL
|
|
596
600
|
fields:
|
|
597
601
|
serial: [Integer,[11,14]]
|
|
598
602
|
TER:
|
|
603
|
+
groupby: MODEL.serial
|
|
599
604
|
type: 5
|
|
600
605
|
fields:
|
|
601
606
|
serial: [Integer,[7,11]]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ATOM 10000 H1 TIP3U 603 61.189 74.991 53.726 0.00 0.00 U81
|
|
2
|
+
ATOM 99999 H2 TIP3U 603 60.935 75.727 52.428 0.00 0.00 U81
|
|
3
|
+
ATOM 6b973 OH2 TIP3U 604 67.398 7.302 34.043 0.00 0.00 U81
|
|
4
|
+
ATOM 6b974 H1 TIP3U 604 68.253 6.886 34.152 0.00 0.00 U81
|
|
5
|
+
ATOM 6b975 H2 TIP3U 604 67.326 7.902 34.786 0.00 0.00 U81
|
|
6
|
+
ATOM 6b976 OH2 TIP3U 605 74.371 -45.062 -65.565 0.00 0.00 U81
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from pidibble.pdbparse import PDBParser, PDBRecord, get_symm_ops
|
|
3
|
+
from pidibble.hex import int_or_hex
|
|
4
|
+
import unittest
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
def test_hex():
|
|
8
|
+
a=int_or_hex('186a0')
|
|
9
|
+
assert a==100000
|
|
10
|
+
|
|
11
|
+
def test_hex_in_pdb():
|
|
12
|
+
p=PDBParser(PDBcode='my_system').parse()
|
|
13
|
+
atoms=p.parsed['ATOM']
|
|
14
|
+
assert len(atoms)==6
|
|
15
|
+
a1=atoms[0]
|
|
16
|
+
assert a1.serial==10000
|
|
17
|
+
a1=atoms[1]
|
|
18
|
+
assert a1.serial==99999
|
|
19
|
+
a1=atoms[2]
|
|
20
|
+
assert a1.serial==440691
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|