Re: [PyMOL] asymmetric transformation matrices

2009-11-09 Thread Tsjerk Wassenaar
Hi Thomas,

Say, the first system is x and the second y, where y=R(x+s) is the
first transformation. Then the reverse transformation follows as

y   = R(x + s)
y   = Rx + Rs
Rx = y - Rs
x   = t(R)(y-Rs)

Note that that is also equal to: x = t(R)y - s

Hope it helps,

Tsjerk

On Mon, Nov 9, 2009 at 1:09 AM, Thomas Evangelidis te8...@mbg.duth.gr wrote:
 Dear pymol users,

 I noticed something strange when superimposing 2 opposite pairs of
 chains. E.g.

 DEBUG: template  1BQG_A  query  2MUC_A
 Query Transformation:
         X2 = +0.86747*(X1+2.29751) + -0.49574*(Y1+60.99794) +
 -0.04181*(Z1+64.71239)
         Y2 = -0.49701*(X1+2.29751) + -0.85983*(Y1+60.99794) +
 -0.11697*(Z1+64.71239)
         Z2 = +0.02204*(X1+2.29751) + +0.12225*(Y1+60.99794) +
 -0.99226*(Z1+64.71239)


 DEBUG: template  2MUC_A  query  1BQG_A
 Query Transformation:
         X2 = +0.86747*(X1+30.95128) + -0.49701*(Y1+61.15895) +
 +0.02204*(Z1+56.70381)
         Y2 = -0.49574*(X1+30.95128) + -0.85983*(Y1+61.15895) +
 +0.12225*(Z1+56.70381)
         Z2 = -0.04181*(X1+30.95128) + -0.11697*(Y1+61.15895) +
 -0.99226*(Z1+56.70381)

 Although looking at the rotation matrices one is the transpose of the
 other, the translation vectors are not opposite. Can someone explain
 that?



 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 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




-- 
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
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


Re: [PyMOL] spectrum

2009-11-09 Thread Robert Campbell
Hi Mark and Sean,

On Sat, 07 Nov 2009 10:05:59 -0500 Sean Law magic...@hotmail.com wrote:

 Sorry for the earlier confusion.  I think I found a hackish way of getting
 a gray spectrum:

snip Sean's extensive explanation

I know I'm biased, since I wrote the color_b.py script, but I fail to see what
is difficult about typing:

color_b  selectionname, gradient=user, user_rgb=[.2,.2,.2,.5,.5,.5,.8,.8,.8]

In order to colour selectionname in a gray spectrum that goes from 20%
gray, has a midpoint of 50% gray and ends at 80% gray (where 20% gray is the
same as the colour called gray20, i.e. close to black and 80% gray is almost
white). 


Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
robert.campb...@queensu.cahttp://pldserver1.biochem.queensu.ca/~rlc

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
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


Re: [PyMOL] asymmetric transformation matrices

2009-11-09 Thread Thomas Evangelidis
As Tsjerk pointed out, there was a mistake in the code. Just for the  
record this is the right function:

pdb2entry = { 1ONE: 1ONE_A, 2ONE: 2ONE_A }
# a function to measure Ca distances of oposite pairs of superimpossed  
chains (the proteins must have the same aa composition)
def check_for_symmetry(tstruct, qstruct):
 # align the pair
 cmd.fetch(tstruct)
 cmd.extract(pdb2entry[tstruct]+1, tstruct +  and chain +  
pdb2entry[tstruct][-1:] +  and not hetatm)
 cmd.fetch(qstruct)
 cmd.extract(pdb2entry[qstruct]+1, qstruct + and chain +  
pdb2entry[qstruct][-1:] +  and not hetatm)
 cmd.delete(tstruct)
 cmd.delete(qstruct)
 print Aligning +pdb2entry[tstruct]+1+ with +pdb2entry[qstruct]+1
 cmd.align(pdb2entry[tstruct]+1, pdb2entry[qstruct]+1)
 #cmd.do(cealign +pdb2entry[qstruct]+1, +pdb2entry[tstruct]+1)
 # align the symmetric pair
 cmd.fetch(tstruct)
 cmd.extract(pdb2entry[tstruct]+2, tstruct +  and chain +  
pdb2entry[tstruct][-1:] +  and not hetatm)
 cmd.fetch(qstruct)
 cmd.extract(pdb2entry[qstruct]+2, qstruct + and chain +  
pdb2entry[qstruct][-1:] +  and not hetatm)
 print Aligning +pdb2entry[qstruct]+1+ with +pdb2entry[tstruct]+1
 cmd.align(pdb2entry[qstruct]+2, pdb2entry[tstruct]+2)
 #cmd.do(cealign +pdb2entry[qstruct]+2, +pdb2entry[tstruct]+2)
 # measure distances
 pymol.stored.protein_dict = {}
 cmd.iterate(pdb2entry[tstruct]+1, stored.protein_dict[(chain,resi)]=1)
 Residues = pymol.stored.protein_dict.keys()
 Residues.sort()
 RMSD = 0
 for res in Residues:
 chain = res[0]
 resi = res[1]
 dist1 = cmd.distance('tmp',pdb2entry[tstruct]+1 and chain  
+chain+ and resi +resi+ and name ca,pdb2entry[qstruct]+1 and  
chain +chain+ and resi +resi+ and name ca)
 dist2 = cmd.distance('tmp',pdb2entry[tstruct]+2 and chain  
+chain+ and resi +resi+ and name ca,pdb2entry[qstruct]+2 and  
chain +chain+ and resi +resi+ and name ca)
 print The difference in distance betweem residue IDs ,  
resi, is : ,dist1, -,dist2, = ,dist1-dist2
 RMSD += (dist1-dist2)**2
 RMSD = sqrt(RMSD/len(Residues))
 print RMSD of distances between identical residues in 1ONE x  
2ONE and this in 2ONE x 1ONE: , RMSD

check_for_symmetry(1ONE, 2ONE)


After this correction the RMSD falls to 2.06853295972e-06, which a  
reasonably good  number.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
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


[PyMOL] Fwd: asymmetric transformation matrices

2009-11-09 Thread Tsjerk Wassenaar
Hmm, this should've been replied to the list. The info may be useful to others.

Tsjerk

-- Forwarded message --
From: Tsjerk Wassenaar tsje...@gmail.com
Date: Mon, Nov 9, 2009 at 5:02 PM
Subject: Re: [PyMOL] asymmetric transformation matrices
To: Thomas Evangelidis te8...@mbg.duth.gr


Hi Thomas,

You're not doing what you think you're doing.

 # a function to measure Ca distances of oposite pairs of superimpossed
 chains (the proteins must have the same aa composition)
 def check_for_symmetry(tstruct, qstruct):
    # align the pair
    cmd.fetch(tstruct)
You fetch the first structure, which is placed in state 1

    cmd.extract(pdb2entry[tstruct]+1, tstruct +  and chain +
 pdb2entry[tstruct][-1:] +  and not hetatm)
You extract part of that structure, which is removed from the state

    cmd.fetch(qstruct)
You fetch the other structure, which is also loaded into state 1

    cmd.extract(pdb2entry[qstruct]+1, qstruct + and chain +
 pdb2entry[qstruct][-1:] +  and not hetatm)
You extract part of that structure

    print Aligning +pdb2entry[tstruct]+1+ with +pdb2entry[qstruct]+1
    cmd.align(pdb2entry[tstruct]+1, pdb2entry[qstruct]+1)
    #cmd.do(cealign +pdb2entry[qstruct]+1, +pdb2entry[tstruct]+1)
    # align the symmetric pair

    cmd.fetch(tstruct)
You fetch the first structure again, but this time it's appended to state 2

    cmd.extract(pdb2entry[tstruct]+2, tstruct +  and chain +
 pdb2entry[tstruct][-1:] +  and not hetatm)
You try to extract chain A again. But that is tried on state 1, while
that state has no chain A anymore. The object is empty!

    cmd.fetch(qstruct)
Same story for the other object

    cmd.extract(pdb2entry[qstruct]+2, qstruct + and chain +
 pdb2entry[qstruct][-1:] +  and not hetatm)
Empty object...

Then in the next part you calculate the RMSD of distances in an empty
object (all 0) and the aligned one. That RMSD ends up close to the
actual RMSD from the alignment (restricted on CA atoms: 0.280), for
obvious reasons.

I hope this helps,

Tsjerk
--
Tsjerk A. Wassenaar, Ph.D.

Computational Chemist
Medicinal Chemist
Neuropharmacologist



-- 
Tsjerk A. Wassenaar, Ph.D.

Computational Chemist
Medicinal Chemist
Neuropharmacologist

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
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


Re: [PyMOL] Spectrum

2009-11-09 Thread Robert Campbell
Hi Sean,

On Mon, 09 Nov 2009 10:58:53 -0500 Sean Law magic...@hotmail.com wrote:

 
 Robert,
 
 I would have to agree with you.  I've used many of your scripts and have
 also learned a lot from them and think that the color B script is pretty
 robust and helpful.

Thanks.
 
 I could be wrong but I remember the original poster commenting about using
 the min  max settings from the spectrum command and I wonder if that is
 used to control the min/max of B-factor values to color (so that any values
 outside of the range of min and max will be colored the extreme min/max
 color values).  Of course, I'm sure it's just as easy to add a couple of
 lines of extra code into your script to account for that (if it isn't
 already there).

The color_b.py script has options called minimum and maximum just
like the spectrum command.  These are used to select the range of
B-values to colour. So (using PDB code 1dvi as an example) if your actual
B-values are between 2 and 55.98 and you set the minimum to 10 and
maximum to 50, then use 8 bins (just to get nice numbers here!), by typing:

color_b minimum=10, maximum=50, nbins=8

You'll see the following output from the color_b.py script:

Minimum and Maximum B-values:  2.0 55.975422
Color select:  n. ca and (b15 or b =   15)
Color select:  n. ca and b15
Color select:  n. ca and b20
Color select:  n. ca and b25
Color select:  n. ca and b30
Color select:  n. ca and b35
Color select:  n. ca and b40
Color select:  n. ca and b45

So yes, anything within the lowest range and below will be in colour 1 and
anything within the highest range and above will be in colour 8.

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
robert.campb...@queensu.cahttp://pldserver1.biochem.queensu.ca/~rlc

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
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