Hi all,

this is what I would do:

cmd.alter('all', 'b = mapping.get(resv, b)',
    space={'mapping': dict((r['resnum'], r['value']) for r in data)})

Cheers,
  Thomas

On 16 Jun 2015, at 05:10, Tsjerk Wassenaar <tsje...@gmail.com> wrote:

> Hi Jordan,
> 
> The answer is something like (assuming reading from a file):
> 
> newb=[float(i) for i in open("stuff.dat").read().split()]
> alter n. ca, b=newb.pop()
> spectrum b
> 
> Hope it helps,
> 
> Tsjerk
> 
> On Tue, Jun 16, 2015 at 10:25 AM, Jordan Willis <jwillis0...@gmail.com> wrote:
> Hi Tsjerk,
> 
> It seems everyone is pointing to this 
> (http://www.pymolwiki.org/index.php/Color#Reassigning_B-Factors_and_Coloring) 
> which I somehow missed. However, they seem to be altering one residue at a 
> time like I’m doing. 
> 
> 
> Jordan
>> On Jun 15, 2015, at 11:59 PM, Tsjerk Wassenaar <tsje...@gmail.com> wrote:
>> 
>> Hi Jordan,
>> 
>> Yes, although I don't have the answer at hand, it has been given on the user 
>> list several times. You can find it in the archives.
>> 
>> Cheers,
>> 
>> Tsjerk
>> 
>> On Jun 16, 2015 08:16, "Jordan Willis" <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

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


------------------------------------------------------------------------------
_______________________________________________
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

Reply via email to