Hi Jordan - I think you're doing it exactly the way I would, given an existing dict containing the values. Note, however, that if you have multiple loaded, or multiple chains with the same residue numbers, you may wish to be more specific with your selection string; your current script will alter every residue with the given resi # in all chains of all loaded objects.
If you're having to do this multiple times with the same structure and it's slow each time (e.g. while creating a figure from a script), maybe consider saving a new PDB file with the modified B-factors using PyMOL's `save` command, so you can just load it directly. # After your `alter` script save myfile_mod_b.pdb, myfile # Then next time load the new version with the same name # as before to avoid breaking the rest of the script. Now you can # remove the `alter` for-loop from the script. load myfile_mod_b.pdb, myfile Hope that helps. Cheers, Jared -- Jared Sampson Xiangpeng Kong Lab NYU Langone Medical Center http://kong.med.nyu.edu/ On Jun 16, 2015, at 2:15 AM, Jordan Willis <jwillis0...@gmail.com<mailto:jwillis0...@gmail.com>> wrote: Hi, I have a dictionary that has a bunch of values I want to assign to b-factors in order to color by. In my script: for residue in data: cmd.alter(“resi {}”.format(residue[‘resnum’]),”b={}”.format(residue[‘value’])) This executes the alter command for each residue. For some reason, its taking forever in my script. Is there something inherently inefficient about alter? And is there anyway to fix it? Perhaps, assign a bunch of b-factors at once. Jordan ------------------------------------------------------------------------------ _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net<mailto:PyMOL-users@lists.sourceforge.net>) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
------------------------------------------------------------------------------
_______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net