{"id":23877,"library":"ihm","title":"IHM (Integrative/Hybrid Modeling) Python Library","description":"A Python library for handling mmCIF and BinaryCIF files used in integrative/hybrid modeling, as defined by the wwPDB IHM extension. Version 2.10 is current. It supports reading, writing, and validating IHM mmCIF/BinaryCIF files, with features such as restraint representation, ensemble modeling, and reference sequence handling. The library is maintained by the IHM Working Group.","status":"active","version":"2.10","language":"python","source_language":"en","source_url":"https://github.com/ihmwg/python-ihm","tags":["integrative modeling","hybrid modeling","mmCIF","BinaryCIF","wwPDB","structural biology"],"install":[{"cmd":"pip install ihm","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for BinaryCIF encoding/decoding.","package":"msgpack","optional":true}],"imports":[{"note":"","wrong":"","symbol":"System","correct":"from ihm import System"},{"note":"","wrong":"","symbol":"Assembly","correct":"from ihm import Assembly"},{"note":"","wrong":"","symbol":"Model","correct":"from ihm.model import Model"},{"note":"","wrong":"","symbol":"Restraint","correct":"from ihm.restraint import Restraint"},{"note":"","wrong":"","symbol":"mmCIF writer","correct":"from ihm.format import CifWriter"}],"quickstart":{"code":"import ihm\nimport ihm.location\nimport ihm.model\nimport ihm.restraint\n\n# Create a minimal IHM system\nsystem = ihm.System()\n\n# Add a protein entity\nentity = ihm.Entity()\nentity.description = \"My protein\"\nentity.sequence = \"MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHG\"\nsystem.entities.append(entity)\n\n# Add an asym unit\nasym = ihm.AsymUnit(entity=entity, details=\"Chain A\")\nsystem.asym_units.append(asym)\n\n# Create an assembly\nassembly = ihm.Assembly()\nassembly.append(asym)\n\n# Write a mmCIF string\nfrom io import StringIO\nfrom ihm.format import CifWriter\nout = StringIO()\nwriter = CifWriter(out)\nwriter.write(system)\nprint(out.getvalue()[:500])","lang":"python","description":"Minimal example: create a system with one protein entity, an asym unit, and an assembly, then write a mmCIF file."},"warnings":[{"fix":"Use Python 3.6 or later.","message":"The 'ihm' library only supports Python 3.6+; Python 2 is not supported.","severity":"gotcha","affected_versions":">=2.0"},{"fix":"Update imports to use 'from ihm.format import CifWriter'.","message":"The 'ihm.format.CifWriter' class replaced the older writer pattern. Use 'from ihm.format import CifWriter' instead of deprecated 'ihm.io' or 'ihm.cif'.","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Run 'pip install msgpack' or 'pip install ihm[bcif]'.","message":"When using BinaryCIF, the msgpack package is required but not installed by default; install with 'pip install ihm[bcif]' or manually.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from ihm.reference import SeqDif'.","message":"In version 2.0, the 'SeqDif' class was moved from 'ihm.reference' to 'ihm.reference.SeqDif' – old imports may break.","severity":"breaking","affected_versions":">=2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install ihm'.","cause":"Library not installed.","error":"ModuleNotFoundError: No module named 'ihm'"},{"fix":"Run 'pip install msgpack' or 'pip install ihm[bcif]'.","cause":"msgpack not installed, required for BinaryCIF support.","error":"ModuleNotFoundError: No module named 'msgpack'"},{"fix":"Use 'from ihm.format import CifWriter'.","cause":"Incorrect import path; CifWriter is in ihm.format.","error":"AttributeError: module 'ihm' has no attribute 'CifWriter'"},{"fix":"Check sequence for non-standard characters; use 'X' or 'O' for non-standard as needed.","cause":"Entity sequence contains invalid characters (only standard amino acid codes allowed).","error":"ValueError: invalid character in entity sequence"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}