-
Notifications
You must be signed in to change notification settings - Fork 724
Oliver Beckstein edited this page Jul 26, 2019
·
14 revisions
Frequently (or at least sometimes) asked questions about MDAnalysis.
Feel free to add to this file.
Based on user list: Add chain IDs to protein files.
For MDAnalysis 0.19.2:
Load the PDB file:
U = mda.Universe("protein.pdb")
Then create a new segment ('T' in this example) and assign the segment to the atoms of interest:
newseg = U.add_Segment(segid='T')
U.select_atoms('bynum 1201:2400').residues.segments = newseg
When you write out the atoms as a PDB file, MDAnalysis will set the ChainID to the segment identifier (or the first letter if you used more than one letter)
U.atoms.write("relabeled.pdb")