Skip to content

Reading then writing water #52

@bienchen

Description

@bienchen

Hello,

for MA (Deriva) I'm trying to read in a mmCIF file with python-modelcif and then write it out with python-modelcif again. If water is involved, that fails bc the water is not wrapped in a WaterAsymUnit... maybe just adding ihm.reader._NonPolySchemeHandler to the modelcif.reader. Here is an example of the issue:

import modelcif.dumper
from io import StringIO
import modelcif.reader

cif_data = StringIO("""
data_JUSTWATR
#
_entity.id                       3
_entity.type                     water
_entity.pdbx_description         water
_entity.formula_weight           18.015
_entity.pdbx_number_of_molecules 1
# 
_pdbx_nonpoly_scheme.asym_id E
_pdbx_nonpoly_scheme.entity_id 3
_pdbx_nonpoly_scheme.mon_id HOH
_pdbx_nonpoly_scheme.ndb_seq_num 1
#
loop_
_chem_comp.id
_chem_comp.type 
_chem_comp.name 
_chem_comp.formula 
_chem_comp.formula_weight
HOH non-polymer WATER "H2 O" 18.015  
# 
loop_
_struct_asym.id 
_struct_asym.pdbx_blank_PDB_chainid_flag 
_struct_asym.pdbx_modified 
_struct_asym.entity_id 
_struct_asym.details 
E N N 3 ?
#  
loop_
_pdbx_entity_nonpoly.entity_id 
_pdbx_entity_nonpoly.name 
_pdbx_entity_nonpoly.comp_id 
3 water                              HOH 
# 
loop_
_atom_site.group_PDB 
_atom_site.id 
_atom_site.type_symbol 
_atom_site.label_atom_id 
_atom_site.label_alt_id 
_atom_site.label_comp_id 
_atom_site.label_asym_id 
_atom_site.label_entity_id 
_atom_site.label_seq_id 
_atom_site.pdbx_PDB_ins_code 
_atom_site.Cartn_x 
_atom_site.Cartn_y 
_atom_site.Cartn_z 
_atom_site.occupancy 
_atom_site.B_iso_or_equiv 
_atom_site.pdbx_formal_charge 
_atom_site.auth_seq_id 
_atom_site.auth_comp_id 
_atom_site.auth_asym_id 
_atom_site.auth_atom_id 
_atom_site.pdbx_PDB_model_num 
HETATM 3439 O O   . HOH E 3 .   ? 23.218  41.004  22.097 1.00 55.72  ? 401 HOH A O   1  
# 
""")

out = StringIO()
modelcif.dumper.write(out, modelcif.reader.read(cif_data))

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions