How to show two poses overlapped?
ajasja opened this issue · comments
I'd like to show to poses at the same time (i.e. before and after relax).
What would be the best way to do that?
I'm trying out a view.add_pose(pose, new_chain=False)
method in #4 . It currently uses the pyrosetta.rosetta.core.pose.append_pose_to_pose
method to append the new pose onto a cloned version of the pose that the current Decoys widget is viewing. The cloning is there just to not overwrite the pose(s) passed to viewer3d.init
in memory.
Also note that self.viewer.addModels(io.to_pdbstring(pose), "pdb")
didn't work for me because the existing pose and new pose might have the same residue and chain numbering, and so the ResidueSelector
s would not properly modify the visualization. The pyrosetta.rosetta.core.pose.append_pose_to_pose
method fixes this by renumbering (and optionally rechaining) the new pose.
@klimaj Can we introduce the concept of a model? We can keep several poses in the viewer and have them completely separate, basically just like Pymol is doing. Where you can have two models, both with chain A starting from 1. Renumbering would be really confusing, Imagine if you opened several models and pymol renumbered and rechained most of them behind the scene.
py3Dmol is model aware, here is an example:
!wget https://files.rcsb.org/download/1hh3.pdb1
!wget https://files.rcsb.org/download/1atp.pdb1
import py3Dmol
view = py3Dmol.view(width=500, height=500)
view.addModel(open('1hh3.pdb1', 'r').read(),'pdb')
view.addModel(open('1atp.pdb1', 'r').read(),'pdb')
view.setStyle({'model': 0}, {"cartoon": {'color': 'blue'}})
view.setStyle({'model': 1}, {"cartoon": {'color': 'red'}})
view.zoomTo()
view.show()
Thanks for the suggestion! It is now possible to overlay multiple poses in #11 !