{"id":24062,"library":"modelcif","title":"ModelCIF","description":"A Python package for handling ModelCIF mmCIF and BinaryCIF files, used for representing comparative protein structure models and their metadata. It builds on the ihm library and supports reading/writing ModelCIF dictionaries, including references, alignments, quality metrics, and protocol steps. Current version is 1.7, with a release cadence of approximately every 6 months. Requires Python >=3.6.","status":"active","version":"1.7","language":"python","source_language":"en","source_url":"https://github.com/ihmwg/python-modelcif","tags":["mmCIF","BinaryCIF","structural biology","protein modeling","ModelCIF"],"install":[{"cmd":"pip install modelcif","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for mmCIF handling; modelcif extends ihm classes.","package":"ihm","optional":false}],"imports":[{"note":"System is in top-level __init__.py, not a separate module.","wrong":"from modelcif.system import System","symbol":"System","correct":"from modelcif import System"},{"note":"Model class is in modelcif.model module.","wrong":"from modelcif import Model","symbol":"Model","correct":"from modelcif.model import Model"},{"note":"TargetReference is in the reference submodule.","wrong":"from modelcif import TargetReference","symbol":"TargetReference","correct":"from modelcif.reference import TargetReference"}],"quickstart":{"code":"import modelcif\nimport modelcif.reader\nimport modelcif.model\nimport tempfile, os\n\n# create a simple system\nsys = modelcif.System(\"Example model\")\n# add a model\nmodel = modelcif.model.Model(sys, \"model_1\")\n# write to a temporary file\nwith tempfile.NamedTemporaryFile(suffix='.cif', delete=False) as f:\n    fname = f.name\n    sys.write(fname)\n# read back\nsys2 = modelcif.reader.read(fname)\nprint(len(sys2.models))\nos.unlink(fname)","lang":"python","description":"Create a minimal ModelCIF system with one model, write it to a mmCIF file, and read it back."},"warnings":[{"fix":"Use the new Sequence-based API; provide full database sequence and differences via insertion/deletion classes.","message":"The 'align_begin' and 'align_end' arguments to TargetReference are deprecated since version 1.0.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Upgrade to modelcif >=1.5 or manually populate the scheme tables.","message":"Writing files with waters requires the pdbx_poly_seq_scheme and pdbx_nonpoly_scheme tables; these are handled automatically since version 1.5, but older versions may lose water info.","severity":"gotcha","affected_versions":"<1.5"},{"fix":"Upgrade to modelcif >=1.5 or ensure '_ma_target_ref_db_details' is present in input files.","message":"The 'is_primary' attribute of TargetReference may not be correctly set when reading files that contain '_struct_ref' but no '_ma_target_ref_db_details' table prior to version 1.5.","severity":"gotcha","affected_versions":"<1.5"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from modelcif import System'.","cause":"Attempting to import from a submodule that does not exist or wrong casing.","error":"ImportError: cannot import name 'System' from 'modelcif'"},{"fix":"Ensure you have modelcif >=0.7 and use sys.write(filename).","cause":"Using an older version of modelcif where write is not a method of System; it may be accessed via a different API.","error":"AttributeError: 'System' object has no attribute 'write'"},{"fix":"Remove align_begin and align_end; use the new reference sequence API.","cause":"Deprecated argument used with TargetReference in modelcif >=1.0.","error":"TypeError: __init__() got an unexpected keyword argument 'align_begin'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}