--- title: "20210502 Boxplots and Cutoffs" author: "Jessica Kleer" date: "2 5 2021" output: html_document --- Distribution of Autoantibodies against C1q (antiC1q) A15 (former called A08) A09 (former called A08shift) A86 (former called A90) B41 B43 B83 and chosen cutoff for positivity (9% positive healthy blood donors ="NHS") ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} #setwd("Z:/Kleer/Project Paper/Masterfiles/4. Testfiles/") setwd("/Volumes/KLIM$/Kleer/Project Paper/Submission/DRYAD") #setwd("/Volumes/KLIM$/Kleer/Project Paper/Masterfiles/4. Testfiles") getwd() ``` ```{r} library(ggplot2) library(psych) ``` ```{r} data <- read.csv2("MASTERFILE_kleer_20210305.csv") ``` ```{r} data$Group <- factor(data$Group, levels = c("NHS", "SLE")) #SLE <- systemic lupus erythematosus group #NHS <- normal human serum (actualy has been plasma) ``` ```{r anti-C1q} #Boxplot of Distribution of anti-C1q Antibodies #Cutoff set to 60reIU describeBy(data$antiC1q, data$Group) quantile(data$antiC1q[data$Group=="NHS"], 0.91) ggplot(data=data, aes(x=Group, y = antiC1q)) + geom_jitter(alpha=0.3, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + ylim(0,200) + # y-axis limited to 200, since the data are very skewed geom_hline(yintercept=60) + theme_classic() + theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18), axis.ticks.x = element_blank()) data$AntiC1qpos. <- ifelse(data$antiC1q >60, yes=1, no=0) prop.table(table(data$Group, data$AntiC1qpos.), margin = 1) #17% anti-C1q positive SLE patients table(data$Group, data$AntiC1qpos.) #65 anti-C1q positive SLE patients ``` ```{r anti-A15} #Boxplot of Distribution of anti-A15 Antibodies (A15 = former A08) #Cutoff set to 160reIU describeBy(data$A08, data$Group) quantile(data$A08[data$Group=="NHS"], 0.91) ggplot(data=data, aes(x=Group, y = A08)) + # A15 = former A08 geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + theme_minimal() + ylim(0,1000) + # y-axis limited, since the data are very skewed theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18))+ geom_hline(yintercept=160) data$A08pos. <- ifelse(data$A08 >160, yes=1, no=0) prop.table(table(data$Group, data$A08pos.), margin = 1) # 32.5 % anti- A15 positive SLE patients table(data$Group, data$A08pos.) #123 anti-A15 positive patients ``` ```{r anti-A09} #Boxplot of Distribution of anti-A09 Antibodies (A09 = former A08shift) #Cutoff set to 100reIU describeBy(data$A08shift, data$Group) quantile(data$A08shift[data$Group=="NHS"], 0.91) ggplot(data=data, aes(x=Group, y=A08shift))+ geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + theme_minimal() + ylim(0,250) + # y-axis limited, since the data are very skewed geom_hline(yintercept=100) #Cutoff 91% Specificity data$A08shiftpos. <- ifelse(data$A08shift >100, yes=1, no=0) prop.table(table(data$Group, data$A08shiftpos.), margin = 1) # 42% anti-A09 positive patients table(data$Group, data$A08shiftpos.) # 159 anti-A09 positive patients ``` ```{r anti-A86} quantile(data$A90[data$Group=="NHS"], 0.91) describeBy(data$A90, data$Group) #Boxplot of Distribution of anti-A86 Antibodies (A86 = former A90) #Cutoff set to 425reIU ggplot(data=data, aes(x=Group, y = A90)) + geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + theme_minimal() + theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18))+ ylim(0,1600) + # y-axis limited, since the data are very skewed geom_hline(yintercept=425) data$A90pos. <- ifelse(data$A90 >425, yes=1, no=0) prop.table(table(data$Group, data$A90pos.), margin = 1) #8.9% positive SLE-patients table(data$Group, data$A90pos.) # 34 positive SLE-patients ``` ```{r anti-B41} #Boxplot of Distribution of anti-AB41 Antibodies #Cutoff set to 50reIU quantile(data$B41[data$Group=="NHS"], 0.91) describeBy(data$B41, data$Group) ggplot(data=data, aes(x=Group, y = B41)) + geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + theme_minimal() + theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18)) + ylim(0,210)+ # y-axis limited, since the data are very skewed geom_hline(yintercept=50) data$B41pos. <- ifelse(data$B41 >50, yes=1, no=0) prop.table(table(data$Group, data$B41pos.), margin = 1) # 8.5% positive SLE patients table(data$Group, data$B41pos.) # 32 positive SLE patients ``` ```{r anti-B43} #Boxplot of Distribution of anti-B43 Antibodies #Cutoff set to 25reIU quantile(data$B43[data$Group=="NHS"], 0.91) describeBy(data$B43, data$Group) ggplot(data=data, aes(x=Group, y = B43)) + geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + theme_minimal() + theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18)) + ylim(0,50) + # y-axis limited, since the data are very skewed geom_hline(yintercept=25) data$B43pos. <- ifelse(data$B43 >25, yes=1, no=0) prop.table(table(data$Group, data$B43pos.), margin = 1) # 14% positive SLE patients table(data$Group, data$B43pos.) # 53 positive SLE patients ``` ```{r anti-B83 } quantile(data$B83[data$Group=="NHS"], 0.91) describeBy(data$B83, data$Group) #Boxplot of Distribution of anti-B83 Antibodies #Cutoff set to 51reIU ggplot(data=data, aes(x=Group, y = B83)) + geom_jitter(alpha=0.5, height = 0, width = 0.25, color ="black") + geom_boxplot(aes(fill=Group), outlier.size = -1, alpha =0.5) + scale_fill_manual(values = c("SLE" = "firebrick2", "NHS"= "lightgreen")) + ylim(0,320) + # y-axis limited, since the data are very skewed theme_minimal() + theme(axis.text= element_text(size = 15), axis.title = element_text(size = 18)) + geom_hline(yintercept=51) data$B83pos. <- ifelse(data$B83 >51, yes=1, no=0) prop.table(table(data$Group, data$B83pos.), margin = 1) table(data$Group, data$B83pos.) ```