salilab / pmi

Python Modeling Interface
https://integrativemodeling.org/nightly/doc/ref/namespaceIMP_1_1pmi.html
11 stars 11 forks source link

Attempting to retain the same chain ids in the model as in pdb files supplied with a topology file, causes a seg-fault. #252

Closed tanmoy7989 closed 3 years ago

tanmoy7989 commented 3 years ago

add_state method of pmi.macros.BuildSystem macro has an arg keep_chain_id which when set to True should retain the same chain ids as used in the constituent pdb files supplied in the topology file. When False, the chain ids are just re-named in (uppercase) alphabetical order.

MWE:

Note: (in this example, there are no conflicts between the chain ids of input pdb files; i.e. there are no cases like chains A and B in pdb file 1, and chains B and D in pdb file 2.)

m = IMP.Model()
bs = IMP.pmi.macros.BuildSystem(m)
t = IMP.pmi.topology.TopologyReader(topology_file="topology.txt", pdb_dir=".", fasta_dir=".")
bs.add_state(t, keep_chain_id=True)

Output: segfault

Here are all necessary files to recreate this: mwe.zip

benmwebb commented 3 years ago

The issue here is that you've asked PMI to retain the PDB's chain ID, but there is no PDB present when you build BEADS, thus no chain ID. Looking at your topology file I'm guessing you want the BEADS for 1-155, 348-END to have the same chain ID as the PDB you provide for 156-347, but PMI doesn't know that. I'm generally reluctant to have software guess what you mean in cases like this - would rather just have it throw an error like "you can't use keep_chain_id with BEADS".

benmwebb commented 3 years ago

OK, I think I have a solution that should work sensibly in most cases. Give it a try and let me know if it doesn't work for you.