library(readxl)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggpubr)
## Loading required package: ggplot2
library(prettydoc)
## Warning: package 'prettydoc' was built under R version 4.1.2
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
WB<- read_excel("Z:/TSever/Western Blot/CHID1.xlsx", 
    sheet = "Sheet1")

invert values of band and background intenseties

WB$CHID_inverted<-c(255-WB$CHID)
WB$CHID_background_inverted<-c(255-WB$CHID_background)


WB$CHID_GAPDH_inverted<-c(255-WB$CHID_GAPDH)
WB$CHID_GAPDH_background_inverted<-c(255-WB$CHID_GAPDH_background)

deduct background

WB[,9]<-c(WB$CHID_inverted - WB$CHID_background_inverted)


WB[,10]<-c(WB$CHID_GAPDH_inverted - WB$CHID_GAPDH_background_inverted)





colnames(WB)[c(9,10)] <-c('net_CHID','net_CHID_GAPDH')

calculate ratio of net protein over net loading control (CHID1 / GAPDH)

WB[,11]<-c(WB$net_CHID / WB$net_CHID_GAPDH)


colnames(WB)[c(11)]<-c('ratio_CHID')

group treatments by changing names of rows (WT=44, 45, 46, KO= 58, 60, 68)

WBt<-WB

WBt[,1]<-c('LEG','LEG','LEG','LEG','LEG','LEG','SC','SC','SC','SC','SC','SC')

HL-60

F-test

F test is used to check if variances of both sets of data are equal

var.test(ratio_CHID ~ Sample, data=WBt )
## 
##  F test to compare two variances
## 
## data:  ratio_CHID by Sample
## F = 2.893, num df = 5, denom df = 5, p-value = 0.2685
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.404821 20.674524
## sample estimates:
## ratio of variances 
##           2.893006

the p-value of F test is p=0.5687, greather than alpha=0.05, alternative hypothesis accepted -> thereis no significant difference between the variances of the two data sets

Shapiro-Wilk test

Shapiro-Wilk test is used to test if data has normal distribution

with(WBt, shapiro.test(ratio_CHID [Sample == 'LEG']))
## 
##  Shapiro-Wilk normality test
## 
## data:  ratio_CHID[Sample == "LEG"]
## W = 0.98314, p-value = 0.9661
with(WBt, shapiro.test(ratio_CHID [Sample == 'SC']))
## 
##  Shapiro-Wilk normality test
## 
## data:  ratio_CHID[Sample == "SC"]
## W = 0.93826, p-value = 0.6452

both groups have normal distribution (p-value greater than 0.05)

t-test

unpaired t-test is used to check wheter samples have different means

test<-t.test(ratio_CHID  ~ Sample , data = WBt, var.equal = TRUE, conf.level = 0.99)
test
## 
##  Two Sample t-test
## 
## data:  ratio_CHID by Sample
## t = 1.1398, df = 10, p-value = 0.281
## alternative hypothesis: true difference in means between group LEG and group SC is not equal to 0
## 99 percent confidence interval:
##  -0.03172137  0.06735011
## sample estimates:
## mean in group LEG  mean in group SC 
##        0.03902538        0.02121101

p-value of the t-test is 0.03744, which is less than alpha 0.05. the means are different

hl60<-ggboxplot(WBt, x = "Sample", y = "ratio_CHID", 
          color = "Sample", palette = c("#00AFBB", "#E7B800"),
        ylab = "normalised band intensity", xlab = "Sample", main='HL-60 CHID1')+
  theme(plot.title = element_text(hjust = 0.5))+
  theme(legend.position = 'right')
hl60