Skip to content

ChainID is overwritten by segid #3144

@lilyminium

Description

@lilyminium

Expected behavior

I can round-trip chainID information from files.

Actual behavior

ChainIDs get overwritten by SegmentIDs, even though the latter is not actually in the original PDB specification. Because the default segment name is "system", this also means that the default chainID is "M" and that's kind of weird.

Code to reproduce the behavior

>>> import MDAnalysis as mda
>>> from MDAnalysis.tests.datafiles import PDB
>>> u = mda.Universe(PDB)
>>> u.atoms.chainIDs = "x"
>>> u.atoms.write("chain_x.pdb")
>>> u = mda.Universe("chain_x.pdb")
>>> u.atoms.chainIDs
array(['M', 'M', 'M', ..., 'M', 'M', 'M'], dtype=object)

And converting it to RDKit and using that to write it out ends up with weird spacing. :(

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") current develop
  • Which version of Python (python -V)?
  • Which operating system?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions