Pearson cc.r (Gaucher Disease)

From Bioinformatikpedia

This is an R function we wrote to calculate the Pearson's correlation coefficients in the task 4. Below is the calculation with our values.

<source lang="perl"> r <- function(n,x,y){ xy <- x*y x2 <- x**2 y2 <- y**2 sumx <- sum(x) sumy <- sum(y) sumxy <- sum(xy) sumx2 <- sum(x2) sumy2 <- sum(y2) return ((n*sumxy-sumx*sumy)/sqrt((n*sumx2-sumx**2)*(n*sumy2-sumy**2))) }

n=7

ali_cols <- c(497,496,439,356,246,197,175) hh_id <- c(100,100,29,19,14,16,11) prob <- c(100,100,100,100,98.79,97.76,95.65) evalue <- c(2.4e-132,4.4e-132,3.7e-107,1.1e-77,1.1e-77,1.1e-08,9.8e-05) score <- c(1078.26,1074.98,870.15,633.96,139.02,101.53,73.33)

lga_n <- c(492,496,430,340,221,168,140) lga_id <- c(98.98,99.8,93.49,84.12,87.78,85.71,70.71) rmsd <- c(0.77,0.19,1.58,1.96,2.49,2.49,2.75) lga_s <- c(97.938,99.783,80.275,53.971,53.971,21.221,16.681) lga_q <- c(56.371,173.564,25.550,16.523,8.524,6.487,4.906)


r(n,ali_cols,lga_n) r(n,ali_cols,lga_id) r(n,ali_cols,rmsd) r(n,ali_cols,lga_s) r(n,ali_cols,lga_q)

r(n,hh_id,lga_n) r(n,hh_id,lga_id) r(n,hh_id,rmsd) r(n,hh_id,lga_s) r(n,hh_id,lga_q)

r(n,prob,lga_n) r(n,prob,lga_id) r(n,prob,rmsd) r(n,prob,lga_s) r(n,prob,lga_q)

r(n,evalue,lga_n) r(n,evalue,lga_id) r(n,evalue,rmsd) r(n,evalue,lga_s) r(n,evalue,lga_q)

r(n,score,lga_n) r(n,score,lga_id) r(n,score,rmsd) r(n,score,lga_s) r(n,score,lga_q) </source>

Alternative option is just to use the predefined R cor function: cor(x,y,method="pearson"). (We noticed that to late.)