Hi,
I just started to use R for my Phd. I have to write a Formula by witch, given 
two matrices of vectors (electrostatic potential map) I shall calculate the 
similarity between them.
Could you please tell me if I'am doing it right. The complecte formula is 
attached to an image file

the script

#!/usr/bin/env Rscript

options(max.print=2000000)
x<-read.table("a")                                           #reading the 
matrix 'a'
y<-read.table("b")                                           #reading the 
matrix 'b'
#----------------------------------
                                                                        # based 
on Chris et al (2011): The effect of electrostatics on Factor H and related 
pathologies
c1<-x-y                                                                 # 
phiA(i,j,k)-phiB(i,j,k)
c<-sqrt(c1$V1^2+c1$V2^2+c1$V3^2)        # |phiA(i,j,k)-phiB(i,j,k)|
a<-sqrt(x$V1^2+x$V2^2+x$V3^2)           #|phiA(i,j,k)|
b<-sqrt(y$V1^2+y$V2^2+y$V3^2)           #|phiB(i,j,k)|
#----------------------------------
esdi<-c/max(a,b)                                        
#|phiA(i,j,k)-phiB(i,j,k)|/max(|phiA(i,j,k)|,|phiB(i,j,k)|)
esd<-(1/1391093)*sum(esdi)                      # 1/N 
E*|phiA(i,j,k)-phiB(i,j,k)|/max(|phiA(i,j,k)|,|phiB(i,j,k)|)
esd


Best wishes
Houcemeddine OTHMAN
Pasteur Institute of Tunis
Venom and biotheurapetical Molecules Lab

<<attachment: similarity_formula.png>>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to