[chimerax-users] Copy attribute value from one attribute to another

Eric Pettersen pett at cgl.ucsf.edu
Wed Nov 2 11:56:15 PDT 2022


The Python would be:

for m in session.models:
	if hasattr(m, 'residues'):
		for r in m.residues:
			r.atoms.bfactors = getattr(r, 'seq_conservation', 0.0)

Which you could put into a file with a '.py' suffix, and execute in ChimeraX simply by opening it.

--Eric

	Eric Pettersen
	UCSF Computer Graphics Lab


> On Nov 2, 2022, at 10:17 AM, Elaine Meng via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> Hi Sean,
> If the sharing is for Chimera or ChimeraX users, you can save it as an "attribute assignment file"
> <https://rbvi.ucsf.edu/chimerax/docs/user/formats/defattr.html>
> 
> As for reassigning bfactor with the values of some other attribute, you can do it with a short bit of python, which somebody else on the ChimeraX team can provide (soon).  You may lose significant digits writing it out in the bfactor column of a PDB file, however.
> 
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.                       
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
> 
>> On Nov 2, 2022, at 3:39 AM, Sean Connell via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>> 
>> Hello, I have a question with a probably obvious answer but I cannot figure it out. 
>> 
>> Is there a command to copy an attribute value from one attribute to another, for example, seq_conservation to bfactor? The idea would be to save a pdb file with the conservation stored in bfactor (for sharing). In this case I guess there is the issue that one is an atom attribute and the other is residue attribute but one could assign all atoms of the residue the same value.
>> 
>> Sorry in advance if I miss something obvious.
> 
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users




More information about the ChimeraX-users mailing list