Skip to content

Commit a93b3f5

Browse files
authored
Merge pull request #82 from rasbt/allow-ent
allow .ent & .ent.gz file extensions
2 parents 3b09e64 + 03a2437 commit a93b3f5

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

biopandas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
2525
#
2626

27-
__version__ = '0.2.8'
27+
__version__ = '0.2.9dev'
2828
__author__ = "Sebastian Raschka <[email protected]>"

biopandas/pdb/pandas_pdb.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,16 @@ def _init_get_dict():
263263
def _read_pdb(path):
264264
"""Read PDB file from local drive."""
265265
r_mode = 'r'
266-
if path.endswith('.pdb'):
266+
if path.endswith(('.pdb', '.ent')):
267267
openf = open
268-
elif path.endswith('pdb.gz'):
268+
elif path.endswith(('pdb.gz', '.ent.gz')):
269269
r_mode = 'rb'
270270
openf = gzip.open
271271
else:
272+
allowed_formats = ", ".join(('.pdb', '.pdb.gz', '.ent', '.ent.gz'))
272273
raise ValueError(
273-
'Wrong file format; allowed file formats are .pdb and .pdb.gz.'
274+
('Wrong file format; allowed file formats are %s'
275+
% allowed_formats)
274276
)
275277

276278
with openf(path, r_mode) as f:

biopandas/pdb/tests/test_read_pdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def test__read_pdb_raises():
6161
"""Test private _read_pdb:
6262
Test if ValueError is raised for wrong file formats."""
6363

64-
expect = ('Wrong file format; allowed file formats'
65-
' are .pdb and .pdb.gz.')
64+
expect = ('Wrong file format; allowed file formats are '
65+
'.pdb, .pdb.gz, .ent, .ent.gz')
6666

6767
def run_code_1():
6868
PandasPdb()._read_pdb("protein.mol2")

docs/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ The CHANGELOG for the current development version is available at
44
[https://github.com/rasbt/biopandas/blob/main/docs/sources/CHANGELOG.md](https://github.com/rasbt/biopandas/blob/main/docs/sources/CHANGELOG.md).
55

66

7+
### 0.2.9 (TBD)
8+
9+
##### Downloads
10+
11+
- -
12+
- -
13+
14+
##### New Features
15+
16+
- -
17+
18+
##### Changes
19+
20+
- Now also allow `.ent` and `.ent.gz` file endings for PDB files. (via PR [82](https://github.com/rasbt/biopandas/pull/82/files)
21+
22+
##### Bug Fixes
23+
24+
- -
25+
726
### 0.2.8 (03-30-2021)
827

928
##### Downloads

0 commit comments

Comments
 (0)