library(bio3d)
library(car)
source("confplot_funs.R")


load("xrayPCA_EQ.RData")
load("projected_WT.RData")
load("projected_GroEL_rhod.RData")

## Testing Cis ring sampling PC1 
a <- c()
b <- c()
for ( i in c(1,2,3,4,5,6,7) ) {
  inds <- c(500,1000,1500) + (1500* (i-1))
  a <- c(a, sim116$cis$proj[inds,1])
  a <- c(a, sim116$trans$proj[inds,1])
  b <- c(b, sim129$cis$proj[inds,1])
  b <- c(b, sim171$cis$proj[inds,1])
}
t.test(a,b)
wilcox.test(a,b, alternative="greater")


## Testing Cis ring sampling PC2
a <- c()
b <- c()
for ( i in c(1,2,3,4,5,6,7) ) {
  inds <- c(500,1000,1500) + (1500* (i-1))
  a <- c(a, sim116$cis$proj[inds,2])
  a <- c(a, sim116$trans$proj[inds,2])
  b <- c(b, sim129$cis$proj[inds,2])
  b <- c(b, sim171$cis$proj[inds,2])
}
t.test(a,b)
wilcox.test(a,b, alternative="greater")


## Testing Trans ring sampling PC1 
a <- c()
b <- c()
for ( i in c(1,2,3,4,5,6,7) ) {
  inds <- c(500,1000,1500) + (1500* (i-1))
  a <- c(a, sim116$cis$proj[inds,1])
  a <- c(a, sim116$trans$proj[inds,1])
  b <- c(b, sim129$trans$proj[inds,1])
  b <- c(b, sim171$trans$proj[inds,1])
}
t.test(a,b)
wilcox.test(a,b, alternative="less")


## Testing Cis ring sampling PC2
a <- c()
b <- c()
for ( i in c(1,2,3,4,5,6,7) ) {
  inds <- c(500,1000,1500) + (1500* (i-1))
  a <- c(a, sim116$cis$proj[inds,2])
  a <- c(a, sim116$trans$proj[inds,2])
  b <- c(b, sim129$trans$proj[inds,2])
  b <- c(b, sim171$trans$proj[inds,2])
}
t.test(a,b)
wilcox.test(a,b, alternative="greater")





