Skip to content

Commit daa17ca

Browse files
Merge pull request #18 from PDBeurope/PDBE-6143
PDBE-6143: resolves missing _chem_comp.type issue reported in #17
2 parents 00c0db5 + e365656 commit daa17ca

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

arpeggio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.2'
1+
__version__ = '1.4.3'

arpeggio/core/config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,8 @@ class ComponentType(IntEnum):
11531153
N = 5 # Non-polymer
11541154
O = 6 # Other categories
11551155
B = 7 # Bound Molecule
1156-
W = 8 # Water
1156+
W = 8 # Water
1157+
M = 9 # Missing label_comp_type
11571158

11581159
@staticmethod
11591160
def from_chem_comp_type(type: str):

arpeggio/core/protein_reader.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,18 @@ def get_component_types(path):
422422
chem_comp = cif_block.get_mmcif_category('_chem_comp.')
423423
component_types = {}
424424
for i in range(len(chem_comp['id'])):
425-
cmp_type = config.ComponentType.from_chem_comp_type(chem_comp['type'][i])
426-
if not cmp_type == config.ComponentType(5).name:
427-
component_types[chem_comp['id'][i]] = cmp_type
428-
else:
429-
if chem_comp['name'][i].upper() == 'WATER':
430-
component_types[chem_comp['id'][i]] = config.ComponentType(8).name
425+
chem_comp_type = chem_comp['type'][i]
426+
if chem_comp_type:
427+
comp_type = config.ComponentType.from_chem_comp_type(chem_comp_type.upper())
428+
if not comp_type == config.ComponentType(5).name:
429+
component_types[chem_comp['id'][i]] = comp_type
431430
else:
432-
component_types[chem_comp['id'][i]] = config.ComponentType(7).name
431+
if chem_comp['name'][i].upper() == 'WATER':
432+
component_types[chem_comp['id'][i]] = config.ComponentType(8).name
433+
else:
434+
component_types[chem_comp['id'][i]] = config.ComponentType(7).name
435+
else:
436+
component_types[chem_comp['id'][i]] = config.ComponentType(9).name
433437

434438
return component_types
435439

0 commit comments

Comments
 (0)