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/YBX1_pSer102.xlsx", 
    sheet = "HL60")

invert values of band and background intenseties

WB$YBX1_inverted<-c(255-WB$YBX1)
WB$YBX1_background_inverted<-c(255-WB$YBX1_background)
WB$YBX1_GAPDH_background_inverted<-c(255-WB$YBX1_GAPDH)
WB$YBX1_GAPDH_inverted<-c(255-WB$YBX1_GAPDH_background)


WB$YBX1pS102_inverted<-c(255-WB$YBX1pS102)
WB$YBX1pS102_background_inverted<-c(255-WB$YBX1pS102_background)
WB$YBX1pS102_GAPDH_inverted<-c(255-WB$YBX1pS102_GAPDH)
WB$YBX1pS102_GAPDH_background_inverted<-c(255-WB$YBX1pS102_GAPDH_background)

deduct background

WB[,18]<-c(WB$YBX1_inverted - WB$YBX1_background_inverted)
WB[,19]<-c(WB$YBX1_GAPDH_inverted - WB$YBX1_GAPDH_background_inverted)


WB[,20]<-c(WB$YBX1pS102_inverted - WB$YBX1pS102_background_inverted)
WB[,21]<-c(WB$YBX1pS102_GAPDH_inverted - WB$YBX1pS102_GAPDH_background_inverted)


colnames(WB)[c(18,19,20,21)] <-c('net_YBX1','net_GAPDH_YBX1','net_YBX1pS102','net_GAPDH_YBX1pS102')

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

WB[,22]<-c(WB$net_YBX1 / WB$net_GAPDH_YBX1)

WB[,23]<-c(WB$net_YBX1pS102 / WB$net_GAPDH_YBX1pS102)


colnames(WB)[c(22,23)]<-c('ratio_YBX1','ratio_YBX1pS102')

calculate ration phosphorilated to whole protein

WB[,24]<-c(WB$ratio_YBX1 / WB$ratio_YBX1pS102)


colnames(WB)[c(24)]<-c('ratio_YBX1YBX1pS102')

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

WBt<-WB

WBt[,1]<-c('LEG','LEG','LEG','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_YBX1YBX1pS102 ~ Sample, data=WBt )
## 
##  F test to compare two variances
## 
## data:  ratio_YBX1YBX1pS102 by Sample
## F = 3.0298, num df = 2, denom df = 2, p-value = 0.4963
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##    0.07768777 118.16310471
## sample estimates:
## ratio of variances 
##           3.029823

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_YBX1YBX1pS102 [Sample == 'LEG']))
## 
##  Shapiro-Wilk normality test
## 
## data:  ratio_YBX1YBX1pS102[Sample == "LEG"]
## W = 0.99968, p-value = 0.9657
with(WBt, shapiro.test(ratio_YBX1YBX1pS102 [Sample == 'SC']))
## 
##  Shapiro-Wilk normality test
## 
## data:  ratio_YBX1YBX1pS102[Sample == "SC"]
## W = 0.99988, p-value = 0.9794

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_YBX1YBX1pS102  ~ Sample , data = WBt, var.equal = TRUE, conf.level = 0.99)
test
## 
##  Two Sample t-test
## 
## data:  ratio_YBX1YBX1pS102 by Sample
## t = -4.1127, df = 4, p-value = 0.0147
## alternative hypothesis: true difference in means between group LEG and group SC is not equal to 0
## 99 percent confidence interval:
##  -2.0913344  0.1179059
## sample estimates:
## mean in group LEG  mean in group SC 
##        -1.5638367        -0.5771224

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_YBX1YBX1pS102", 
          color = "Sample", palette = c("#00AFBB", "#E7B800"),
        ylab = "normalised band intensity", xlab = "Sample", main='Liver')+
  theme(plot.title = element_text(hjust = 0.5))+
  theme(legend.position = 'right')
hl60