Code/meanings

2 = background

3 = ngfr+stain

5 = neg nuclei

count = number of individual areas

area = total number of pixels

IMPORT AND ARRANGE DATA

n532hb53 <- read.csv("C:/IHC/ngfr/n532hb53_Regions_rearranged.csv")
#add meta data and reorder
n532hb53$sample <- "532"
n532hb53$tissue <- "HB"
n532hb53$section <- "53"
n532hb53$genotype <- "pp"
n532hb53$ab<- "ngfr"
n532hb53 <- n532hb53[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n532hb55 <- read.csv("C:/IHC/ngfr/n532hb55_Regions_rearranged.csv")
n532hb55$sample <- "532"
n532hb55$tissue <- "HB"
n532hb55$section <- "55"
n532hb55$genotype <- "pp"
n532hb55$ab<- "ngfr"
n532hb55 <- n532hb55[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n532hb63 <- read.csv("C:/IHC/ngfr/n532hb63_Regions_rearranged.csv")
n532hb63$sample <- "532"
n532hb63$tissue <- "HB"
n532hb63$section <- "63"
n532hb63$genotype <- "pp"
n532hb63$ab<- "ngfr"
n532hb63 <- n532hb63[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n546hb63 <- read.csv("C:/IHC/ngfr/n546hb63_Regions_rearranged.csv")
n546hb63$sample <- "546"
n546hb63$tissue <- "HB"
n546hb63$section <- "63"
n546hb63$genotype <- "pp"
n546hb63$ab<- "ngfr"
n546hb63 <- n546hb63[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n546hb83 <- read.csv("C:/IHC/ngfr/n546hb83_Regions_rearranged.csv")
n546hb83$sample <- "546"
n546hb83$tissue <- "HB"
n546hb83$section <- "83"
n546hb83$genotype <- "pp"
n546hb83$ab<- "ngfr"
n546hb83 <- n546hb83[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n546hb93 <- read.csv("C:/IHC/ngfr/n546hb93_Regions_rearranged.csv")
n546hb93$sample <- "546"
n546hb93$tissue <- "HB"
n546hb93$section <- "93"
n546hb93$genotype <- "pp"
n546hb93$ab<- "ngfr"
n546hb93 <- n546hb93[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n581hb37 <- read.csv("C:/IHC/ngfr/n581hb37_Regions_rearranged.csv")
n581hb37$sample <- "581"
n581hb37$tissue <- "HB"
n581hb37$section <- "37"
n581hb37$genotype <- "pp"
n581hb37$ab<- "ngfr"
n581hb37 <- n581hb37[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n581hb49 <- read.csv("C:/IHC/ngfr/n581hb49_Regions_rearranged.csv")
n581hb49$sample <- "581"
n581hb49$tissue <- "HB"
n581hb49$section <- "49"
n581hb49$genotype <- "pp"
n581hb49$ab<- "ngfr"
n581hb49 <- n581hb49[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n581hb53 <- read.csv("C:/IHC/ngfr/n581hb53_Regions_rearranged.csv")
n581hb53$sample <- "581"
n581hb53$tissue <- "HB"
n581hb53$section <- "53"
n581hb53$genotype <- "pp"
n581hb53$ab<- "ngfr"
n581hb53 <- n581hb53[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618hb53 <- read.csv("C:/IHC/ngfr/n618hb53_Regions_rearranged.csv")
n618hb53$sample <- "618"
n618hb53$tissue <- "HB"
n618hb53$section <- "53"
n618hb53$genotype <- "pp"
n618hb53$ab<- "ngfr"
n618hb53 <- n618hb53[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618hb59 <- read.csv("C:/IHC/ngfr/n618hb59_Regions_rearranged.csv")
n618hb59$sample <- "618"
n618hb59$tissue <- "HB"
n618hb59$section <- "59"
n618hb59$genotype <- "pp"
n618hb59$ab<- "ngfr"
n618hb59 <- n618hb59[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618hb63 <- read.csv("C:/IHC/ngfr/n618hb63_Regions_rearranged.csv")
n618hb63$sample <- "618"
n618hb63$tissue <- "HB"
n618hb63$section <- "63"
n618hb63$genotype <- "pp"
n618hb63$ab<- "ngfr"
n618hb63 <- n618hb63[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n668hb11 <- read.csv("C:/IHC/ngfr/n668hb11_Regions_rearranged.csv")
n668hb11$sample <- "688"
n668hb11$tissue <- "HB"
n668hb11$section <- "11"
n668hb11$genotype <- "pp"
n668hb11$ab<- "ngfr"
n668hb11 <- n668hb11[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n668hb51 <- read.csv("C:/IHC/ngfr/n668hb51_Regions_rearranged.csv")
n668hb51$sample <- "688"
n668hb51$tissue <- "HB"
n668hb51$section <- "51"
n668hb51$genotype <- "pp"
n668hb51$ab<- "ngfr"
n668hb51 <- n668hb51[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n668hb57 <- read.csv("C:/IHC/ngfr/n668hb57_Regions_rearranged.csv")
n668hb57$sample <- "688"
n668hb57$tissue <- "HB"
n668hb57$section <- "57"
n668hb57$genotype <- "pp"
n668hb57$ab<- "ngfr"
n668hb57 <- n668hb57[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n667hb35 <- read.csv("C:/IHC/ngfr/n667hb35_Regions_rearranged.csv")
n667hb35$sample <- "667"
n667hb35$tissue <- "HB"
n667hb35$section <- "35"
n667hb35$genotype <- "PP"
n667hb35$ab<- "ngfr"
n667hb35 <- n667hb35[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n667hb47 <- read.csv("C:/IHC/ngfr/n667hb47_Regions_rearranged.csv")
n667hb47$sample <- "667"
n667hb47$tissue <- "HB"
n667hb47$section <- "47"
n667hb47$genotype <- "PP"
n667hb47$ab<- "ngfr"
n667hb47 <- n667hb47[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n667hb55 <- read.csv("C:/IHC/ngfr/n667hb55_Regions_rearranged.csv")
n667hb55$sample <- "667"
n667hb55$tissue <- "HB"
n667hb55$section <- "57"
n667hb55$genotype <- "PP"
n667hb55$ab<- "ngfr"
n667hb55 <- n667hb55[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n694fs19 <- read.csv("C:/IHC/ngfr/n694fs19_Regions_rearranged.csv")
n694fs19$sample <- "694"
n694fs19$tissue <- "FS"
n694fs19$section <- "19"
n694fs19$genotype <- "PP"
n694fs19$ab<- "ngfr"
n694fs19 <- n694fs19[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n694fs27 <- read.csv("C:/IHC/ngfr/n694fs27_Regions_rearranged.csv")
n694fs27$sample <- "694"
n694fs27$tissue <- "FS"
n694fs27$section <- "27"
n694fs27$genotype <- "PP"
n694fs27$ab<- "ngfr"
n694fs27 <- n694fs27[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n694fs31 <- read.csv("C:/IHC/ngfr/n694fs31_Regions_rearranged.csv")
n694fs31$sample <- "694"
n694fs31$tissue <- "FS"
n694fs31$section <- "31"
n694fs31$genotype <- "PP"
n694fs31$ab<- "ngfr"
n694fs31 <- n694fs31[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n709hb25 <- read.csv("C:/IHC/ngfr/n709hb25_Regions_rearranged.csv")
n709hb25$sample <- "709"
n709hb25$tissue <- "HB"
n709hb25$section <- "25"
n709hb25$genotype <- "PP"
n709hb25$ab<- "ngfr"
n709hb25 <- n709hb25[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n709hb55 <- read.csv("C:/IHC/ngfr/n709hb55_Regions_rearranged.csv")
n709hb55$sample <- "709"
n709hb55$tissue <- "HB"
n709hb55$section <- "55"
n709hb55$genotype <- "PP"
n709hb55$ab<- "ngfr"
n709hb55 <- n709hb55[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]


n736hb27 <- read.csv("C:/IHC/ngfr/n736hb27_Regions_rearranged.csv")
n736hb27$sample <- "736"
n736hb27$tissue <- "HB"
n736hb27$section <- "27"
n736hb27$genotype <- "pp"
n736hb27$ab<- "ngfr"
n736hb27 <- n736hb27[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n736hb33 <- read.csv("C:/IHC/ngfr/n736hb33_Regions_rearranged.csv")
n736hb33$sample <- "736"
n736hb33$tissue <- "HB"
n736hb33$section <- "33"
n736hb33$genotype <- "pp"
n736hb33$ab<- "ngfr"
n736hb33 <- n736hb33[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n736hb43 <- read.csv("C:/IHC/ngfr/n736hb43_Regions_rearranged.csv")
n736hb43$sample <- "736"
n736hb43$tissue <- "HB"
n736hb43$section <- "43"
n736hb43$genotype <- "pp"
n736hb43$ab<- "ngfr"
n736hb43 <- n736hb43[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618fs61 <- read.csv("C:/IHC/ngfr/n618fs61_Regions_rearranged.csv")
n618fs61$sample <- "618"
n618fs61$tissue <- "FS"
n618fs61$section <- "61"
n618fs61$genotype <- "pp"
n618fs61$ab<- "ngfr"
n618fs61 <- n618fs61[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618fs41 <- read.csv("C:/IHC/ngfr/n618fs41_Regions_rearranged.csv")
n618fs41$sample <- "618"
n618fs41$tissue <- "FS"
n618fs41$section <- "61"
n618fs41$genotype <- "pp"
n618fs41$ab<- "ngfr"
n618fs41 <- n618fs41[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

n618fs31 <- read.csv("C:/IHC/ngfr/n618fs31_Regions_rearranged.csv")
n618fs31$sample <- "618"
n618fs31$tissue <- "FS"
n618fs31$section <- "41"
n618fs31$genotype <- "pp"
n618fs31$ab<- "ngfr"
n618fs31 <- n618fs31[, c(7, 8, 9, 10, 11, 2, 1, 3, 5, 4, 6)]

ngfr_raw_data <- rbind(n532hb53, n532hb55, n532hb63, n546hb63, n546hb83, n546hb93, n581hb37,
                  n581hb49, n581hb53, n618hb53, n618hb59, n618hb63, n668hb11, n668hb51,
                  n668hb57, n667hb35, n667hb47, n667hb55, n694fs19, n694fs27, n694fs31,
                  n709hb25, n709hb55, n736hb27, n736hb33, n736hb43, n618fs61, n618fs41,
                  n618fs31) 

write.csv(ngfr_raw_data, "C:/IHC/ngfr/ngfr_raw_data.csv")

AVERAGING BY SAMPLE

1 = rxfp2+stain, 2 = background, 5 = neg nuclei

#bind data from the same sample
n532HB <-rbind(n532hb53, n532hb55, n532hb63)
#calculate the average and standard deviation of each measure
mean_532HB <- data.frame (sample = "532HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n532HB$count_3),
                          count_2 = mean(n532HB$count_2),
                          count_5 = mean(n532HB$count_5),
                          area_3 = mean(n532HB$area_3),
                          area_2 = mean(n532HB$area_2),
                          area_5 = mean(n532HB$area_5),
                          sd_count_3 = sd(n532HB$count_3),
                          sd_count_2 = sd(n532HB$count_2),
                          sd_count_5 = sd(n532HB$count_5),
                          sd_area_3 = sd(n532HB$area_3),
                          sd_area_2 = sd(n532HB$area_2),
                          sd_area_5 = sd(n532HB$area_5))


n546HB <-rbind(n546hb63, n546hb83, n546hb93)

mean_546HB <- data.frame (sample = "546HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n546HB$count_3),
                          count_2 = mean(n546HB$count_2),
                          count_5 = mean(n546HB$count_5),
                          area_3 = mean(n546HB$area_3),
                          area_2 = mean(n546HB$area_2),
                          area_5 = mean(n546HB$area_5),
                          sd_count_3 = sd(n546HB$count_3),
                          sd_count_2 = sd(n546HB$count_2),
                          sd_count_5 = sd(n546HB$count_5),
                          sd_area_3 = sd(n546HB$area_3),
                          sd_area_2 = sd(n546HB$area_2),
                          sd_area_5 = sd(n546HB$area_5))


n581HB <-rbind(n581hb37,
               n581hb49, n581hb53)

mean_581HB <- data.frame (sample = "581HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n581HB$count_3),
                          count_2 = mean(n581HB$count_2),
                          count_5 = mean(n581HB$count_5),
                          area_3 = mean(n581HB$area_3),
                          area_2 = mean(n581HB$area_2),
                          area_5 = mean(n581HB$area_5),
                          sd_count_3 = sd(n581HB$count_3),
                          sd_count_2 = sd(n581HB$count_2),
                          sd_count_5 = sd(n581HB$count_5),
                          sd_area_3 = sd(n581HB$area_3),
                          sd_area_2 = sd(n581HB$area_2),
                          sd_area_5 = sd(n581HB$area_5))

n618HB <-rbind(n618hb53, n618hb59, n618hb63)

mean_618HB <- data.frame (sample = "618HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n618HB$count_3),
                          count_2 = mean(n618HB$count_2),
                          count_5 = mean(n618HB$count_5),
                          area_3 = mean(n618HB$area_3),
                          area_2 = mean(n618HB$area_2),
                          area_5 = mean(n618HB$area_5),
                          sd_count_3 = sd(n618HB$count_3),
                          sd_count_2 = sd(n618HB$count_2),
                          sd_count_5 = sd(n618HB$count_5),
                          sd_area_3 = sd(n618HB$area_3),
                          sd_area_2 = sd(n618HB$area_2),
                          sd_area_5 = sd(n618HB$area_5))


n668HB <-rbind(n668hb11, n668hb51,
               n668hb57)

mean_668HB <- data.frame (sample = "668HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n668HB$count_3),
                          count_2 = mean(n668HB$count_2),
                          count_5 = mean(n668HB$count_5),
                          area_3 = mean(n668HB$area_3),
                          area_2 = mean(n668HB$area_2),
                          area_5 = mean(n668HB$area_5),
                          sd_count_3 = sd(n668HB$count_3),
                          sd_count_2 = sd(n668HB$count_2),
                          sd_count_5 = sd(n668HB$count_5),
                          sd_area_3 = sd(n668HB$area_3),
                          sd_area_2 = sd(n668HB$area_2),
                          sd_area_5 = sd(n668HB$area_5))

n736HB <-rbind(n736hb27, n736hb33, n736hb43)

mean_736HB <- data.frame (sample = "736HB",
                          genotype = "pp",
                          ab = "ngfr",
                          count_3 = mean(n736HB$count_3),
                          count_2 = mean(n736HB$count_2),
                          count_5 = mean(n736HB$count_5),
                          area_3 = mean(n736HB$area_3),
                          area_2 = mean(n736HB$area_2),
                          area_5 = mean(n736HB$area_5),
                          sd_count_3 = sd(n736HB$count_3),
                          sd_count_2 = sd(n736HB$count_2),
                          sd_count_5 = sd(n736HB$count_5),
                          sd_area_3 = sd(n736HB$area_3),
                          sd_area_2 = sd(n736HB$area_2),
                          sd_area_5 = sd(n736HB$area_5))


n694FS <-rbind(n694fs19, n694fs27, n694fs31)

mean_694FS <- data.frame(sample = "694FS",
                         genotype = "PP",
                         ab = "ngfr",
                         count_3 = mean(n694FS$count_3),
                         count_2 = mean(n694FS$count_2),
                         count_5 = mean(n694FS$count_5),
                         area_3 = mean(n694FS$area_3),
                         area_2 = mean(n694FS$area_2),
                         area_5 = mean(n694FS$area_5),
                         sd_count_3 = sd(n694FS$count_3),
                         sd_count_2 = sd(n694FS$count_2),
                         sd_count_5 = sd(n694FS$count_5),
                         sd_area_3 = sd(n694FS$area_3),
                         sd_area_2 = sd(n694FS$area_2),
                         sd_area_5 = sd(n694FS$area_5))


n667HB <-rbind(n667hb35, n667hb47, n667hb55)

mean_667HB <- data.frame (sample = "667HB",
                          genotype = "PP",
                          ab = "ngfr",
                          count_3 = mean(n667HB$count_3),
                          count_2 = mean(n667HB$count_2),
                          count_5 = mean(n667HB$count_5),
                          area_3 = mean(n667HB$area_3),
                          area_2 = mean(n667HB$area_2),
                          area_5 = mean(n667HB$area_5),
                          sd_count_3 = sd(n667HB$count_3),
                          sd_count_2 = sd(n667HB$count_2),
                          sd_count_5 = sd(n667HB$count_5),
                          sd_area_3 = sd(n667HB$area_3),
                          sd_area_2 = sd(n667HB$area_2),
                          sd_area_5 = sd(n667HB$area_5))


n709HB <-rbind(n709hb25, n709hb55)

mean_709HB <- data.frame (sample = "709HB",
                          genotype = "PP",
                          ab = "ngfr",
                          count_3 = mean(n709HB$count_3),
                          count_2 = mean(n709HB$count_2),
                          count_5 = mean(n709HB$count_5),
                          area_3 = mean(n709HB$area_3),
                          area_2 = mean(n709HB$area_2),
                          area_5 = mean(n709HB$area_5),
                          sd_count_3 = sd(n709HB$count_3),
                          sd_count_2 = sd(n709HB$count_2),
                          sd_count_5 = sd(n709HB$count_5),
                          sd_area_3 = sd(n709HB$area_3),
                          sd_area_2 = sd(n709HB$area_2),
                          sd_area_5 = sd(n709HB$area_5))

n618FS <-rbind(n618fs61, n618fs41, n618fs31)

mean_618FS <- data.frame (sample = "618FS",
                          genotype = "PP",
                          ab = "ngfr",
                          count_3 = mean(n618FS$count_3),
                          count_2 = mean(n618FS$count_2),
                          count_5 = mean(n618FS$count_5),
                          area_3 = mean(n618FS$area_3),
                          area_2 = mean(n618FS$area_2),
                          area_5 = mean(n618FS$area_5),
                          sd_count_3 = sd(n618FS$count_3),
                          sd_count_2 = sd(n618FS$count_2),
                          sd_count_5 = sd(n618FS$count_5),
                          sd_area_3 = sd(n618FS$area_3),
                          sd_area_2 = sd(n618FS$area_2),
                          sd_area_5 = sd(n618FS$area_5))



#data1 combines individual samples in a table
ngfr_meanforsample <-rbind(mean_532HB, mean_546HB, mean_581HB, mean_618HB,
              mean_736HB, mean_668HB, mean_667HB, mean_694FS, 
              mean_709HB)

Checking for Normality of raw data

Conclusion: Not all data is normal

hist(ngfr_raw_data$count_2, breaks=7)

qqnorm(ngfr_raw_data$count_2)

shapiro.test(ngfr_raw_data$count_2)
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$count_2
## W = 0.92008, p-value = 0.03063
hist(ngfr_raw_data$count_3, breaks=7)

qqnorm(ngfr_raw_data$count_3)

shapiro.test(ngfr_raw_data$count_3) 
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$count_3
## W = 0.90302, p-value = 0.01158
hist(ngfr_raw_data$count_5, breaks=7)

qqnorm(ngfr_raw_data$count_5)

shapiro.test(ngfr_raw_data$count_5) 
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$count_5
## W = 0.9364, p-value = 0.08071
hist(ngfr_raw_data$area_2, breaks=7)

qqnorm(ngfr_raw_data$area_2)

shapiro.test(ngfr_raw_data$area_2)
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$area_2
## W = 0.91903, p-value = 0.02881
hist(ngfr_raw_data$area_3, breaks=7)

qqnorm(ngfr_raw_data$area_3)

shapiro.test(ngfr_raw_data$area_3)
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$area_3
## W = 0.977, p-value = 0.7575
hist(ngfr_raw_data$area_5, breaks=7)

qqnorm(ngfr_raw_data$area_5)

shapiro.test(ngfr_raw_data$area_5)
## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_raw_data$area_5
## W = 0.89486, p-value = 0.007397

Visualise data: boxplots

## Warning: Using alpha for a discrete variable is not advised.

ggboxplot(ngfr_raw_data, x = "sample", y = "count_5", fill = "genotype", alpha = "tissue") +
  theme_classic()
## Warning: Using alpha for a discrete variable is not advised.

ggboxplot(ngfr_raw_data, x = "sample", y = "area_3", fill = "genotype", alpha = "tissue") +
  theme_classic()
## Warning: Using alpha for a discrete variable is not advised.

ggboxplot(ngfr_raw_data, x = "sample", y = "area_5", fill = "genotype", alpha = "tissue") +
  theme_classic()
## Warning: Using alpha for a discrete variable is not advised.

Checking for normality of data averaged per sample.

Conclusion: Data is normal as p-value is >0.05

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$count_2
## W = 0.95105, p-value = 0.7016

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$count_3
## W = 0.98738, p-value = 0.9914

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$count_5
## W = 0.87329, p-value = 0.1333

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$area_2
## W = 0.94671, p-value = 0.654

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$area_3
## W = 0.89504, p-value = 0.2246

## 
##  Shapiro-Wilk normality test
## 
## data:  ngfr_meanforsample$area_5
## W = 0.93157, p-value = 0.4964

Calculation of proportions

Boxplots of proportions

ggboxplot(ngfr_meanforsample, x = "genotype", y = "TA", fill = "genotype") +
  theme_classic()

ggboxplot(ngfr_meanforsample, x = "genotype", y = "pTA_2", fill = "genotype") +
  theme_classic() + 
  labs(y = "Background/total area (proportion)")

ggboxplot(ngfr_meanforsample, x = "genotype", y = "pTA_3", fill = "genotype") +
  theme_classic()  + 
  labs(y = "NGFR postive stain area/total area (proportion)")

ggboxplot(ngfr_meanforsample, x = "genotype", y = "pTA_5", fill = "genotype") +
  theme_classic()   + 
  labs(y = "unstained nuclei area/total area (proportion)")

ngfrhsum <- subset(ngfr_meanforsample, genotype=="horned")
ngfrpsum <- subset(ngfr_meanforsample, genotype=="polled")


write.csv(ngfrhsum, "C://IHC/ngfr/ngfrhsum.csv")
write.csv(ngfrpsum, "C://IHC/ngfr/ngfrpsum.csv")

Column graphs

#Column graphs

#Convert proportion to percentage
ngfrhsum$pTA_3_percent <- ngfrhsum$pTA_3*100

ngfrpsum$pTA_3_percent <- ngfrpsum$pTA_3*100


#calculate values for column graph 
hcol_three <- group_by(ngfrhsum, genotype) %>% 
  summarise(
    mean = mean(pTA_3_percent, na.rm = TRUE),
    sd = sd(pTA_3_percent, na.rm = TRUE)
  )
hcol_three$genotype <- "hornedHB"
hcol_three$n <- 5
hcol_three$se <- hcol_three$sd/sqrt(hcol_three$n)


pcol_three <- group_by(ngfrpsum, genotype) %>%
  summarise(
    mean = mean(pTA_3_percent, na.rm = TRUE),
    sd = sd(pTA_3_percent, na.rm = TRUE)
  )
pcol_three$genotype <- "polledHB+FS"
pcol_three$n <- 3
pcol_three$se <- pcol_three$sd/sqrt(pcol_three$n)

ngfr_col_three <- rbind(hcol_three, pcol_three)


#NGFR nerves
ggplot(ngfr_col_three, aes(x=genotype, y=mean))+ 
  geom_col(width = 0.7, fill = "steelblue")+
  geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=.2,
                position=position_dodge(.9)) +
  labs(x = "Sample", y = "% area NGFR positive nerves")+
  ylim(0,3)+
  theme_light(base_size = 18)

Fisher’s Exact Test

Testing to see if there is a significant difference in positive areas (nerves-3) between horned and polled tissues

horn <-rbind(mean_532HB, mean_546HB,  mean_581HB, 
                  mean_668HB,  mean_736HB, mean_618HB)

poll <- rbind(mean_694FS, mean_709HB, mean_667HB)
horn$A2 <- horn$area_2 + horn$area_5 #calculate negative pixels
horn_means <- as.data.frame(round(colMeans(horn[, c(7, 16)]))) # find mean
horn_means
##        round(colMeans(horn[, c(7, 16)]))
## area_3                            162340
## A2                               7244322
poll$A2 <- poll$area_2 + poll$area_5
polled_means <- as.data.frame(round(colMeans(poll[, c(7, 16)])))
polled_means
##        round(colMeans(poll[, c(7, 16)]))
## area_3                             93714
## A2                               5719812
#create new data frame with following format for each variable
#     |   +   |   -   |   Total
# pp  |       |       |   
# PP  |       |       | 
#Total|       |       |   

dat <- data.frame(
  "Positive" = c(horn_means[1,], polled_means[1,]),
  "Negative" = c(horn_means[2,], polled_means[2,]),
  row.names = c("Horned", "Polled"),
  stringsAsFactors = FALSE)

dat
##        Positive Negative
## Horned   162340  7244322
## Polled    93714  5719812
mosaicplot(dat,
           main = "Mosaic plot",
           color = TRUE)

test <- fisher.test(dat)
test
## 
##  Fisher's Exact Test for Count Data
## 
## data:  dat
## p-value < 2.2e-16
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.356672 1.378912
## sample estimates:
## odds ratio 
##   1.367743
test$p.value
## [1] 0
write.csv(dat, "C:/IHC/ngfr_nerve")

Based on the Fisher Exact Test, the number of positive areas (pixels) in horned samples is significantly different to polled samples.