pidibble 1.5.0__tar.gz → 1.5.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.
- {pidibble-1.5.0 → pidibble-1.5.2}/PKG-INFO +3 -1
- {pidibble-1.5.0 → pidibble-1.5.2}/README.md +2 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/baseparsers.py +6 -3
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/pdbparse.py +25 -12
- {pidibble-1.5.0 → pidibble-1.5.2}/pyproject.toml +1 -1
- {pidibble-1.5.0 → pidibble-1.5.2}/.github/workflows/release.yaml +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/.gitignore +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/.readthedocs.yaml +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/LICENSE +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/MANIFEST.in +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/Makefile +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/make.bat +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/requirements.txt +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/_static/css/custom.css +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/API.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.baseparsers.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.baserecord.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.hex.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.mmcif_parse.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.pdbparse.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.pdbrecord.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.resources.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/api/pidibble.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/conf.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/index.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/installation.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/notes.md +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/docs/source/usage.rst +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/__init__.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/baserecord.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/hex.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/mmcif_parse.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/pdbrecord.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/resources/__init__.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/resources/mmcif_format.yaml +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/pidibble/resources/pdb_format.yaml +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/__init__.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/conftest.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_hex/my_system.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_hex.py +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/4tvp.cif +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/4tvp.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/4zmj-newresnames.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/4zmj.cif +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/4zmj.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/6m0j.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/8fae.cif +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/G.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/GG.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/test.pdb +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb/test_pdb_format.yaml +0 -0
- {pidibble-1.5.0 → pidibble-1.5.2}/tests/unit/test_rcsb.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pidibble
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.2
|
|
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/
|
|
@@ -91,6 +91,8 @@ ATOM
|
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
## Release History
|
|
94
|
+
* 1.5.2
|
|
95
|
+
* added capability to download from OPM and split out DUM resi's into a "dum" pdb
|
|
94
96
|
* 1.4.2
|
|
95
97
|
* updated alphafold interface
|
|
96
98
|
* 1.4.1
|
|
@@ -87,7 +87,7 @@ class StringParser:
|
|
|
87
87
|
self.fields={k:v for k,v in fmtdict.items()}
|
|
88
88
|
self.allowed=allowed
|
|
89
89
|
|
|
90
|
-
def parse(self,record):
|
|
90
|
+
def parse(self, record):
|
|
91
91
|
"""
|
|
92
92
|
Parse a fixed-width string record into a dictionary of fields.
|
|
93
93
|
|
|
@@ -104,7 +104,10 @@ class StringParser:
|
|
|
104
104
|
if len(record)>80:
|
|
105
105
|
logger.warning('The following record exceeds 80 bytes in length:')
|
|
106
106
|
self.report_record_error(record)
|
|
107
|
-
|
|
107
|
+
logger.warning('Stripping...')
|
|
108
|
+
record = record.strip()
|
|
109
|
+
if len(record)>80:
|
|
110
|
+
raise ValueError(f'Record is too long; something wrong with your PDB file?')
|
|
108
111
|
input_dict={}
|
|
109
112
|
record+=' '*(80-len(record)) # pad
|
|
110
113
|
for k,v in self.fields.items():
|
|
@@ -141,7 +144,7 @@ class StringParser:
|
|
|
141
144
|
"""
|
|
142
145
|
if byte_range:
|
|
143
146
|
record=record[:byte_range[0]-1]+'\033[91m'+record[byte_range[0]:byte_range[1]+1]+'\033[0m'+record[byte_range[1]+1:]
|
|
144
|
-
repstr=_cols+'\n'+record
|
|
147
|
+
repstr=_cols+'\n'+record+'|'
|
|
145
148
|
logger.warning(repstr)
|
|
146
149
|
|
|
147
150
|
def report_field_error(self,record,k):
|
|
@@ -120,7 +120,7 @@ class PDBParser:
|
|
|
120
120
|
bool
|
|
121
121
|
True if the file was successfully fetched, False otherwise.
|
|
122
122
|
"""
|
|
123
|
-
assert self.source_db is not None or self.filepath is not None, f'source_db or filepath must be specified for fetch()'
|
|
123
|
+
assert self.source_db is not None or self.filepath is not None, f'source_db {self.source_db} or filepath {self.filepath} must be specified for fetch()'
|
|
124
124
|
if self.source_db is not None and self.source_id is None:
|
|
125
125
|
raise ValueError(f'You must specify a source ID code for source_db {self.source_db}')
|
|
126
126
|
if self.source_db is not None and self.source_db not in ['rcsb', 'alphafold', 'opm']:
|
|
@@ -176,6 +176,19 @@ class PDBParser:
|
|
|
176
176
|
except:
|
|
177
177
|
logger.warning(f'Could not fetch {self.filepath.name} from {self.source_db}')
|
|
178
178
|
return False
|
|
179
|
+
logger.warning(f'Stripping blanks and END lines from OPM pdb')
|
|
180
|
+
badlines = self.filepath.read_text().split('\n')
|
|
181
|
+
with open(self.filepath.name, 'w') as f_base:
|
|
182
|
+
with open(f'{self.filepath.stem}-dum.pdb', 'w') as f_dum:
|
|
183
|
+
f = f_base
|
|
184
|
+
for line in badlines:
|
|
185
|
+
sline = line.strip()
|
|
186
|
+
if not sline.startswith('END') and len(sline) > 0:
|
|
187
|
+
f.write(sline+'\n')
|
|
188
|
+
if sline.startswith('END') and f is f_base:
|
|
189
|
+
f = f_dum
|
|
190
|
+
logger.debug(f'Generated {self.filepath.name} and {self.filepath.stem}-dum.pdb')
|
|
191
|
+
|
|
179
192
|
return True
|
|
180
193
|
case '_':
|
|
181
194
|
logger.debug(f'Source db {self.source_db} is not recognized.')
|
|
@@ -187,10 +200,10 @@ class PDBParser:
|
|
|
187
200
|
This method opens the PDB file, reads its contents, and splits it into lines.
|
|
188
201
|
If the last line is empty, it removes it from the list of lines.
|
|
189
202
|
"""
|
|
190
|
-
with open(self.filepath,'r') as f:
|
|
191
|
-
self.pdb_lines=f.read().split('\n')
|
|
192
|
-
if self.pdb_lines[-1]=='':
|
|
193
|
-
self.pdb_lines=self.pdb_lines[:-1]
|
|
203
|
+
with open(self.filepath, 'r') as f:
|
|
204
|
+
self.pdb_lines = f.read().split('\n')
|
|
205
|
+
if self.pdb_lines[-1] == '':
|
|
206
|
+
self.pdb_lines = self.pdb_lines[:-1]
|
|
194
207
|
|
|
195
208
|
def read_mmCIF(self):
|
|
196
209
|
"""
|
|
@@ -198,16 +211,16 @@ class PDBParser:
|
|
|
198
211
|
This method uses the :class:`mmcif.io.IoAdapterCore.IoAdapterCore` to read the
|
|
199
212
|
mmCIF file and store the data in :attr:`PDBParser.cif_data`.
|
|
200
213
|
"""
|
|
201
|
-
io=IoAdapterCore()
|
|
202
|
-
l_dc=io.readFile(self.filepath)
|
|
203
|
-
self.cif_data=l_dc[0]
|
|
214
|
+
io = IoAdapterCore()
|
|
215
|
+
l_dc = io.readFile(self.filepath)
|
|
216
|
+
self.cif_data = l_dc[0]
|
|
204
217
|
|
|
205
218
|
def read(self):
|
|
206
219
|
"""
|
|
207
220
|
Read the PDB or mmCIF file based on the input format.
|
|
208
221
|
This method checks the input format and calls the appropriate read method.
|
|
209
222
|
"""
|
|
210
|
-
if self.input_format=='mmCIF':
|
|
223
|
+
if self.input_format == 'mmCIF':
|
|
211
224
|
self.read_mmCIF()
|
|
212
225
|
else:
|
|
213
226
|
self.read_PDB()
|
|
@@ -219,7 +232,7 @@ class PDBParser:
|
|
|
219
232
|
If the input format is mmCIF, it uses the :class:`.mmcif_parse.MMCIF_Parser` to parse the mmCIF data.
|
|
220
233
|
If the input format is PDB, it uses the :class:`.pdbrecord.PDBRecord` class to parse the PDB lines.
|
|
221
234
|
"""
|
|
222
|
-
if self.input_format=='mmCIF':
|
|
235
|
+
if self.input_format == 'mmCIF':
|
|
223
236
|
self.parse_mmCIF()
|
|
224
237
|
else:
|
|
225
238
|
self.parse_PDB()
|
|
@@ -230,8 +243,8 @@ class PDBParser:
|
|
|
230
243
|
This method uses the :class:`.mmcif_parse.MMCIF_Parser` to parse the mmCIF data and store the parsed records
|
|
231
244
|
in :attr:`PDBParser.parsed`.
|
|
232
245
|
"""
|
|
233
|
-
mmcif_parser=MMCIF_Parser(self.mmcif_format_dict,self.pdb_format_dict['record_formats'],self.cif_data)
|
|
234
|
-
self.parsed=mmcif_parser.parse()
|
|
246
|
+
mmcif_parser = MMCIF_Parser(self.mmcif_format_dict,self.pdb_format_dict['record_formats'],self.cif_data)
|
|
247
|
+
self.parsed = mmcif_parser.parse()
|
|
235
248
|
|
|
236
249
|
def parse_PDB(self):
|
|
237
250
|
"""
|
|
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
|
|
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
|