[Chimera-users] alter volume data with python

Michael Zimmermann michaelz at iastate.edu
Mon Feb 1 18:26:39 PST 2010

Dear Chimera users,

I cannot find a way to search the chimera-users archive, so I
appologize if this has been asked already.  I wish to alter some
volume data in specific ways; delete (zero out) all volume values that
do not meet certain density criteria.  The following code modifies the
matrix values, but I can't figure out how to update the map that is
being displayed in the volume viewer.

I would like to be able to do something like:
opened[0].full_matrix = H
Then I would only see the swath that I "selected" with the following code.

# ------------------------------------------------------------------------
source = '1R0A_antigen_6A_8s_0.425f_inv.mrc'
opened = chimera.openModels.open(source)
em = opened[0]
H = em.full_matrix()
s = H.shape
for k in range(0,s[2]-1):
	for i in range(0,s[0]-1):
		for j in range(0,s[1]-1):
			if(H[i,j,k] >= -.28) and (H[i,j,k] <= -0.001):
				H[i,j,k] = H[i,j,k]+1
				H[i,j,k] = 0

# ------------------------------------------------------------------------

Thank you,

Michael Zimmermann
Ph.D. student in Bioinformatics and Computational Biology
Department of Biochemistry, Biophysics and Molecular Biology
Iowa State University

More information about the Chimera-users mailing list