RACE-Seq / 03_visualization / 03_visualization_PABPC4_X1KO.Rmd
03_visualization_PABPC4_X1KO.Rmd
Raw
---
title: "RACE-Seq. Changes of 3' tails of _PABPC4_ after _XRN1_ knock-out. "
output:
  html_document:
    code_folding: hide
    toc: true
    number_sections: true
  pdf_document: default
---

```{r setup, include=FALSE} 
library(knitr)
knitr::opts_chunk$set(warning = FALSE, message = FALSE, echo = FALSE) 
```

```{r include=FALSE}
#load libraries
library(sqldf)
library(ggplot2)
library(dplyr)
library(stringr)
library(ggpubr)
library(RColorBrewer)
library(ggridges)
```

```{r include=FALSE}
#load functions
source(file.path('03_visualization_functions_X1KO.R'))
```

```{r include=FALSE}
#load data
gene_biotype <- read.csv("/RACESeq_infos.csv", sep = "\t")

path_to_files = "/path/to/files"

X1KO_17 = read_and_merge_file(paste(path_to_files,"RPI17_S47_PABPC4.softclips.parsed.all.csv",sep=""))
X1KO_18 = read_and_merge_file(paste(path_to_files,"RPI18_S48_PABPC4.softclips.parsed.all.csv",sep=""))
X1KO_19 = read_and_merge_file(paste(path_to_files,"RPI19_S49_PABPC4.softclips.parsed.all.csv",sep=""))
X1KO_20 = read_and_merge_file(paste(path_to_files,"RPI20_S50_PABPC4.softclips.parsed.all.csv",sep=""))
X1KO_21 = read_and_merge_file(paste(path_to_files,"RPI21_S51_PABPC4.softclips.parsed.all.csv",sep=""))
X1KO_22 = read_and_merge_file(paste(path_to_files,"RPI22_S52_PABPC4.softclips.parsed.all.csv",sep=""))

WT_25 = read_and_merge_file(paste(path_to_files,"RPI25_S53_PABPC4.softclips.parsed.all.csv",sep=""))
WT_26 = read_and_merge_file(paste(path_to_files,"RPI26_S54_PABPC4.softclips.parsed.all.csv",sep=""))
WT_27 = read_and_merge_file(paste(path_to_files,"RPI27_S55_PABPC4.softclips.parsed.all.csv",sep=""))
WT_28 = read_and_merge_file(paste(path_to_files,"RPI28_S56_PABPC4.softclips.parsed.all.csv",sep=""))
WT_29 = read_and_merge_file(paste(path_to_files,"RPI29_S57_PABPC4.softclips.parsed.all.csv",sep=""))
WT_30 = read_and_merge_file(paste(path_to_files,"RPI30_S58_PABPC4.softclips.parsed.all.csv",sep=""))
```

```{r}
#Tail lengths
PABPC4X1KO_17 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_17)
PABPC4X1KO_18 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_18)
PABPC4X1KO_19 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_19)
PABPC4X1KO_20 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_20)
PABPC4X1KO_21 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_21)
PABPC4X1KO_22 = tail_analysis_for_genes_0t(c("PABPC4"),X1KO_22)
PABPC4WT_25 = tail_analysis_for_genes_0t(c("PABPC4"),WT_25)
PABPC4WT_26 = tail_analysis_for_genes_0t(c("PABPC4"),WT_26)
PABPC4WT_27 = tail_analysis_for_genes_0t(c("PABPC4"),WT_27)
PABPC4WT_28 = tail_analysis_for_genes_0t(c("PABPC4"),WT_28)
PABPC4WT_29 = tail_analysis_for_genes_0t(c("PABPC4"),WT_29)
PABPC4WT_30 = tail_analysis_for_genes_0t(c("PABPC4"),WT_30)
```

```{r include=FALSE}
##all samples
len_PABPC4_17 = PABPC4X1KO_17[PABPC4X1KO_17$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_17$sample = "X1KO_17"
len_PABPC4_18 = PABPC4X1KO_18[PABPC4X1KO_18$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_18$sample = "X1KO_18"
len_PABPC4_19 = PABPC4X1KO_19[PABPC4X1KO_19$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_19$sample = "X1KO_19"
len_PABPC4_20 = PABPC4X1KO_20[PABPC4X1KO_20$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_20$sample = "X1KO_20"
len_PABPC4_21 = PABPC4X1KO_21[PABPC4X1KO_21$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_21$sample = "X1KO_21"
len_PABPC4_22 = PABPC4X1KO_22[PABPC4X1KO_22$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_22$sample = "X1KO_22"

len_PABPC4_25 = PABPC4WT_25[PABPC4WT_25$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_25$sample = "WT_25"
len_PABPC4_26 = PABPC4WT_26[PABPC4WT_26$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_26$sample = "WT_26"
len_PABPC4_27 = PABPC4WT_27[PABPC4WT_27$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_27$sample = "WT_27"
len_PABPC4_28 = PABPC4WT_28[PABPC4WT_28$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_28$sample = "WT_28"
len_PABPC4_29 = PABPC4WT_29[PABPC4WT_29$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_29$sample = "WT_29"
len_PABPC4_30 = PABPC4WT_30[PABPC4WT_30$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_30$sample = "WT_30"

len_PABPC4 = rbind(len_PABPC4_17,len_PABPC4_18,len_PABPC4_19,len_PABPC4_20,len_PABPC4_21,len_PABPC4_22,len_PABPC4_25,len_PABPC4_26,len_PABPC4_27,len_PABPC4_28,len_PABPC4_29,len_PABPC4_30)

##means
len_PABPC4_mean_25 = PABPC4WT_25[PABPC4WT_25$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_25$sample = "WT"
len_PABPC4_mean_26 = PABPC4WT_26[PABPC4WT_26$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_26$sample = "WT"
len_PABPC4_mean_27 = PABPC4WT_27[PABPC4WT_27$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_27$sample = "WT"
len_PABPC4_mean_28 = PABPC4WT_28[PABPC4WT_28$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_28$sample = "WT"
len_PABPC4_mean_29 = PABPC4WT_29[PABPC4WT_29$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_29$sample = "WT"
len_PABPC4_mean_30 = PABPC4WT_30[PABPC4WT_30$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_30$sample = "WT"

len_PABPC4_mean_17 = PABPC4X1KO_17[PABPC4X1KO_17$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_17$sample = "X1KO"
len_PABPC4_mean_18 = PABPC4X1KO_18[PABPC4X1KO_18$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_18$sample = "X1KO"
len_PABPC4_mean_19 = PABPC4X1KO_19[PABPC4X1KO_19$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_19$sample = "X1KO"
len_PABPC4_mean_20 = PABPC4X1KO_20[PABPC4X1KO_20$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_20$sample = "X1KO"
len_PABPC4_mean_21 = PABPC4X1KO_21[PABPC4X1KO_21$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_21$sample = "X1KO"
len_PABPC4_mean_22 = PABPC4X1KO_22[PABPC4X1KO_22$clip3_tail %in% c("1001","1002","1003"),]
len_PABPC4_mean_22$sample = "X1KO"

len_PABPC4_mean = rbind(len_PABPC4_mean_25,len_PABPC4_mean_26,len_PABPC4_mean_27,len_PABPC4_mean_28,len_PABPC4_mean_29,len_PABPC4_mean_30,len_PABPC4_mean_17,len_PABPC4_mean_18,len_PABPC4_mean_19,len_PABPC4_mean_20,len_PABPC4_mean_21,len_PABPC4_mean_22)
```

# Tail lengths violin plots {.tabset}

## PABPC4
```{r}
ggplot(len_PABPC4, aes(x=clip3_tail_len_decoded, y=clip3_tail_len, fill=sample)) +
  scale_x_discrete(labels=c("poliA in reads and shorter reads" = "poliA", "poliAU in reads and shorter reads" = "poliAU", "poliU in reads and shorter reads" = "poliU")) +
  geom_violin() +
  ggtitle("PABPC4") +
  ylab("tail length") +
  theme(axis.title.x = element_blank(),
        axis.title=element_text(size=14),
        axis.text=element_text(size=12),
        legend.title=element_text(size=14),
        legend.text=element_text(size=12)) +
  geom_boxplot(width=0.1, position=position_dodge(0.9), outlier.size = 0.5, alpha = 0.1)
```

# Tail lengths density plots and bar plots {.tabset}

## PABPC4 {.tabset}

### poly(A)
```{r fig.height=6, fig.width=7}
tail_length_fun("1002","PABPC4","polyA")
```

### poly(AU)
```{r fig.height=6, fig.width=7}
tail_length_fun("1003","PABPC4","polyAU")
```

### poly(U)
```{r fig.height=6, fig.width=7}
tail_length_fun("1001","PABPC4","polyU")
```

# Tails length statistics {.tabset}

For every sample mean length of 3' tails is calculated. Statistical significance in 3' tail length difference is calculated by comparing means with Wilcoxon test

## PABPC4
```{r}
#polyA
w1 = len_PABPC4[len_PABPC4$sample == "WT_25" & len_PABPC4$clip3_tail == "1002",]
w2 = len_PABPC4[len_PABPC4$sample == "WT_26" & len_PABPC4$clip3_tail == "1002",]
w3 = len_PABPC4[len_PABPC4$sample == "WT_27" & len_PABPC4$clip3_tail == "1002",]
w4 = len_PABPC4[len_PABPC4$sample == "WT_28" & len_PABPC4$clip3_tail == "1002",]
w5 = len_PABPC4[len_PABPC4$sample == "WT_29" & len_PABPC4$clip3_tail == "1002",]
w6 = len_PABPC4[len_PABPC4$sample == "WT_30" & len_PABPC4$clip3_tail == "1002",]
x1 = len_PABPC4[len_PABPC4$sample == "X1KO_17" & len_PABPC4$clip3_tail == "1002",]
x2 = len_PABPC4[len_PABPC4$sample == "X1KO_18" & len_PABPC4$clip3_tail == "1002",]
x3 = len_PABPC4[len_PABPC4$sample == "X1KO_19" & len_PABPC4$clip3_tail == "1002",]
x4 = len_PABPC4[len_PABPC4$sample == "X1KO_20" & len_PABPC4$clip3_tail == "1002",]
x5 = len_PABPC4[len_PABPC4$sample == "X1KO_21" & len_PABPC4$clip3_tail == "1002",]
x6 = len_PABPC4[len_PABPC4$sample == "X1KO_22" & len_PABPC4$clip3_tail == "1002",]

wA = c(mean(w1$clip3_tail_len),mean(w2$clip3_tail_len),mean(w3$clip3_tail_len),mean(w4$clip3_tail_len),mean(w5$clip3_tail_len),mean(w6$clip3_tail_len))
xA = c(mean(x1$clip3_tail_len),mean(x2$clip3_tail_len),mean(x3$clip3_tail_len),mean(x4$clip3_tail_len),mean(x5$clip3_tail_len),mean(x6$clip3_tail_len))

#polyAU
w1 = len_PABPC4[len_PABPC4$sample == "WT_25" & len_PABPC4$clip3_tail == "1003",]
w2 = len_PABPC4[len_PABPC4$sample == "WT_26" & len_PABPC4$clip3_tail == "1003",]
w3 = len_PABPC4[len_PABPC4$sample == "WT_27" & len_PABPC4$clip3_tail == "1003",]
w4 = len_PABPC4[len_PABPC4$sample == "WT_28" & len_PABPC4$clip3_tail == "1003",]
w5 = len_PABPC4[len_PABPC4$sample == "WT_29" & len_PABPC4$clip3_tail == "1003",]
w6 = len_PABPC4[len_PABPC4$sample == "WT_30" & len_PABPC4$clip3_tail == "1003",]
x1 = len_PABPC4[len_PABPC4$sample == "X1KO_17" & len_PABPC4$clip3_tail == "1003",]
x2 = len_PABPC4[len_PABPC4$sample == "X1KO_18" & len_PABPC4$clip3_tail == "1003",]
x3 = len_PABPC4[len_PABPC4$sample == "X1KO_19" & len_PABPC4$clip3_tail == "1003",]
x4 = len_PABPC4[len_PABPC4$sample == "X1KO_20" & len_PABPC4$clip3_tail == "1003",]
x5 = len_PABPC4[len_PABPC4$sample == "X1KO_21" & len_PABPC4$clip3_tail == "1003",]
x6 = len_PABPC4[len_PABPC4$sample == "X1KO_22" & len_PABPC4$clip3_tail == "1003",]

wAU = c(mean(w1$clip3_tail_len),mean(w2$clip3_tail_len),mean(w3$clip3_tail_len),mean(w4$clip3_tail_len),mean(w5$clip3_tail_len),mean(w6$clip3_tail_len))
xAU = c(mean(x1$clip3_tail_len),mean(x2$clip3_tail_len),mean(x3$clip3_tail_len),mean(x4$clip3_tail_len),mean(x5$clip3_tail_len),mean(x6$clip3_tail_len))

#polyU
w1 = len_PABPC4[len_PABPC4$sample == "WT_25" & len_PABPC4$clip3_tail == "1001",]
w2 = len_PABPC4[len_PABPC4$sample == "WT_26" & len_PABPC4$clip3_tail == "1001",]
w3 = len_PABPC4[len_PABPC4$sample == "WT_27" & len_PABPC4$clip3_tail == "1001",]
w4 = len_PABPC4[len_PABPC4$sample == "WT_28" & len_PABPC4$clip3_tail == "1001",]
w5 = len_PABPC4[len_PABPC4$sample == "WT_29" & len_PABPC4$clip3_tail == "1001",]
w6 = len_PABPC4[len_PABPC4$sample == "WT_30" & len_PABPC4$clip3_tail == "1001",]
x1 = len_PABPC4[len_PABPC4$sample == "X1KO_17" & len_PABPC4$clip3_tail == "1001",]
x2 = len_PABPC4[len_PABPC4$sample == "X1KO_18" & len_PABPC4$clip3_tail == "1001",]
x3 = len_PABPC4[len_PABPC4$sample == "X1KO_19" & len_PABPC4$clip3_tail == "1001",]
x4 = len_PABPC4[len_PABPC4$sample == "X1KO_20" & len_PABPC4$clip3_tail == "1001",]
x5 = len_PABPC4[len_PABPC4$sample == "X1KO_21" & len_PABPC4$clip3_tail == "1001",]
x6 = len_PABPC4[len_PABPC4$sample == "X1KO_22" & len_PABPC4$clip3_tail == "1001",]

wU = c(mean(w1$clip3_tail_len),mean(w2$clip3_tail_len),mean(w3$clip3_tail_len),mean(w4$clip3_tail_len),mean(w5$clip3_tail_len),mean(w6$clip3_tail_len))
xU = c(mean(x1$clip3_tail_len),mean(x2$clip3_tail_len),mean(x3$clip3_tail_len),mean(x4$clip3_tail_len),mean(x5$clip3_tail_len),mean(x6$clip3_tail_len))
```

polyA
```{r}
wilcox.test(wA,xA)
```

polyAU
```{r}
wilcox.test(wAU,xAU)
```

polyU
```{r}
wilcox.test(wU,xU)
```

# Tail lengths violin plots (mean)  {.tabset}

## PABPC4
```{r}
ggplot(len_PABPC4_mean, aes(x=clip3_tail_len_decoded, y=clip3_tail_len, fill=sample)) +
  scale_x_discrete(labels=c("poliA in reads and shorter reads" = "poliA", "poliAU in reads and shorter reads" = "poliAU", "poliU in reads and shorter reads" = "poliU")) +
  geom_violin() +
  ggtitle("PABPC4") +
  ylab("tail length") +
  theme(axis.title.x = element_blank(),
        axis.title=element_text(size=14),
        axis.text=element_text(size=12),
        legend.title=element_text(size=14),
        legend.text=element_text(size=12)) +
  #stat_compare_means(method = "t.test") +
  geom_boxplot(width=0.1, position=position_dodge(0.9), outlier.size = 0.5, alpha = 0.1)
```

# Tail lengths density plots and bar plots (mean) {.tabset}

## PABPC4 {.tabset}

### poly(A)
```{r fig.height=6, fig.width=7}
tail_length_mean_fun("1002","PABPC4","polyA")
```

### poly(AU)
```{r fig.height=6, fig.width=7}
tail_length_mean_fun("1003","PABPC4","polyAU")
```

### poly(U)
```{r fig.height=6, fig.width=7}
tail_length_mean_fun("1001","PABPC4","polyU")
```

# Percentage of tails

## PABPC4
```{r}
percent_PABPC4WT_25 = percents_fun(PABPC4WT_25,"WT_25")
nreads_PABPC4WT_25 = nreads_fun(PABPC4WT_25)
percent_PABPC4WT_26 = percents_fun(PABPC4WT_26,"WT_26")
nreads_PABPC4WT_26 = nreads_fun(PABPC4WT_26)
percent_PABPC4WT_27 = percents_fun(PABPC4WT_27,"WT_27")
nreads_PABPC4WT_27 = nreads_fun(PABPC4WT_27)
percent_PABPC4WT_28 = percents_fun(PABPC4WT_28,"WT_28")
nreads_PABPC4WT_28 = nreads_fun(PABPC4WT_28)
percent_PABPC4WT_29 = percents_fun(PABPC4WT_29,"WT_29")
nreads_PABPC4WT_29 = nreads_fun(PABPC4WT_29)
percent_PABPC4WT_30 = percents_fun(PABPC4WT_30,"WT_30")
nreads_PABPC4WT_30 = nreads_fun(PABPC4WT_30)

percent_PABPC4X1KO_17 = percents_fun(PABPC4X1KO_17,"X1KO_17")
nreads_PABPC4X1KO_17 = nreads_fun(PABPC4X1KO_17)
percent_PABPC4X1KO_18 = percents_fun(PABPC4X1KO_18,"X1KO_18")
nreads_PABPC4X1KO_18 = nreads_fun(PABPC4X1KO_18)
percent_PABPC4X1KO_19 = percents_fun(PABPC4X1KO_19,"X1KO_19")
nreads_PABPC4X1KO_19 = nreads_fun(PABPC4X1KO_19)
percent_PABPC4X1KO_20 = percents_fun(PABPC4X1KO_20,"X1KO_20")
nreads_PABPC4X1KO_20 = nreads_fun(PABPC4X1KO_20)
percent_PABPC4X1KO_21 = percents_fun(PABPC4X1KO_21,"X1KO_21")
nreads_PABPC4X1KO_21 = nreads_fun(PABPC4X1KO_21)
percent_PABPC4X1KO_22 = percents_fun(PABPC4X1KO_22,"X1KO_22")
nreads_PABPC4X1KO_22 = nreads_fun(PABPC4X1KO_22)

percent_PABPC4 = rbind(percent_PABPC4WT_25, percent_PABPC4WT_26, percent_PABPC4WT_27, percent_PABPC4WT_28, percent_PABPC4WT_29, percent_PABPC4WT_30, percent_PABPC4X1KO_17, percent_PABPC4X1KO_18, percent_PABPC4X1KO_19, percent_PABPC4X1KO_20, percent_PABPC4X1KO_21, percent_PABPC4X1KO_22)
```

```{r fig.height=6, fig.width=7}
ggplot(percent_PABPC4, aes(fill=tail, y=percent, x=sample)) + 
    geom_bar(position="stack", stat="identity") + 
    ggtitle("PABPC4") + 
    theme(axis.text.x=element_text(angle=45, hjust=1),
        axis.title=element_text(size=14),
        axis.text=element_text(size=12),
        legend.title=element_text(size=14),
        legend.text=element_text(size=12)) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "no tail" = "#969696", "U tail" = "#A50F15"))
```

### number of reads with specific tails in each sample {.tabset}

#### WT_25
```{r}
t(nreads_PABPC4WT_25)
```

#### WT_26
```{r}
t(nreads_PABPC4WT_26)
```

#### WT_27
```{r}
t(nreads_PABPC4WT_27)
```

#### WT_28
```{r}
t(nreads_PABPC4WT_28)
```

#### WT_29
```{r}
t(nreads_PABPC4WT_29)
```

#### WT_30
```{r}
t(nreads_PABPC4WT_30)
```

#### X1KO_17
```{r}
t(nreads_PABPC4X1KO_17)
```

#### X1KO_18
```{r}
t(nreads_PABPC4X1KO_18)
```

#### X1KO_19
```{r}
t(nreads_PABPC4X1KO_19)
```

#### X1KO_20
```{r}
t(nreads_PABPC4X1KO_20)
```

#### X1KO_21
```{r}
t(nreads_PABPC4X1KO_21)
```

#### X1KO_22
```{r}
t(nreads_PABPC4X1KO_22)
```

### statistics  {.tabset}
```{r include=FALSE}
percent_PABPC4_stat = percent_PABPC4

percent_PABPC4_stat$sample <- gsub('WT_25', 'WT', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('WT_26', 'WT', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('WT_27', 'WT', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('WT_28', 'WT', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('WT_29', 'WT', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('WT_30', 'WT', percent_PABPC4_stat$sample)

percent_PABPC4_stat$sample <- gsub('X1KO_17', 'X1KO', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('X1KO_18', 'X1KO', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('X1KO_19', 'X1KO', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('X1KO_20', 'X1KO', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('X1KO_21', 'X1KO', percent_PABPC4_stat$sample)
percent_PABPC4_stat$sample <- gsub('X1KO_22', 'X1KO', percent_PABPC4_stat$sample)

stat = compare_means(percent ~ sample, percent_PABPC4_stat, group.by = "tail", method="t.test", p.adjust.method="BH")
```

#### WT vs X1KO
```{r echo=FALSE}
stat
```

# Percentage of tails (mean) {.tabset}

## PABPC4
```{r}
xU = percent_PABPC4[with(percent_PABPC4, tail == "U tail"),]
xU = xU[with(xU, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA = percent_PABPC4[with(percent_PABPC4, tail == "A tail"),]
xA = xA[with(xA, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU = percent_PABPC4[with(percent_PABPC4, tail == "AU tail"),]
xAU = xAU[with(xAU, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xno = percent_PABPC4[with(percent_PABPC4, tail == "no tail"),]
xno = xno[with(xno, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

percent_mean_PABPC4WT <- data.frame(percent=c(mean(xU$percent),mean(xA$percent),mean(xAU$percent),mean(xno$percent)),
                               tail=c("U tail","A tail","AU tail","no tail"),
                               sample=c(rep("WT",4)))

xU = percent_PABPC4[with(percent_PABPC4, tail == "U tail"),]
xU = xU[with(xU, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA = percent_PABPC4[with(percent_PABPC4, tail == "A tail"),]
xA = xA[with(xA, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU = percent_PABPC4[with(percent_PABPC4, tail == "AU tail"),]
xAU = xAU[with(xAU, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xno = percent_PABPC4[with(percent_PABPC4, tail == "no tail"),]
xno = xno[with(xno, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

percent_mean_PABPC4X1KO <- data.frame(percent=c(mean(xU$percent),mean(xA$percent),mean(xAU$percent),mean(xno$percent)),
                               tail=c("U tail","A tail","AU tail","no tail"),
                               sample=c(rep("X1KO",4)))

percent_mean_PABPC4 = rbind(percent_mean_PABPC4WT, percent_mean_PABPC4X1KO)
```

```{r fig.height=6, fig.width=4}
ggplot(percent_mean_PABPC4, aes(fill=tail, y=percent, x=sample)) + 
    geom_bar(position="fill", stat="identity") + #position="fill" - robi procenty, gdzy dane nie są w procentach
    ggtitle("PABPC4") + 
    theme(axis.text.x=element_text(angle=45, hjust=1),
        axis.title=element_text(size=14),
        axis.text=element_text(size=12),
        legend.title=element_text(size=14),
        legend.text=element_text(size=12)) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "no tail" = "#969696", "U tail" = "#A50F15"))
```

# Percentage of tails in length range

## PABPC4
```{r}
percent_PABPC4WT_25_bins = percents_bins_fun(PABPC4WT_25,"WT_25")
nreads_PABPC4WT_25_bins = nreads_bins_fun(PABPC4WT_25,"WT_25")
percent_PABPC4WT_26_bins = percents_bins_fun(PABPC4WT_26,"WT_26")
nreads_PABPC4WT_26_bins = nreads_bins_fun(PABPC4WT_26,"WT_26")
percent_PABPC4WT_27_bins = percents_bins_fun(PABPC4WT_27,"WT_27")
nreads_PABPC4WT_27_bins = nreads_bins_fun(PABPC4WT_27,"WT_27")
percent_PABPC4WT_28_bins = percents_bins_fun(PABPC4WT_28,"WT_28")
nreads_PABPC4WT_28_bins = nreads_bins_fun(PABPC4WT_28,"WT_28")
percent_PABPC4WT_29_bins = percents_bins_fun(PABPC4WT_29,"WT_29")
nreads_PABPC4WT_29_bins = nreads_bins_fun(PABPC4WT_29,"WT_29")
percent_PABPC4WT_30_bins = percents_bins_fun(PABPC4WT_30,"WT_30")
nreads_PABPC4WT_30_bins = nreads_bins_fun(PABPC4WT_30,"WT_30")

percent_PABPC4X1KO_17_bins = percents_bins_fun(PABPC4X1KO_17,"X1KO_17")
nreads_PABPC4X1KO_17_bins = nreads_bins_fun(PABPC4X1KO_17,"X1KO_17")
percent_PABPC4X1KO_18_bins = percents_bins_fun(PABPC4X1KO_18,"X1KO_18")
nreads_PABPC4X1KO_18_bins = nreads_bins_fun(PABPC4X1KO_18,"X1KO_18")
percent_PABPC4X1KO_19_bins = percents_bins_fun(PABPC4X1KO_19,"X1KO_19")
nreads_PABPC4X1KO_19_bins = nreads_bins_fun(PABPC4X1KO_19,"X1KO_19")
percent_PABPC4X1KO_20_bins = percents_bins_fun(PABPC4X1KO_20,"X1KO_20")
nreads_PABPC4X1KO_20_bins = nreads_bins_fun(PABPC4X1KO_20,"X1KO_20")
percent_PABPC4X1KO_21_bins = percents_bins_fun(PABPC4X1KO_21,"X1KO_21")
nreads_PABPC4X1KO_21_bins = nreads_bins_fun(PABPC4X1KO_21,"X1KO_21")
percent_PABPC4X1KO_22_bins = percents_bins_fun(PABPC4X1KO_22,"X1KO_22")
nreads_PABPC4X1KO_22_bins = nreads_bins_fun(PABPC4X1KO_22,"X1KO_22")

nreads_PABPC4WT_bins = cbind(nreads_PABPC4WT_25_bins, nreads_PABPC4WT_26_bins, nreads_PABPC4WT_27_bins, nreads_PABPC4WT_28_bins, nreads_PABPC4WT_29_bins, nreads_PABPC4WT_30_bins)
nreads_PABPC4WT_bins = as.data.frame(nreads_PABPC4WT_bins)
nreads_PABPC4WT_bins[rowMeans(nreads_PABPC4WT_bins) < 1,] = 0

nreads_PABPC4X1_bins = cbind(nreads_PABPC4X1KO_17_bins, nreads_PABPC4X1KO_18_bins, nreads_PABPC4X1KO_19_bins, nreads_PABPC4X1KO_20_bins, nreads_PABPC4X1KO_21_bins, nreads_PABPC4X1KO_22_bins)
nreads_PABPC4X1_bins = as.data.frame(nreads_PABPC4X1_bins)
nreads_PABPC4X1_bins[rowMeans(nreads_PABPC4X1_bins) < 1,] = 0

percent_PABPC4_bins = rbind(percent_PABPC4WT_25_bins, percent_PABPC4WT_26_bins, percent_PABPC4WT_27_bins, percent_PABPC4WT_28_bins, percent_PABPC4WT_29_bins, percent_PABPC4WT_30_bins, percent_PABPC4X1KO_17_bins, percent_PABPC4X1KO_18_bins, percent_PABPC4X1KO_19_bins, percent_PABPC4X1KO_20_bins, percent_PABPC4X1KO_21_bins, percent_PABPC4X1KO_22_bins)
```

```{r}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
ggplot(percent_PABPC4_bins, aes(fill=tail, y=percent, x=range)) + 
    geom_bar(position="stack", stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "U tail" = "#A50F15")) +
    scale_x_discrete(limits = order)
```

### statistics  {.tabset}
```{r include=FALSE}
percent_PABPC4_stat2 = percent_PABPC4_bins

percent_PABPC4_stat2$sample <- gsub('WT_25', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_26', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_27', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_28', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_29', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_30', 'WT', percent_PABPC4_stat2$sample)

percent_PABPC4_stat2$sample <- gsub('X1KO_17', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_18', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_19', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_20', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_21', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_22', 'X1KO', percent_PABPC4_stat2$sample)

stat1_10 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "1-10",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat11_20 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "11-20",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat21_30 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "21-30",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat31_40 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "31-40",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat41_50 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "41-50",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat51_60 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "51-60",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat61 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "61+",], group.by = "tail", method="t.test", p.adjust.method="BH")
```

#### range 1-10 
```{r}
stat1_10
```

#### range 11-20
```{r}
stat11_20
```

#### range 21-30
```{r}
stat21_30
```

#### range 31-40
```{r}
stat31_40
```

#### range 41-50
```{r}
stat41_50
```

#### range 51-60
```{r}
stat51_60
```

#### range 61+
```{r}
stat61
```

### number of reads with specific tails in each sample {.tabset}

#### WT_25
```{r}
nreads_PABPC4WT_25_bins
```

#### WT_26
```{r}
nreads_PABPC4WT_26_bins
```

#### WT_27
```{r}
nreads_PABPC4WT_27_bins
```

#### WT_28
```{r}
nreads_PABPC4WT_28_bins
```

#### WT_29
```{r}
nreads_PABPC4WT_29_bins
```

#### WT_30
```{r}
nreads_PABPC4WT_30_bins
```

#### X1KO_17
```{r}
nreads_PABPC4X1KO_17_bins
```

#### X1KO_18
```{r}
nreads_PABPC4X1KO_18_bins
```

#### X1KO_19
```{r}
nreads_PABPC4X1KO_19_bins
```

#### X1KO_20
```{r}
nreads_PABPC4X1KO_20_bins
```

#### X1KO_21
```{r}
nreads_PABPC4X1KO_21_bins
```

#### X1KO_22
```{r}
nreads_PABPC4X1KO_22_bins
```

# Percentage of tails in length range (mean) {.tabset}

## PABPC4
```{r}
xU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU1_10 = xU1_10[with(xU1_10, range == "1-10"),]
xU1_10 = xU1_10[with(xU1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU11_20 = xU11_20[with(xU11_20, range == "11-20"),]
xU11_20 = xU11_20[with(xU11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU21_30 = xU21_30[with(xU21_30, range == "21-30"),]
xU21_30 = xU21_30[with(xU21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU31_40 = xU31_40[with(xU31_40, range == "31-40"),]
xU31_40 = xU31_40[with(xU31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU41_50 = xU41_50[with(xU41_50, range == "41-50"),]
xU41_50 = xU41_50[with(xU41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU51_60 = xU51_60[with(xU51_60, range == "51-60"),]
xU51_60 = xU51_60[with(xU51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU61 = xU61[with(xU61, range == "61+"),]
xU61 = xU61[with(xU61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA1_10 = xA1_10[with(xA1_10, range == "1-10"),]
xA1_10 = xA1_10[with(xA1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA11_20 = xA11_20[with(xA11_20, range == "11-20"),]
xA11_20 = xA11_20[with(xA11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA21_30 = xA21_30[with(xA21_30, range == "21-30"),]
xA21_30 = xA21_30[with(xA21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA31_40 = xA31_40[with(xA31_40, range == "31-40"),]
xA31_40 = xA31_40[with(xA31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA41_50 = xA41_50[with(xA41_50, range == "41-50"),]
xA41_50 = xA41_50[with(xA41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA51_60 = xA51_60[with(xA51_60, range == "51-60"),]
xA51_60 = xA51_60[with(xA51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA61 = xA61[with(xA61, range == "61+"),]
xA61 = xA61[with(xA61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU1_10 = xAU1_10[with(xAU1_10, range == "1-10"),]
xAU1_10 = xAU1_10[with(xAU1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU11_20 = xAU11_20[with(xAU11_20, range == "11-20"),]
xAU11_20 = xAU11_20[with(xAU11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU21_30 = xAU21_30[with(xAU21_30, range == "21-30"),]
xAU21_30 = xAU21_30[with(xAU21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU31_40 = xAU31_40[with(xAU31_40, range == "31-40"),]
xAU31_40 = xAU31_40[with(xAU31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU41_50 = xAU41_50[with(xAU41_50, range == "41-50"),]
xAU41_50 = xAU41_50[with(xAU41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU51_60 = xAU51_60[with(xAU51_60, range == "51-60"),]
xAU51_60 = xAU51_60[with(xAU51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU61 = xAU61[with(xAU61, range == "61+"),]
xAU61 = xAU61[with(xAU61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

percent_mean_PABPC4WT <- data.frame(percent=c(mean(xU1_10$percent),mean(xU11_20$percent),mean(xU21_30$percent),mean(xU31_40$percent),mean(xU41_50$percent),mean(xU51_60$percent),mean(xU61$percent),
                                            mean(xA1_10$percent),mean(xA11_20$percent),mean(xA21_30$percent),mean(xA31_40$percent),mean(xA41_50$percent),mean(xA51_60$percent),mean(xA61$percent),
                                            mean(xAU1_10$percent),mean(xAU11_20$percent),mean(xAU21_30$percent),mean(xAU31_40$percent),mean(xAU41_50$percent),mean(xAU51_60$percent),mean(xAU61$percent)),
                               tail=c(rep("U tail",7),rep("A tail",7),rep("AU tail",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),3)),
                               sample=c(rep("WT",21)))


xU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU1_10 = xU1_10[with(xU1_10, range == "1-10"),]
xU1_10 = xU1_10[with(xU1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU11_20 = xU11_20[with(xU11_20, range == "11-20"),]
xU11_20 = xU11_20[with(xU11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU21_30 = xU21_30[with(xU21_30, range == "21-30"),]
xU21_30 = xU21_30[with(xU21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU31_40 = xU31_40[with(xU31_40, range == "31-40"),]
xU31_40 = xU31_40[with(xU31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU41_50 = xU41_50[with(xU41_50, range == "41-50"),]
xU41_50 = xU41_50[with(xU41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU51_60 = xU51_60[with(xU51_60, range == "51-60"),]
xU51_60 = xU51_60[with(xU51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU61 = xU61[with(xU61, range == "61+"),]
xU61 = xU61[with(xU61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA1_10 = xA1_10[with(xA1_10, range == "1-10"),]
xA1_10 = xA1_10[with(xA1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA11_20 = xA11_20[with(xA11_20, range == "11-20"),]
xA11_20 = xA11_20[with(xA11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA21_30 = xA21_30[with(xA21_30, range == "21-30"),]
xA21_30 = xA21_30[with(xA21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA31_40 = xA31_40[with(xA31_40, range == "31-40"),]
xA31_40 = xA31_40[with(xA31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA41_50 = xA41_50[with(xA41_50, range == "41-50"),]
xA41_50 = xA41_50[with(xA41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA51_60 = xA51_60[with(xA51_60, range == "51-60"),]
xA51_60 = xA51_60[with(xA51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA61 = xA61[with(xA61, range == "61+"),]
xA61 = xA61[with(xA61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU1_10 = xAU1_10[with(xAU1_10, range == "1-10"),]
xAU1_10 = xAU1_10[with(xAU1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU11_20 = xAU11_20[with(xAU11_20, range == "11-20"),]
xAU11_20 = xAU11_20[with(xAU11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU21_30 = xAU21_30[with(xAU21_30, range == "21-30"),]
xAU21_30 = xAU21_30[with(xAU21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU31_40 = xAU31_40[with(xAU31_40, range == "31-40"),]
xAU31_40 = xAU31_40[with(xAU31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU41_50 = xAU41_50[with(xAU41_50, range == "41-50"),]
xAU41_50 = xAU41_50[with(xAU41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU51_60 = xAU51_60[with(xAU51_60, range == "51-60"),]
xAU51_60 = xAU51_60[with(xAU51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU61 = xAU61[with(xAU61, range == "61+"),]
xAU61 = xAU61[with(xAU61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

percent_mean_PABPC4X1 <- data.frame(percent=c(mean(xU1_10$percent),mean(xU11_20$percent),mean(xU21_30$percent),mean(xU31_40$percent),mean(xU41_50$percent),mean(xU51_60$percent),mean(xU61$percent),
                                            mean(xA1_10$percent),mean(xA11_20$percent),mean(xA21_30$percent),mean(xA31_40$percent),mean(xA41_50$percent),mean(xA51_60$percent),mean(xA61$percent),
                                            mean(xAU1_10$percent),mean(xAU11_20$percent),mean(xAU21_30$percent),mean(xAU31_40$percent),mean(xAU41_50$percent),mean(xAU51_60$percent),mean(xAU61$percent)),
                               tail=c(rep("U tail",7),rep("A tail",7),rep("AU tail",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),3)),
                               sample=c(rep("X1KO",21)))


percent_mean_PABPC4 = rbind(percent_mean_PABPC4WT,percent_mean_PABPC4X1)
```

```{r fig.height=6, fig.width=7}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
ggplot(percent_mean_PABPC4, aes(fill=tail, y=percent, x=range)) + 
    geom_bar(position="fill", stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12)) +
    scale_x_discrete(limits = order) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "U tail" = "#A50F15")) +
    scale_x_discrete(limits = order)
```

# Percentage of tails in length range; filtered reads {.tabset}

If mean number of reads in group (e.g. WT) is less than 1 this reads are treated as 0

## PABPC4
```{r}
percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,1]*100/((nreads_PABPC4WT_bins[1,1])+(nreads_PABPC4WT_bins[8,1])+(nreads_PABPC4WT_bins[15,1]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,1]*100/((nreads_PABPC4WT_bins[1,1])+(nreads_PABPC4WT_bins[8,1])+(nreads_PABPC4WT_bins[15,1]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,1]*100/((nreads_PABPC4WT_bins[1,1])+(nreads_PABPC4WT_bins[8,1])+(nreads_PABPC4WT_bins[15,1]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,1]*100/((nreads_PABPC4WT_bins[2,1])+(nreads_PABPC4WT_bins[9,1])+(nreads_PABPC4WT_bins[16,1]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,1]*100/((nreads_PABPC4WT_bins[2,1])+(nreads_PABPC4WT_bins[9,1])+(nreads_PABPC4WT_bins[16,1]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,1]*100/((nreads_PABPC4WT_bins[2,1])+(nreads_PABPC4WT_bins[9,1])+(nreads_PABPC4WT_bins[16,1]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,1]*100/((nreads_PABPC4WT_bins[3,1])+(nreads_PABPC4WT_bins[10,1])+(nreads_PABPC4WT_bins[17,1]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,1]*100/((nreads_PABPC4WT_bins[3,1])+(nreads_PABPC4WT_bins[10,1])+(nreads_PABPC4WT_bins[17,1]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,1]*100/((nreads_PABPC4WT_bins[3,1])+(nreads_PABPC4WT_bins[10,1])+(nreads_PABPC4WT_bins[17,1]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,1]*100/((nreads_PABPC4WT_bins[4,1])+(nreads_PABPC4WT_bins[11,1])+(nreads_PABPC4WT_bins[18,1]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,1]*100/((nreads_PABPC4WT_bins[4,1])+(nreads_PABPC4WT_bins[11,1])+(nreads_PABPC4WT_bins[18,1]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,1]*100/((nreads_PABPC4WT_bins[4,1])+(nreads_PABPC4WT_bins[11,1])+(nreads_PABPC4WT_bins[18,1]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,1]*100/((nreads_PABPC4WT_bins[5,1])+(nreads_PABPC4WT_bins[12,1])+(nreads_PABPC4WT_bins[19,1]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,1]*100/((nreads_PABPC4WT_bins[5,1])+(nreads_PABPC4WT_bins[12,1])+(nreads_PABPC4WT_bins[19,1]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,1]*100/((nreads_PABPC4WT_bins[5,1])+(nreads_PABPC4WT_bins[12,1])+(nreads_PABPC4WT_bins[19,1]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,1]*100/((nreads_PABPC4WT_bins[6,1])+(nreads_PABPC4WT_bins[13,1])+(nreads_PABPC4WT_bins[20,1]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,1]*100/((nreads_PABPC4WT_bins[6,1])+(nreads_PABPC4WT_bins[13,1])+(nreads_PABPC4WT_bins[20,1]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,1]*100/((nreads_PABPC4WT_bins[6,1])+(nreads_PABPC4WT_bins[13,1])+(nreads_PABPC4WT_bins[20,1]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,1]*100/((nreads_PABPC4WT_bins[7,1])+(nreads_PABPC4WT_bins[14,1])+(nreads_PABPC4WT_bins[21,1]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,1]*100/((nreads_PABPC4WT_bins[7,1])+(nreads_PABPC4WT_bins[14,1])+(nreads_PABPC4WT_bins[21,1]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,1]*100/((nreads_PABPC4WT_bins[7,1])+(nreads_PABPC4WT_bins[14,1])+(nreads_PABPC4WT_bins[21,1]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_25 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_25",21)))


percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,2]*100/((nreads_PABPC4WT_bins[1,2])+(nreads_PABPC4WT_bins[8,2])+(nreads_PABPC4WT_bins[15,2]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,2]*100/((nreads_PABPC4WT_bins[1,2])+(nreads_PABPC4WT_bins[8,2])+(nreads_PABPC4WT_bins[15,2]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,2]*100/((nreads_PABPC4WT_bins[1,2])+(nreads_PABPC4WT_bins[8,2])+(nreads_PABPC4WT_bins[15,2]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,2]*100/((nreads_PABPC4WT_bins[2,2])+(nreads_PABPC4WT_bins[9,2])+(nreads_PABPC4WT_bins[16,2]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,2]*100/((nreads_PABPC4WT_bins[2,2])+(nreads_PABPC4WT_bins[9,2])+(nreads_PABPC4WT_bins[16,2]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,2]*100/((nreads_PABPC4WT_bins[2,2])+(nreads_PABPC4WT_bins[9,2])+(nreads_PABPC4WT_bins[16,2]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,2]*100/((nreads_PABPC4WT_bins[3,2])+(nreads_PABPC4WT_bins[10,2])+(nreads_PABPC4WT_bins[17,2]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,2]*100/((nreads_PABPC4WT_bins[3,2])+(nreads_PABPC4WT_bins[10,2])+(nreads_PABPC4WT_bins[17,2]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,2]*100/((nreads_PABPC4WT_bins[3,2])+(nreads_PABPC4WT_bins[10,2])+(nreads_PABPC4WT_bins[17,2]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,2]*100/((nreads_PABPC4WT_bins[4,2])+(nreads_PABPC4WT_bins[11,2])+(nreads_PABPC4WT_bins[18,2]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,2]*100/((nreads_PABPC4WT_bins[4,2])+(nreads_PABPC4WT_bins[11,2])+(nreads_PABPC4WT_bins[18,2]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,2]*100/((nreads_PABPC4WT_bins[4,2])+(nreads_PABPC4WT_bins[11,2])+(nreads_PABPC4WT_bins[18,2]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,2]*100/((nreads_PABPC4WT_bins[5,2])+(nreads_PABPC4WT_bins[12,2])+(nreads_PABPC4WT_bins[19,2]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,2]*100/((nreads_PABPC4WT_bins[5,2])+(nreads_PABPC4WT_bins[12,2])+(nreads_PABPC4WT_bins[19,2]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,2]*100/((nreads_PABPC4WT_bins[5,2])+(nreads_PABPC4WT_bins[12,2])+(nreads_PABPC4WT_bins[19,2]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,2]*100/((nreads_PABPC4WT_bins[6,2])+(nreads_PABPC4WT_bins[13,2])+(nreads_PABPC4WT_bins[20,2]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,2]*100/((nreads_PABPC4WT_bins[6,2])+(nreads_PABPC4WT_bins[13,2])+(nreads_PABPC4WT_bins[20,2]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,2]*100/((nreads_PABPC4WT_bins[6,2])+(nreads_PABPC4WT_bins[13,2])+(nreads_PABPC4WT_bins[20,2]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,2]*100/((nreads_PABPC4WT_bins[7,2])+(nreads_PABPC4WT_bins[14,2])+(nreads_PABPC4WT_bins[21,2]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,2]*100/((nreads_PABPC4WT_bins[7,2])+(nreads_PABPC4WT_bins[14,2])+(nreads_PABPC4WT_bins[21,2]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,2]*100/((nreads_PABPC4WT_bins[7,2])+(nreads_PABPC4WT_bins[14,2])+(nreads_PABPC4WT_bins[21,2]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_26 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_26",21)))


percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,3]*100/((nreads_PABPC4WT_bins[1,3])+(nreads_PABPC4WT_bins[8,3])+(nreads_PABPC4WT_bins[15,3]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,3]*100/((nreads_PABPC4WT_bins[1,3])+(nreads_PABPC4WT_bins[8,3])+(nreads_PABPC4WT_bins[15,3]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,3]*100/((nreads_PABPC4WT_bins[1,3])+(nreads_PABPC4WT_bins[8,3])+(nreads_PABPC4WT_bins[15,3]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,3]*100/((nreads_PABPC4WT_bins[2,3])+(nreads_PABPC4WT_bins[9,3])+(nreads_PABPC4WT_bins[16,3]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,3]*100/((nreads_PABPC4WT_bins[2,3])+(nreads_PABPC4WT_bins[9,3])+(nreads_PABPC4WT_bins[16,3]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,3]*100/((nreads_PABPC4WT_bins[2,3])+(nreads_PABPC4WT_bins[9,3])+(nreads_PABPC4WT_bins[16,3]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,3]*100/((nreads_PABPC4WT_bins[3,3])+(nreads_PABPC4WT_bins[10,3])+(nreads_PABPC4WT_bins[17,3]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,3]*100/((nreads_PABPC4WT_bins[3,3])+(nreads_PABPC4WT_bins[10,3])+(nreads_PABPC4WT_bins[17,3]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,3]*100/((nreads_PABPC4WT_bins[3,3])+(nreads_PABPC4WT_bins[10,3])+(nreads_PABPC4WT_bins[17,3]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,3]*100/((nreads_PABPC4WT_bins[4,3])+(nreads_PABPC4WT_bins[11,3])+(nreads_PABPC4WT_bins[18,3]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,3]*100/((nreads_PABPC4WT_bins[4,3])+(nreads_PABPC4WT_bins[11,3])+(nreads_PABPC4WT_bins[18,3]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,3]*100/((nreads_PABPC4WT_bins[4,3])+(nreads_PABPC4WT_bins[11,3])+(nreads_PABPC4WT_bins[18,3]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,3]*100/((nreads_PABPC4WT_bins[5,3])+(nreads_PABPC4WT_bins[12,3])+(nreads_PABPC4WT_bins[19,3]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,3]*100/((nreads_PABPC4WT_bins[5,3])+(nreads_PABPC4WT_bins[12,3])+(nreads_PABPC4WT_bins[19,3]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,3]*100/((nreads_PABPC4WT_bins[5,3])+(nreads_PABPC4WT_bins[12,3])+(nreads_PABPC4WT_bins[19,3]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,3]*100/((nreads_PABPC4WT_bins[6,3])+(nreads_PABPC4WT_bins[13,3])+(nreads_PABPC4WT_bins[20,3]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,3]*100/((nreads_PABPC4WT_bins[6,3])+(nreads_PABPC4WT_bins[13,3])+(nreads_PABPC4WT_bins[20,3]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,3]*100/((nreads_PABPC4WT_bins[6,3])+(nreads_PABPC4WT_bins[13,3])+(nreads_PABPC4WT_bins[20,3]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,3]*100/((nreads_PABPC4WT_bins[7,3])+(nreads_PABPC4WT_bins[14,3])+(nreads_PABPC4WT_bins[21,3]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,3]*100/((nreads_PABPC4WT_bins[7,3])+(nreads_PABPC4WT_bins[14,3])+(nreads_PABPC4WT_bins[21,3]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,3]*100/((nreads_PABPC4WT_bins[7,3])+(nreads_PABPC4WT_bins[14,3])+(nreads_PABPC4WT_bins[21,3]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_27 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_27",21)))

percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,4]*100/((nreads_PABPC4WT_bins[1,4])+(nreads_PABPC4WT_bins[8,4])+(nreads_PABPC4WT_bins[15,4]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,4]*100/((nreads_PABPC4WT_bins[1,4])+(nreads_PABPC4WT_bins[8,4])+(nreads_PABPC4WT_bins[15,4]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,4]*100/((nreads_PABPC4WT_bins[1,4])+(nreads_PABPC4WT_bins[8,4])+(nreads_PABPC4WT_bins[15,4]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,4]*100/((nreads_PABPC4WT_bins[2,4])+(nreads_PABPC4WT_bins[9,4])+(nreads_PABPC4WT_bins[16,4]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,4]*100/((nreads_PABPC4WT_bins[2,4])+(nreads_PABPC4WT_bins[9,4])+(nreads_PABPC4WT_bins[16,4]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,4]*100/((nreads_PABPC4WT_bins[2,4])+(nreads_PABPC4WT_bins[9,4])+(nreads_PABPC4WT_bins[16,4]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,4]*100/((nreads_PABPC4WT_bins[3,4])+(nreads_PABPC4WT_bins[10,4])+(nreads_PABPC4WT_bins[17,4]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,4]*100/((nreads_PABPC4WT_bins[3,4])+(nreads_PABPC4WT_bins[10,4])+(nreads_PABPC4WT_bins[17,4]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,4]*100/((nreads_PABPC4WT_bins[3,4])+(nreads_PABPC4WT_bins[10,4])+(nreads_PABPC4WT_bins[17,4]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,4]*100/((nreads_PABPC4WT_bins[4,4])+(nreads_PABPC4WT_bins[11,4])+(nreads_PABPC4WT_bins[18,4]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,4]*100/((nreads_PABPC4WT_bins[4,4])+(nreads_PABPC4WT_bins[11,4])+(nreads_PABPC4WT_bins[18,4]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,4]*100/((nreads_PABPC4WT_bins[4,4])+(nreads_PABPC4WT_bins[11,4])+(nreads_PABPC4WT_bins[18,4]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,4]*100/((nreads_PABPC4WT_bins[5,4])+(nreads_PABPC4WT_bins[12,4])+(nreads_PABPC4WT_bins[19,4]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,4]*100/((nreads_PABPC4WT_bins[5,4])+(nreads_PABPC4WT_bins[12,4])+(nreads_PABPC4WT_bins[19,4]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,4]*100/((nreads_PABPC4WT_bins[5,4])+(nreads_PABPC4WT_bins[12,4])+(nreads_PABPC4WT_bins[19,4]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,4]*100/((nreads_PABPC4WT_bins[6,4])+(nreads_PABPC4WT_bins[13,4])+(nreads_PABPC4WT_bins[20,4]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,4]*100/((nreads_PABPC4WT_bins[6,4])+(nreads_PABPC4WT_bins[13,4])+(nreads_PABPC4WT_bins[20,4]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,4]*100/((nreads_PABPC4WT_bins[6,4])+(nreads_PABPC4WT_bins[13,4])+(nreads_PABPC4WT_bins[20,4]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,4]*100/((nreads_PABPC4WT_bins[7,4])+(nreads_PABPC4WT_bins[14,4])+(nreads_PABPC4WT_bins[21,4]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,4]*100/((nreads_PABPC4WT_bins[7,4])+(nreads_PABPC4WT_bins[14,4])+(nreads_PABPC4WT_bins[21,4]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,4]*100/((nreads_PABPC4WT_bins[7,4])+(nreads_PABPC4WT_bins[14,4])+(nreads_PABPC4WT_bins[21,4]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_28 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_28",21)))

percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,5]*100/((nreads_PABPC4WT_bins[1,5])+(nreads_PABPC4WT_bins[8,5])+(nreads_PABPC4WT_bins[15,5]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,5]*100/((nreads_PABPC4WT_bins[1,5])+(nreads_PABPC4WT_bins[8,5])+(nreads_PABPC4WT_bins[15,5]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,5]*100/((nreads_PABPC4WT_bins[1,5])+(nreads_PABPC4WT_bins[8,5])+(nreads_PABPC4WT_bins[15,5]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,5]*100/((nreads_PABPC4WT_bins[2,5])+(nreads_PABPC4WT_bins[9,5])+(nreads_PABPC4WT_bins[16,5]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,5]*100/((nreads_PABPC4WT_bins[2,5])+(nreads_PABPC4WT_bins[9,5])+(nreads_PABPC4WT_bins[16,5]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,5]*100/((nreads_PABPC4WT_bins[2,5])+(nreads_PABPC4WT_bins[9,5])+(nreads_PABPC4WT_bins[16,5]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,5]*100/((nreads_PABPC4WT_bins[3,5])+(nreads_PABPC4WT_bins[10,5])+(nreads_PABPC4WT_bins[17,5]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,5]*100/((nreads_PABPC4WT_bins[3,5])+(nreads_PABPC4WT_bins[10,5])+(nreads_PABPC4WT_bins[17,5]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,5]*100/((nreads_PABPC4WT_bins[3,5])+(nreads_PABPC4WT_bins[10,5])+(nreads_PABPC4WT_bins[17,5]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,5]*100/((nreads_PABPC4WT_bins[4,5])+(nreads_PABPC4WT_bins[11,5])+(nreads_PABPC4WT_bins[18,5]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,5]*100/((nreads_PABPC4WT_bins[4,5])+(nreads_PABPC4WT_bins[11,5])+(nreads_PABPC4WT_bins[18,5]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,5]*100/((nreads_PABPC4WT_bins[4,5])+(nreads_PABPC4WT_bins[11,5])+(nreads_PABPC4WT_bins[18,5]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,5]*100/((nreads_PABPC4WT_bins[5,5])+(nreads_PABPC4WT_bins[12,5])+(nreads_PABPC4WT_bins[19,5]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,5]*100/((nreads_PABPC4WT_bins[5,5])+(nreads_PABPC4WT_bins[12,5])+(nreads_PABPC4WT_bins[19,5]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,5]*100/((nreads_PABPC4WT_bins[5,5])+(nreads_PABPC4WT_bins[12,5])+(nreads_PABPC4WT_bins[19,5]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,5]*100/((nreads_PABPC4WT_bins[6,5])+(nreads_PABPC4WT_bins[13,5])+(nreads_PABPC4WT_bins[20,5]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,5]*100/((nreads_PABPC4WT_bins[6,5])+(nreads_PABPC4WT_bins[13,5])+(nreads_PABPC4WT_bins[20,5]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,5]*100/((nreads_PABPC4WT_bins[6,5])+(nreads_PABPC4WT_bins[13,5])+(nreads_PABPC4WT_bins[20,5]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,5]*100/((nreads_PABPC4WT_bins[7,5])+(nreads_PABPC4WT_bins[14,5])+(nreads_PABPC4WT_bins[21,5]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,5]*100/((nreads_PABPC4WT_bins[7,5])+(nreads_PABPC4WT_bins[14,5])+(nreads_PABPC4WT_bins[21,5]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,5]*100/((nreads_PABPC4WT_bins[7,5])+(nreads_PABPC4WT_bins[14,5])+(nreads_PABPC4WT_bins[21,5]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_29 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_29",21)))

percent_poliU_1_10 <- nreads_PABPC4WT_bins[15,6]*100/((nreads_PABPC4WT_bins[1,6])+(nreads_PABPC4WT_bins[8,6])+(nreads_PABPC4WT_bins[15,6]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4WT_bins[1,6]*100/((nreads_PABPC4WT_bins[1,6])+(nreads_PABPC4WT_bins[8,6])+(nreads_PABPC4WT_bins[15,6]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4WT_bins[8,6]*100/((nreads_PABPC4WT_bins[1,6])+(nreads_PABPC4WT_bins[8,6])+(nreads_PABPC4WT_bins[15,6]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4WT_bins[16,6]*100/((nreads_PABPC4WT_bins[2,6])+(nreads_PABPC4WT_bins[9,6])+(nreads_PABPC4WT_bins[16,6]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4WT_bins[2,6]*100/((nreads_PABPC4WT_bins[2,6])+(nreads_PABPC4WT_bins[9,6])+(nreads_PABPC4WT_bins[16,6]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4WT_bins[9,6]*100/((nreads_PABPC4WT_bins[2,6])+(nreads_PABPC4WT_bins[9,6])+(nreads_PABPC4WT_bins[16,6]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4WT_bins[17,6]*100/((nreads_PABPC4WT_bins[3,6])+(nreads_PABPC4WT_bins[10,6])+(nreads_PABPC4WT_bins[17,6]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4WT_bins[3,6]*100/((nreads_PABPC4WT_bins[3,6])+(nreads_PABPC4WT_bins[10,6])+(nreads_PABPC4WT_bins[17,6]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4WT_bins[10,6]*100/((nreads_PABPC4WT_bins[3,6])+(nreads_PABPC4WT_bins[10,6])+(nreads_PABPC4WT_bins[17,6]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4WT_bins[18,6]*100/((nreads_PABPC4WT_bins[4,6])+(nreads_PABPC4WT_bins[11,6])+(nreads_PABPC4WT_bins[18,6]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4WT_bins[4,6]*100/((nreads_PABPC4WT_bins[4,6])+(nreads_PABPC4WT_bins[11,6])+(nreads_PABPC4WT_bins[18,6]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4WT_bins[11,6]*100/((nreads_PABPC4WT_bins[4,6])+(nreads_PABPC4WT_bins[11,6])+(nreads_PABPC4WT_bins[18,6]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4WT_bins[19,6]*100/((nreads_PABPC4WT_bins[5,6])+(nreads_PABPC4WT_bins[12,6])+(nreads_PABPC4WT_bins[19,6]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4WT_bins[5,6]*100/((nreads_PABPC4WT_bins[5,6])+(nreads_PABPC4WT_bins[12,6])+(nreads_PABPC4WT_bins[19,6]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4WT_bins[12,6]*100/((nreads_PABPC4WT_bins[5,6])+(nreads_PABPC4WT_bins[12,6])+(nreads_PABPC4WT_bins[19,6]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4WT_bins[20,6]*100/((nreads_PABPC4WT_bins[6,6])+(nreads_PABPC4WT_bins[13,6])+(nreads_PABPC4WT_bins[20,6]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4WT_bins[6,6]*100/((nreads_PABPC4WT_bins[6,6])+(nreads_PABPC4WT_bins[13,6])+(nreads_PABPC4WT_bins[20,6]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4WT_bins[13,6]*100/((nreads_PABPC4WT_bins[6,6])+(nreads_PABPC4WT_bins[13,6])+(nreads_PABPC4WT_bins[20,6]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4WT_bins[21,6]*100/((nreads_PABPC4WT_bins[7,6])+(nreads_PABPC4WT_bins[14,6])+(nreads_PABPC4WT_bins[21,6]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4WT_bins[7,6]*100/((nreads_PABPC4WT_bins[7,6])+(nreads_PABPC4WT_bins[14,6])+(nreads_PABPC4WT_bins[21,6]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4WT_bins[14,6]*100/((nreads_PABPC4WT_bins[7,6])+(nreads_PABPC4WT_bins[14,6])+(nreads_PABPC4WT_bins[21,6]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4WT_30 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("WT_30",21)))


percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,1]*100/((nreads_PABPC4X1_bins[1,1])+(nreads_PABPC4X1_bins[8,1])+(nreads_PABPC4X1_bins[15,1]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,1]*100/((nreads_PABPC4X1_bins[1,1])+(nreads_PABPC4X1_bins[8,1])+(nreads_PABPC4X1_bins[15,1]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,1]*100/((nreads_PABPC4X1_bins[1,1])+(nreads_PABPC4X1_bins[8,1])+(nreads_PABPC4X1_bins[15,1]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,1]*100/((nreads_PABPC4X1_bins[2,1])+(nreads_PABPC4X1_bins[9,1])+(nreads_PABPC4X1_bins[16,1]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,1]*100/((nreads_PABPC4X1_bins[2,1])+(nreads_PABPC4X1_bins[9,1])+(nreads_PABPC4X1_bins[16,1]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,1]*100/((nreads_PABPC4X1_bins[2,1])+(nreads_PABPC4X1_bins[9,1])+(nreads_PABPC4X1_bins[16,1]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,1]*100/((nreads_PABPC4X1_bins[3,1])+(nreads_PABPC4X1_bins[10,1])+(nreads_PABPC4X1_bins[17,1]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,1]*100/((nreads_PABPC4X1_bins[3,1])+(nreads_PABPC4X1_bins[10,1])+(nreads_PABPC4X1_bins[17,1]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,1]*100/((nreads_PABPC4X1_bins[3,1])+(nreads_PABPC4X1_bins[10,1])+(nreads_PABPC4X1_bins[17,1]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,1]*100/((nreads_PABPC4X1_bins[4,1])+(nreads_PABPC4X1_bins[11,1])+(nreads_PABPC4X1_bins[18,1]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,1]*100/((nreads_PABPC4X1_bins[4,1])+(nreads_PABPC4X1_bins[11,1])+(nreads_PABPC4X1_bins[18,1]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,1]*100/((nreads_PABPC4X1_bins[4,1])+(nreads_PABPC4X1_bins[11,1])+(nreads_PABPC4X1_bins[18,1]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,1]*100/((nreads_PABPC4X1_bins[5,1])+(nreads_PABPC4X1_bins[12,1])+(nreads_PABPC4X1_bins[19,1]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,1]*100/((nreads_PABPC4X1_bins[5,1])+(nreads_PABPC4X1_bins[12,1])+(nreads_PABPC4X1_bins[19,1]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,1]*100/((nreads_PABPC4X1_bins[5,1])+(nreads_PABPC4X1_bins[12,1])+(nreads_PABPC4X1_bins[19,1]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,1]*100/((nreads_PABPC4X1_bins[6,1])+(nreads_PABPC4X1_bins[13,1])+(nreads_PABPC4X1_bins[20,1]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,1]*100/((nreads_PABPC4X1_bins[6,1])+(nreads_PABPC4X1_bins[13,1])+(nreads_PABPC4X1_bins[20,1]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,1]*100/((nreads_PABPC4X1_bins[6,1])+(nreads_PABPC4X1_bins[13,1])+(nreads_PABPC4X1_bins[20,1]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,1]*100/((nreads_PABPC4X1_bins[7,1])+(nreads_PABPC4X1_bins[14,1])+(nreads_PABPC4X1_bins[21,1]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,1]*100/((nreads_PABPC4X1_bins[7,1])+(nreads_PABPC4X1_bins[14,1])+(nreads_PABPC4X1_bins[21,1]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,1]*100/((nreads_PABPC4X1_bins[7,1])+(nreads_PABPC4X1_bins[14,1])+(nreads_PABPC4X1_bins[21,1]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_17 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_17",21)))


percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,2]*100/((nreads_PABPC4X1_bins[1,2])+(nreads_PABPC4X1_bins[8,2])+(nreads_PABPC4X1_bins[15,2]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,2]*100/((nreads_PABPC4X1_bins[1,2])+(nreads_PABPC4X1_bins[8,2])+(nreads_PABPC4X1_bins[15,2]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,2]*100/((nreads_PABPC4X1_bins[1,2])+(nreads_PABPC4X1_bins[8,2])+(nreads_PABPC4X1_bins[15,2]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,2]*100/((nreads_PABPC4X1_bins[2,2])+(nreads_PABPC4X1_bins[9,2])+(nreads_PABPC4X1_bins[16,2]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,2]*100/((nreads_PABPC4X1_bins[2,2])+(nreads_PABPC4X1_bins[9,2])+(nreads_PABPC4X1_bins[16,2]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,2]*100/((nreads_PABPC4X1_bins[2,2])+(nreads_PABPC4X1_bins[9,2])+(nreads_PABPC4X1_bins[16,2]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,2]*100/((nreads_PABPC4X1_bins[3,2])+(nreads_PABPC4X1_bins[10,2])+(nreads_PABPC4X1_bins[17,2]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,2]*100/((nreads_PABPC4X1_bins[3,2])+(nreads_PABPC4X1_bins[10,2])+(nreads_PABPC4X1_bins[17,2]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,2]*100/((nreads_PABPC4X1_bins[3,2])+(nreads_PABPC4X1_bins[10,2])+(nreads_PABPC4X1_bins[17,2]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,2]*100/((nreads_PABPC4X1_bins[4,2])+(nreads_PABPC4X1_bins[11,2])+(nreads_PABPC4X1_bins[18,2]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,2]*100/((nreads_PABPC4X1_bins[4,2])+(nreads_PABPC4X1_bins[11,2])+(nreads_PABPC4X1_bins[18,2]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,2]*100/((nreads_PABPC4X1_bins[4,2])+(nreads_PABPC4X1_bins[11,2])+(nreads_PABPC4X1_bins[18,2]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,2]*100/((nreads_PABPC4X1_bins[5,2])+(nreads_PABPC4X1_bins[12,2])+(nreads_PABPC4X1_bins[19,2]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,2]*100/((nreads_PABPC4X1_bins[5,2])+(nreads_PABPC4X1_bins[12,2])+(nreads_PABPC4X1_bins[19,2]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,2]*100/((nreads_PABPC4X1_bins[5,2])+(nreads_PABPC4X1_bins[12,2])+(nreads_PABPC4X1_bins[19,2]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,2]*100/((nreads_PABPC4X1_bins[6,2])+(nreads_PABPC4X1_bins[13,2])+(nreads_PABPC4X1_bins[20,2]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,2]*100/((nreads_PABPC4X1_bins[6,2])+(nreads_PABPC4X1_bins[13,2])+(nreads_PABPC4X1_bins[20,2]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,2]*100/((nreads_PABPC4X1_bins[6,2])+(nreads_PABPC4X1_bins[13,2])+(nreads_PABPC4X1_bins[20,2]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,2]*100/((nreads_PABPC4X1_bins[7,2])+(nreads_PABPC4X1_bins[14,2])+(nreads_PABPC4X1_bins[21,2]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,2]*100/((nreads_PABPC4X1_bins[7,2])+(nreads_PABPC4X1_bins[14,2])+(nreads_PABPC4X1_bins[21,2]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,2]*100/((nreads_PABPC4X1_bins[7,2])+(nreads_PABPC4X1_bins[14,2])+(nreads_PABPC4X1_bins[21,2]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_18 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_18",21)))


percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,3]*100/((nreads_PABPC4X1_bins[1,3])+(nreads_PABPC4X1_bins[8,3])+(nreads_PABPC4X1_bins[15,3]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,3]*100/((nreads_PABPC4X1_bins[1,3])+(nreads_PABPC4X1_bins[8,3])+(nreads_PABPC4X1_bins[15,3]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,3]*100/((nreads_PABPC4X1_bins[1,3])+(nreads_PABPC4X1_bins[8,3])+(nreads_PABPC4X1_bins[15,3]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,3]*100/((nreads_PABPC4X1_bins[2,3])+(nreads_PABPC4X1_bins[9,3])+(nreads_PABPC4X1_bins[16,3]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,3]*100/((nreads_PABPC4X1_bins[2,3])+(nreads_PABPC4X1_bins[9,3])+(nreads_PABPC4X1_bins[16,3]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,3]*100/((nreads_PABPC4X1_bins[2,3])+(nreads_PABPC4X1_bins[9,3])+(nreads_PABPC4X1_bins[16,3]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,3]*100/((nreads_PABPC4X1_bins[3,3])+(nreads_PABPC4X1_bins[10,3])+(nreads_PABPC4X1_bins[17,3]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,3]*100/((nreads_PABPC4X1_bins[3,3])+(nreads_PABPC4X1_bins[10,3])+(nreads_PABPC4X1_bins[17,3]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,3]*100/((nreads_PABPC4X1_bins[3,3])+(nreads_PABPC4X1_bins[10,3])+(nreads_PABPC4X1_bins[17,3]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,3]*100/((nreads_PABPC4X1_bins[4,3])+(nreads_PABPC4X1_bins[11,3])+(nreads_PABPC4X1_bins[18,3]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,3]*100/((nreads_PABPC4X1_bins[4,3])+(nreads_PABPC4X1_bins[11,3])+(nreads_PABPC4X1_bins[18,3]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,3]*100/((nreads_PABPC4X1_bins[4,3])+(nreads_PABPC4X1_bins[11,3])+(nreads_PABPC4X1_bins[18,3]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,3]*100/((nreads_PABPC4X1_bins[5,3])+(nreads_PABPC4X1_bins[12,3])+(nreads_PABPC4X1_bins[19,3]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,3]*100/((nreads_PABPC4X1_bins[5,3])+(nreads_PABPC4X1_bins[12,3])+(nreads_PABPC4X1_bins[19,3]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,3]*100/((nreads_PABPC4X1_bins[5,3])+(nreads_PABPC4X1_bins[12,3])+(nreads_PABPC4X1_bins[19,3]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,3]*100/((nreads_PABPC4X1_bins[6,3])+(nreads_PABPC4X1_bins[13,3])+(nreads_PABPC4X1_bins[20,3]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,3]*100/((nreads_PABPC4X1_bins[6,3])+(nreads_PABPC4X1_bins[13,3])+(nreads_PABPC4X1_bins[20,3]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,3]*100/((nreads_PABPC4X1_bins[6,3])+(nreads_PABPC4X1_bins[13,3])+(nreads_PABPC4X1_bins[20,3]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,3]*100/((nreads_PABPC4X1_bins[7,3])+(nreads_PABPC4X1_bins[14,3])+(nreads_PABPC4X1_bins[21,3]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,3]*100/((nreads_PABPC4X1_bins[7,3])+(nreads_PABPC4X1_bins[14,3])+(nreads_PABPC4X1_bins[21,3]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,3]*100/((nreads_PABPC4X1_bins[7,3])+(nreads_PABPC4X1_bins[14,3])+(nreads_PABPC4X1_bins[21,3]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_19 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_19",21)))

percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,4]*100/((nreads_PABPC4X1_bins[1,4])+(nreads_PABPC4X1_bins[8,4])+(nreads_PABPC4X1_bins[15,4]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,4]*100/((nreads_PABPC4X1_bins[1,4])+(nreads_PABPC4X1_bins[8,4])+(nreads_PABPC4X1_bins[15,4]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,4]*100/((nreads_PABPC4X1_bins[1,4])+(nreads_PABPC4X1_bins[8,4])+(nreads_PABPC4X1_bins[15,4]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,4]*100/((nreads_PABPC4X1_bins[2,4])+(nreads_PABPC4X1_bins[9,4])+(nreads_PABPC4X1_bins[16,4]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,4]*100/((nreads_PABPC4X1_bins[2,4])+(nreads_PABPC4X1_bins[9,4])+(nreads_PABPC4X1_bins[16,4]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,4]*100/((nreads_PABPC4X1_bins[2,4])+(nreads_PABPC4X1_bins[9,4])+(nreads_PABPC4X1_bins[16,4]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,4]*100/((nreads_PABPC4X1_bins[3,4])+(nreads_PABPC4X1_bins[10,4])+(nreads_PABPC4X1_bins[17,4]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,4]*100/((nreads_PABPC4X1_bins[3,4])+(nreads_PABPC4X1_bins[10,4])+(nreads_PABPC4X1_bins[17,4]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,4]*100/((nreads_PABPC4X1_bins[3,4])+(nreads_PABPC4X1_bins[10,4])+(nreads_PABPC4X1_bins[17,4]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,4]*100/((nreads_PABPC4X1_bins[4,4])+(nreads_PABPC4X1_bins[11,4])+(nreads_PABPC4X1_bins[18,4]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,4]*100/((nreads_PABPC4X1_bins[4,4])+(nreads_PABPC4X1_bins[11,4])+(nreads_PABPC4X1_bins[18,4]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,4]*100/((nreads_PABPC4X1_bins[4,4])+(nreads_PABPC4X1_bins[11,4])+(nreads_PABPC4X1_bins[18,4]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,4]*100/((nreads_PABPC4X1_bins[5,4])+(nreads_PABPC4X1_bins[12,4])+(nreads_PABPC4X1_bins[19,4]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,4]*100/((nreads_PABPC4X1_bins[5,4])+(nreads_PABPC4X1_bins[12,4])+(nreads_PABPC4X1_bins[19,4]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,4]*100/((nreads_PABPC4X1_bins[5,4])+(nreads_PABPC4X1_bins[12,4])+(nreads_PABPC4X1_bins[19,4]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,4]*100/((nreads_PABPC4X1_bins[6,4])+(nreads_PABPC4X1_bins[13,4])+(nreads_PABPC4X1_bins[20,4]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,4]*100/((nreads_PABPC4X1_bins[6,4])+(nreads_PABPC4X1_bins[13,4])+(nreads_PABPC4X1_bins[20,4]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,4]*100/((nreads_PABPC4X1_bins[6,4])+(nreads_PABPC4X1_bins[13,4])+(nreads_PABPC4X1_bins[20,4]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,4]*100/((nreads_PABPC4X1_bins[7,4])+(nreads_PABPC4X1_bins[14,4])+(nreads_PABPC4X1_bins[21,4]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,4]*100/((nreads_PABPC4X1_bins[7,4])+(nreads_PABPC4X1_bins[14,4])+(nreads_PABPC4X1_bins[21,4]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,4]*100/((nreads_PABPC4X1_bins[7,4])+(nreads_PABPC4X1_bins[14,4])+(nreads_PABPC4X1_bins[21,4]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_20 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_20",21)))

percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,5]*100/((nreads_PABPC4X1_bins[1,5])+(nreads_PABPC4X1_bins[8,5])+(nreads_PABPC4X1_bins[15,5]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,5]*100/((nreads_PABPC4X1_bins[1,5])+(nreads_PABPC4X1_bins[8,5])+(nreads_PABPC4X1_bins[15,5]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,5]*100/((nreads_PABPC4X1_bins[1,5])+(nreads_PABPC4X1_bins[8,5])+(nreads_PABPC4X1_bins[15,5]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,5]*100/((nreads_PABPC4X1_bins[2,5])+(nreads_PABPC4X1_bins[9,5])+(nreads_PABPC4X1_bins[16,5]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,5]*100/((nreads_PABPC4X1_bins[2,5])+(nreads_PABPC4X1_bins[9,5])+(nreads_PABPC4X1_bins[16,5]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,5]*100/((nreads_PABPC4X1_bins[2,5])+(nreads_PABPC4X1_bins[9,5])+(nreads_PABPC4X1_bins[16,5]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,5]*100/((nreads_PABPC4X1_bins[3,5])+(nreads_PABPC4X1_bins[10,5])+(nreads_PABPC4X1_bins[17,5]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,5]*100/((nreads_PABPC4X1_bins[3,5])+(nreads_PABPC4X1_bins[10,5])+(nreads_PABPC4X1_bins[17,5]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,5]*100/((nreads_PABPC4X1_bins[3,5])+(nreads_PABPC4X1_bins[10,5])+(nreads_PABPC4X1_bins[17,5]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,5]*100/((nreads_PABPC4X1_bins[4,5])+(nreads_PABPC4X1_bins[11,5])+(nreads_PABPC4X1_bins[18,5]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,5]*100/((nreads_PABPC4X1_bins[4,5])+(nreads_PABPC4X1_bins[11,5])+(nreads_PABPC4X1_bins[18,5]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,5]*100/((nreads_PABPC4X1_bins[4,5])+(nreads_PABPC4X1_bins[11,5])+(nreads_PABPC4X1_bins[18,5]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,5]*100/((nreads_PABPC4X1_bins[5,5])+(nreads_PABPC4X1_bins[12,5])+(nreads_PABPC4X1_bins[19,5]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,5]*100/((nreads_PABPC4X1_bins[5,5])+(nreads_PABPC4X1_bins[12,5])+(nreads_PABPC4X1_bins[19,5]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,5]*100/((nreads_PABPC4X1_bins[5,5])+(nreads_PABPC4X1_bins[12,5])+(nreads_PABPC4X1_bins[19,5]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,5]*100/((nreads_PABPC4X1_bins[6,5])+(nreads_PABPC4X1_bins[13,5])+(nreads_PABPC4X1_bins[20,5]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,5]*100/((nreads_PABPC4X1_bins[6,5])+(nreads_PABPC4X1_bins[13,5])+(nreads_PABPC4X1_bins[20,5]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,5]*100/((nreads_PABPC4X1_bins[6,5])+(nreads_PABPC4X1_bins[13,5])+(nreads_PABPC4X1_bins[20,5]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,5]*100/((nreads_PABPC4X1_bins[7,5])+(nreads_PABPC4X1_bins[14,5])+(nreads_PABPC4X1_bins[21,5]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,5]*100/((nreads_PABPC4X1_bins[7,5])+(nreads_PABPC4X1_bins[14,5])+(nreads_PABPC4X1_bins[21,5]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,5]*100/((nreads_PABPC4X1_bins[7,5])+(nreads_PABPC4X1_bins[14,5])+(nreads_PABPC4X1_bins[21,5]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_21 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_21",21)))

percent_poliU_1_10 <- nreads_PABPC4X1_bins[15,6]*100/((nreads_PABPC4X1_bins[1,6])+(nreads_PABPC4X1_bins[8,6])+(nreads_PABPC4X1_bins[15,6]))
percent_poliU_1_10[is.na(percent_poliU_1_10)] <- 0
percent_poliA_1_10 <- nreads_PABPC4X1_bins[1,6]*100/((nreads_PABPC4X1_bins[1,6])+(nreads_PABPC4X1_bins[8,6])+(nreads_PABPC4X1_bins[15,6]))
percent_poliA_1_10[is.na(percent_poliA_1_10)] <- 0
percent_poliAU_1_10 <- nreads_PABPC4X1_bins[8,6]*100/((nreads_PABPC4X1_bins[1,6])+(nreads_PABPC4X1_bins[8,6])+(nreads_PABPC4X1_bins[15,6]))
percent_poliAU_1_10[is.na(percent_poliAU_1_10)] <- 0

percent_poliU_11_20 <- nreads_PABPC4X1_bins[16,6]*100/((nreads_PABPC4X1_bins[2,6])+(nreads_PABPC4X1_bins[9,6])+(nreads_PABPC4X1_bins[16,6]))
percent_poliU_11_20[is.na(percent_poliU_11_20)] <- 0
percent_poliA_11_20 <- nreads_PABPC4X1_bins[2,6]*100/((nreads_PABPC4X1_bins[2,6])+(nreads_PABPC4X1_bins[9,6])+(nreads_PABPC4X1_bins[16,6]))
percent_poliA_11_20[is.na(percent_poliA_11_20)] <- 0
percent_poliAU_11_20 <- nreads_PABPC4X1_bins[9,6]*100/((nreads_PABPC4X1_bins[2,6])+(nreads_PABPC4X1_bins[9,6])+(nreads_PABPC4X1_bins[16,6]))
percent_poliAU_11_20[is.na(percent_poliAU_11_20)] <- 0

percent_poliU_21_30 <- nreads_PABPC4X1_bins[17,6]*100/((nreads_PABPC4X1_bins[3,6])+(nreads_PABPC4X1_bins[10,6])+(nreads_PABPC4X1_bins[17,6]))
percent_poliU_21_30[is.na(percent_poliU_21_30)] <- 0
percent_poliA_21_30 <- nreads_PABPC4X1_bins[3,6]*100/((nreads_PABPC4X1_bins[3,6])+(nreads_PABPC4X1_bins[10,6])+(nreads_PABPC4X1_bins[17,6]))
percent_poliA_21_30[is.na(percent_poliA_21_30)] <- 0
percent_poliAU_21_30 <- nreads_PABPC4X1_bins[10,6]*100/((nreads_PABPC4X1_bins[3,6])+(nreads_PABPC4X1_bins[10,6])+(nreads_PABPC4X1_bins[17,6]))
percent_poliAU_21_30[is.na(percent_poliAU_21_30)] <- 0

percent_poliU_31_40 <- nreads_PABPC4X1_bins[18,6]*100/((nreads_PABPC4X1_bins[4,6])+(nreads_PABPC4X1_bins[11,6])+(nreads_PABPC4X1_bins[18,6]))
percent_poliU_31_40[is.na(percent_poliU_31_40)] <- 0
percent_poliA_31_40 <- nreads_PABPC4X1_bins[4,6]*100/((nreads_PABPC4X1_bins[4,6])+(nreads_PABPC4X1_bins[11,6])+(nreads_PABPC4X1_bins[18,6]))
percent_poliA_31_40[is.na(percent_poliA_31_40)] <- 0
percent_poliAU_31_40 <- nreads_PABPC4X1_bins[11,6]*100/((nreads_PABPC4X1_bins[4,6])+(nreads_PABPC4X1_bins[11,6])+(nreads_PABPC4X1_bins[18,6]))
percent_poliAU_31_40[is.na(percent_poliAU_31_40)] <- 0

percent_poliU_41_50 <- nreads_PABPC4X1_bins[19,6]*100/((nreads_PABPC4X1_bins[5,6])+(nreads_PABPC4X1_bins[12,6])+(nreads_PABPC4X1_bins[19,6]))
percent_poliU_41_50[is.na(percent_poliU_41_50)] <- 0
percent_poliA_41_50 <- nreads_PABPC4X1_bins[5,6]*100/((nreads_PABPC4X1_bins[5,6])+(nreads_PABPC4X1_bins[12,6])+(nreads_PABPC4X1_bins[19,6]))
percent_poliA_41_50[is.na(percent_poliA_41_50)] <- 0
percent_poliAU_41_50 <- nreads_PABPC4X1_bins[12,6]*100/((nreads_PABPC4X1_bins[5,6])+(nreads_PABPC4X1_bins[12,6])+(nreads_PABPC4X1_bins[19,6]))
percent_poliAU_41_50[is.na(percent_poliAU_41_50)] <- 0

percent_poliU_51_60 <- nreads_PABPC4X1_bins[20,6]*100/((nreads_PABPC4X1_bins[6,6])+(nreads_PABPC4X1_bins[13,6])+(nreads_PABPC4X1_bins[20,6]))
percent_poliU_51_60[is.na(percent_poliU_51_60)] <- 0
percent_poliA_51_60 <- nreads_PABPC4X1_bins[6,6]*100/((nreads_PABPC4X1_bins[6,6])+(nreads_PABPC4X1_bins[13,6])+(nreads_PABPC4X1_bins[20,6]))
percent_poliA_51_60[is.na(percent_poliA_51_60)] <- 0
percent_poliAU_51_60 <- nreads_PABPC4X1_bins[13,6]*100/((nreads_PABPC4X1_bins[6,6])+(nreads_PABPC4X1_bins[13,6])+(nreads_PABPC4X1_bins[20,6]))
percent_poliAU_51_60[is.na(percent_poliAU_51_60)] <- 0

percent_poliU_61 <- nreads_PABPC4X1_bins[21,6]*100/((nreads_PABPC4X1_bins[7,6])+(nreads_PABPC4X1_bins[14,6])+(nreads_PABPC4X1_bins[21,6]))
percent_poliU_61[is.na(percent_poliU_61)] <- 0
percent_poliA_61 <- nreads_PABPC4X1_bins[7,6]*100/((nreads_PABPC4X1_bins[7,6])+(nreads_PABPC4X1_bins[14,6])+(nreads_PABPC4X1_bins[21,6]))
percent_poliA_61[is.na(percent_poliA_61)] <- 0
percent_poliAU_61 <- nreads_PABPC4X1_bins[14,6]*100/((nreads_PABPC4X1_bins[7,6])+(nreads_PABPC4X1_bins[14,6])+(nreads_PABPC4X1_bins[21,6]))
percent_poliAU_61[is.na(percent_poliAU_61)] <- 0

percent_PABPC4X1KO_22 <- data.frame(percent=c(percent_poliU_1_10,percent_poliA_1_10,percent_poliAU_1_10,
                                          percent_poliU_11_20,percent_poliA_11_20,percent_poliAU_11_20,
                                          percent_poliU_21_30,percent_poliA_21_30,percent_poliAU_21_30,
                                          percent_poliU_31_40,percent_poliA_31_40,percent_poliAU_31_40,
                                          percent_poliU_41_50,percent_poliA_41_50,percent_poliAU_41_50,
                                          percent_poliU_51_60,percent_poliA_51_60,percent_poliAU_51_60,
                                          percent_poliU_61,percent_poliA_61,percent_poliAU_61),
                               tail=c(rep(c("U tail","A tail","AU tail"),7)),
                               range=(c(rep("1-10",3),rep("11-20",3),rep("21-30",3),rep("31-40",3),rep("41-50",3),rep("51-60",3),rep("61+",3))),
                               sample=c(rep("X1KO_22",21)))

percent_PABPC4_filter_bins = rbind(percent_PABPC4WT_25, percent_PABPC4WT_26, percent_PABPC4WT_27, percent_PABPC4WT_28, percent_PABPC4WT_29, percent_PABPC4WT_30, percent_PABPC4X1KO_17, percent_PABPC4X1KO_18, percent_PABPC4X1KO_19, percent_PABPC4X1KO_20, percent_PABPC4X1KO_21, percent_PABPC4X1KO_22)
```

```{r}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")

ggplot(percent_PABPC4_filter_bins, aes(fill=tail, y=percent, x=range)) + 
    geom_bar(position="stack", stat="identity") + #position="fill" - robi procenty, gdzy dane nie są w procentach
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "U tail" = "#A50F15")) +
    scale_x_discrete(limits = order)
```

### statistics; tail types in ranges {.tabset}
```{r include=FALSE}
percent_PABPC4_stat2 = percent_PABPC4_filter_bins

percent_PABPC4_stat2$sample <- gsub('WT_25', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_26', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_27', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_28', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_29', 'WT', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('WT_30', 'WT', percent_PABPC4_stat2$sample)

percent_PABPC4_stat2$sample <- gsub('X1KO_17', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_18', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_19', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_20', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_21', 'X1KO', percent_PABPC4_stat2$sample)
percent_PABPC4_stat2$sample <- gsub('X1KO_22', 'X1KO', percent_PABPC4_stat2$sample)

stat1_10 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "1-10",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat11_20 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "11-20",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat21_30 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "21-30",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat31_40 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "31-40",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat41_50 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "41-50",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat51_60 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "51-60",], group.by = "tail", method="t.test", p.adjust.method="BH")
stat61 = compare_means(percent ~ sample, percent_PABPC4_stat2[percent_PABPC4_stat2$range == "61+",], group.by = "tail", method="t.test", p.adjust.method="BH")
```

#### range 1-10 
```{r}
stat1_10
```

#### range 11-20
```{r}
stat11_20
```

#### range 21-30
```{r}
stat21_30
```

#### range 31-40
```{r}
stat31_40
```

#### range 41-50
```{r}
stat41_50
```

#### range 51-60
```{r}
stat51_60
```

#### range 61+
```{r}
stat61
```

## PABPC4 U length in poly(AU)
```{r}
percent_PABPC4WT_25_binsAU = percents_AU_bins_fun(PABPC4WT_25,"WT_25")
percent_PABPC4WT_26_binsAU = percents_AU_bins_fun(PABPC4WT_26,"WT_26")
percent_PABPC4WT_27_binsAU = percents_AU_bins_fun(PABPC4WT_27,"WT_27")
percent_PABPC4WT_28_binsAU = percents_AU_bins_fun(PABPC4WT_28,"WT_28")
percent_PABPC4WT_29_binsAU = percents_AU_bins_fun(PABPC4WT_29,"WT_29")
percent_PABPC4WT_30_binsAU = percents_AU_bins_fun(PABPC4WT_30,"WT_30")

percent_PABPC4X1KO_17_binsAU = percents_AU_bins_fun(PABPC4X1KO_17,"X1KO_17")
percent_PABPC4X1KO_18_binsAU = percents_AU_bins_fun(PABPC4X1KO_18,"X1KO_18")
percent_PABPC4X1KO_19_binsAU = percents_AU_bins_fun(PABPC4X1KO_19,"X1KO_19")
percent_PABPC4X1KO_20_binsAU = percents_AU_bins_fun(PABPC4X1KO_20,"X1KO_20")
percent_PABPC4X1KO_21_binsAU = percents_AU_bins_fun(PABPC4X1KO_21,"X1KO_21")
percent_PABPC4X1KO_22_binsAU = percents_AU_bins_fun(PABPC4X1KO_22,"X1KO_22")

percent_PABPC4WT_binsAU = cbind(percent_PABPC4WT_25_binsAU, percent_PABPC4WT_26_binsAU, percent_PABPC4WT_27_binsAU, percent_PABPC4WT_28_binsAU, percent_PABPC4WT_29_binsAU, percent_PABPC4WT_30_binsAU)
percent_PABPC4WT_binsAU = as.data.frame(percent_PABPC4WT_binsAU)

percent_PABPC4X1_binsAU = cbind(percent_PABPC4X1KO_17_binsAU, percent_PABPC4X1KO_18_binsAU, percent_PABPC4X1KO_19_binsAU, percent_PABPC4X1KO_20_binsAU, percent_PABPC4X1KO_21_binsAU, percent_PABPC4X1KO_22_binsAU)
percent_PABPC4X1_binsAU = as.data.frame(percent_PABPC4X1_binsAU)

percent_PABPC4_AU = rbind(percent_PABPC4WT_25_binsAU, percent_PABPC4WT_26_binsAU, percent_PABPC4WT_27_binsAU, percent_PABPC4WT_28_binsAU, percent_PABPC4WT_29_binsAU, percent_PABPC4WT_30_binsAU, percent_PABPC4X1KO_17_binsAU, percent_PABPC4X1KO_18_binsAU, percent_PABPC4X1KO_19_binsAU, percent_PABPC4X1KO_20_binsAU, percent_PABPC4X1KO_21_binsAU, percent_PABPC4X1KO_22_binsAU)
```

```{r}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
my_colors=brewer.pal(9, "Blues")
my_colors = my_colors[4:8]

ggplot(percent_PABPC4_AU, aes(fill=U_range, y=percent, x=range)) + 
    geom_bar(stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) + 
    xlab("Range (total length of poly(AU) tail)") +
    labs(fill="U length") +
    scale_fill_manual(values=my_colors)
```

### statistics; U length in poly(AU)  {.tabset}
```{r include=FALSE}
percent_PABPC4_stat4 = percent_PABPC4_AU

percent_PABPC4_stat4$sample <- gsub('WT_25', 'WT', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('WT_26', 'WT', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('WT_27', 'WT', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('WT_28', 'WT', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('WT_29', 'WT', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('WT_30', 'WT', percent_PABPC4_stat4$sample)

percent_PABPC4_stat4$sample <- gsub('X1KO_17', 'X1KO', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('X1KO_18', 'X1KO', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('X1KO_19', 'X1KO', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('X1KO_20', 'X1KO', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('X1KO_21', 'X1KO', percent_PABPC4_stat4$sample)
percent_PABPC4_stat4$sample <- gsub('X1KO_22', 'X1KO', percent_PABPC4_stat4$sample)

stat1_10 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "1-10",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat11_20 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "11-20",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat21_30 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "21-30",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat31_40 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "31-40",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat41_50 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "41-50",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat51_60 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "51-60",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat61 = compare_means(percent ~ sample, percent_PABPC4_stat4[percent_PABPC4_stat4$range == "61+",], group.by = "U_range", method="t.test", p.adjust.method="BH")
```

#### range 1-10 
```{r}
stat1_10
```

#### range 11-20
```{r}
stat11_20
```

#### range 21-30
```{r}
stat21_30
```

#### range 31-40
```{r}
stat31_40
```

#### range 41-50
```{r}
stat41_50
```

#### range 51-60
```{r}
stat51_60
```

#### range 61+
```{r}
stat61
```

## PABPC4 U length in poly(U) and poly(AU)
```{r}
percent_PABPC4WT_25_binsU = percents_UandAU_bins_fun(PABPC4WT_25,"WT_25")
percent_PABPC4WT_26_binsU = percents_UandAU_bins_fun(PABPC4WT_26,"WT_26")
percent_PABPC4WT_27_binsU = percents_UandAU_bins_fun(PABPC4WT_27,"WT_27")
percent_PABPC4WT_28_binsU = percents_UandAU_bins_fun(PABPC4WT_28,"WT_28")
percent_PABPC4WT_29_binsU = percents_UandAU_bins_fun(PABPC4WT_29,"WT_29")
percent_PABPC4WT_30_binsU = percents_UandAU_bins_fun(PABPC4WT_30,"WT_30")

percent_PABPC4X1KO_17_binsU = percents_UandAU_bins_fun(PABPC4X1KO_17,"X1KO_17")
percent_PABPC4X1KO_18_binsU = percents_UandAU_bins_fun(PABPC4X1KO_18,"X1KO_18")
percent_PABPC4X1KO_19_binsU = percents_UandAU_bins_fun(PABPC4X1KO_19,"X1KO_19")
percent_PABPC4X1KO_20_binsU = percents_UandAU_bins_fun(PABPC4X1KO_20,"X1KO_20")
percent_PABPC4X1KO_21_binsU = percents_UandAU_bins_fun(PABPC4X1KO_21,"X1KO_21")
percent_PABPC4X1KO_22_binsU = percents_UandAU_bins_fun(PABPC4X1KO_22,"X1KO_22")

percent_PABPC4WT_binsU = cbind(percent_PABPC4WT_25_binsU, percent_PABPC4WT_26_binsU, percent_PABPC4WT_27_binsU, percent_PABPC4WT_28_binsU, percent_PABPC4WT_29_binsU, percent_PABPC4WT_30_binsU)
percent_PABPC4WT_binsU = as.data.frame(percent_PABPC4WT_binsU)

percent_PABPC4X1_binsU = cbind(percent_PABPC4X1KO_17_binsU, percent_PABPC4X1KO_18_binsU, percent_PABPC4X1KO_19_binsU, percent_PABPC4X1KO_20_binsU, percent_PABPC4X1KO_21_binsU, percent_PABPC4X1KO_22_binsU)
percent_PABPC4X1_binsU = as.data.frame(percent_PABPC4X1_binsU)

percent_PABPC4_U = rbind(percent_PABPC4WT_25_binsU, percent_PABPC4WT_26_binsU, percent_PABPC4WT_27_binsU, percent_PABPC4WT_28_binsU, percent_PABPC4WT_29_binsU, percent_PABPC4WT_30_binsU, percent_PABPC4X1KO_17_binsU, percent_PABPC4X1KO_18_binsU, percent_PABPC4X1KO_19_binsU, percent_PABPC4X1KO_20_binsU, percent_PABPC4X1KO_21_binsU, percent_PABPC4X1KO_22_binsU)
```

```{r}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
my_colors=brewer.pal(9, "Blues")
my_colors = my_colors[4:8]

ggplot(percent_PABPC4_U, aes(fill=U_range, y=percent, x=range)) + 
    geom_bar(stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) + 
    xlab("Range (total length of poly(U) and poly(AU) tail)") +
    labs(fill="U length") +
    scale_fill_manual(values=my_colors)
```

### statistics; U length in poly(U) and poly(AU) {.tabset}
```{r include=FALSE}
percent_PABPC4_stat5 = percent_PABPC4_U

percent_PABPC4_stat5$sample <- gsub('WT_25', 'WT', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('WT_26', 'WT', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('WT_27', 'WT', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('WT_28', 'WT', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('WT_29', 'WT', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('WT_30', 'WT', percent_PABPC4_stat5$sample)

percent_PABPC4_stat5$sample <- gsub('X1KO_17', 'X1KO', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('X1KO_18', 'X1KO', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('X1KO_19', 'X1KO', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('X1KO_20', 'X1KO', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('X1KO_21', 'X1KO', percent_PABPC4_stat5$sample)
percent_PABPC4_stat5$sample <- gsub('X1KO_22', 'X1KO', percent_PABPC4_stat5$sample)

stat1_10 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "1-10",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat11_20 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "11-20",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat21_30 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "21-30",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat31_40 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "31-40",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat41_50 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "41-50",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat51_60 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "51-60",], group.by = "U_range", method="t.test", p.adjust.method="BH")
stat61 = compare_means(percent ~ sample, percent_PABPC4_stat5[percent_PABPC4_stat5$range == "61+",], group.by = "U_range", method="t.test", p.adjust.method="BH")
```

#### range 1-10 
```{r}
stat1_10
```

#### range 11-20
```{r}
stat11_20
```

#### range 21-30
```{r}
stat21_30
```

#### range 31-40
```{r}
stat31_40
```

#### range 41-50
```{r}
stat41_50
```

#### range 51-60
```{r}
stat51_60
```

#### range 61+
```{r}
stat61
```

# Percentage of tails in length range (mean); filtered reads {.tabset}

## PABPC4
```{r}
xU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU1_10 = xU1_10[with(xU1_10, range == "1-10"),]
xU1_10 = xU1_10[with(xU1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU11_20 = xU11_20[with(xU11_20, range == "11-20"),]
xU11_20 = xU11_20[with(xU11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU21_30 = xU21_30[with(xU21_30, range == "21-30"),]
xU21_30 = xU21_30[with(xU21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU31_40 = xU31_40[with(xU31_40, range == "31-40"),]
xU31_40 = xU31_40[with(xU31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU41_50 = xU41_50[with(xU41_50, range == "41-50"),]
xU41_50 = xU41_50[with(xU41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU51_60 = xU51_60[with(xU51_60, range == "51-60"),]
xU51_60 = xU51_60[with(xU51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU61 = xU61[with(xU61, range == "61+"),]
xU61 = xU61[with(xU61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA1_10 = xA1_10[with(xA1_10, range == "1-10"),]
xA1_10 = xA1_10[with(xA1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA11_20 = xA11_20[with(xA11_20, range == "11-20"),]
xA11_20 = xA11_20[with(xA11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA21_30 = xA21_30[with(xA21_30, range == "21-30"),]
xA21_30 = xA21_30[with(xA21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA31_40 = xA31_40[with(xA31_40, range == "31-40"),]
xA31_40 = xA31_40[with(xA31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA41_50 = xA41_50[with(xA41_50, range == "41-50"),]
xA41_50 = xA41_50[with(xA41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA51_60 = xA51_60[with(xA51_60, range == "51-60"),]
xA51_60 = xA51_60[with(xA51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xA61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA61 = xA61[with(xA61, range == "61+"),]
xA61 = xA61[with(xA61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU1_10 = xAU1_10[with(xAU1_10, range == "1-10"),]
xAU1_10 = xAU1_10[with(xAU1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU11_20 = xAU11_20[with(xAU11_20, range == "11-20"),]
xAU11_20 = xAU11_20[with(xAU11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU21_30 = xAU21_30[with(xAU21_30, range == "21-30"),]
xAU21_30 = xAU21_30[with(xAU21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU31_40 = xAU31_40[with(xAU31_40, range == "31-40"),]
xAU31_40 = xAU31_40[with(xAU31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU41_50 = xAU41_50[with(xAU41_50, range == "41-50"),]
xAU41_50 = xAU41_50[with(xAU41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU51_60 = xAU51_60[with(xAU51_60, range == "51-60"),]
xAU51_60 = xAU51_60[with(xAU51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

xAU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU61 = xAU61[with(xAU61, range == "61+"),]
xAU61 = xAU61[with(xAU61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

percent_mean_PABPC4WT <- data.frame(percent=c(mean(xU1_10$percent),mean(xU11_20$percent),mean(xU21_30$percent),mean(xU31_40$percent),mean(xU41_50$percent),mean(xU51_60$percent),mean(xU61$percent),
                                            mean(xA1_10$percent),mean(xA11_20$percent),mean(xA21_30$percent),mean(xA31_40$percent),mean(xA41_50$percent),mean(xA51_60$percent),mean(xA61$percent),
                                            mean(xAU1_10$percent),mean(xAU11_20$percent),mean(xAU21_30$percent),mean(xAU31_40$percent),mean(xAU41_50$percent),mean(xAU51_60$percent),mean(xAU61$percent)),
                               tail=c(rep("U tail",7),rep("A tail",7),rep("AU tail",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),3)),
                               sample=c(rep("WT",21)))


xU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU1_10 = xU1_10[with(xU1_10, range == "1-10"),]
xU1_10 = xU1_10[with(xU1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU11_20 = xU11_20[with(xU11_20, range == "11-20"),]
xU11_20 = xU11_20[with(xU11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU21_30 = xU21_30[with(xU21_30, range == "21-30"),]
xU21_30 = xU21_30[with(xU21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU31_40 = xU31_40[with(xU31_40, range == "31-40"),]
xU31_40 = xU31_40[with(xU31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU41_50 = xU41_50[with(xU41_50, range == "41-50"),]
xU41_50 = xU41_50[with(xU41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU51_60 = xU51_60[with(xU51_60, range == "51-60"),]
xU51_60 = xU51_60[with(xU51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "U tail"),]
xU61 = xU61[with(xU61, range == "61+"),]
xU61 = xU61[with(xU61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA1_10 = xA1_10[with(xA1_10, range == "1-10"),]
xA1_10 = xA1_10[with(xA1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA11_20 = xA11_20[with(xA11_20, range == "11-20"),]
xA11_20 = xA11_20[with(xA11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA21_30 = xA21_30[with(xA21_30, range == "21-30"),]
xA21_30 = xA21_30[with(xA21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA31_40 = xA31_40[with(xA31_40, range == "31-40"),]
xA31_40 = xA31_40[with(xA31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA41_50 = xA41_50[with(xA41_50, range == "41-50"),]
xA41_50 = xA41_50[with(xA41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA51_60 = xA51_60[with(xA51_60, range == "51-60"),]
xA51_60 = xA51_60[with(xA51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xA61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "A tail"),]
xA61 = xA61[with(xA61, range == "61+"),]
xA61 = xA61[with(xA61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU1_10 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU1_10 = xAU1_10[with(xAU1_10, range == "1-10"),]
xAU1_10 = xAU1_10[with(xAU1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU11_20 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU11_20 = xAU11_20[with(xAU11_20, range == "11-20"),]
xAU11_20 = xAU11_20[with(xAU11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU21_30 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU21_30 = xAU21_30[with(xAU21_30, range == "21-30"),]
xAU21_30 = xAU21_30[with(xAU21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU31_40 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU31_40 = xAU31_40[with(xAU31_40, range == "31-40"),]
xAU31_40 = xAU31_40[with(xAU31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU41_50 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU41_50 = xAU41_50[with(xAU41_50, range == "41-50"),]
xAU41_50 = xAU41_50[with(xAU41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU51_60 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU51_60 = xAU51_60[with(xAU51_60, range == "51-60"),]
xAU51_60 = xAU51_60[with(xAU51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

xAU61 = percent_PABPC4_bins[with(percent_PABPC4_bins, tail == "AU tail"),]
xAU61 = xAU61[with(xAU61, range == "61+"),]
xAU61 = xAU61[with(xAU61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

percent_mean_PABPC4X1 <- data.frame(percent=c(mean(xU1_10$percent),mean(xU11_20$percent),mean(xU21_30$percent),mean(xU31_40$percent),mean(xU41_50$percent),mean(xU51_60$percent),mean(xU61$percent),
                                            mean(xA1_10$percent),mean(xA11_20$percent),mean(xA21_30$percent),mean(xA31_40$percent),mean(xA41_50$percent),mean(xA51_60$percent),mean(xA61$percent),
                                            mean(xAU1_10$percent),mean(xAU11_20$percent),mean(xAU21_30$percent),mean(xAU31_40$percent),mean(xAU41_50$percent),mean(xAU51_60$percent),mean(xAU61$percent)),
                               tail=c(rep("U tail",7),rep("A tail",7),rep("AU tail",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),3)),
                               sample=c(rep("X1KO",21)))


percent_mean_PABPC4 = rbind(percent_mean_PABPC4WT,percent_mean_PABPC4X1)
```

```{r fig.height=6, fig.width=7}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")

ggplot(percent_mean_PABPC4, aes(fill=tail, y=percent, x=range)) + 
    geom_bar(position="fill", stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) +
    scale_fill_manual(values=c("A tail" = "#74C476", "AU tail" = "#FD8D3C", "U tail" = "#A50F15")) +
    scale_x_discrete(limits = order)
```

## PABPC4 Ulength in poly(AU)
```{r}
x1_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_1_10 = x1_1_10[with(x1_1_10, range == "1-10"),]
x1_1_10 = x1_1_10[with(x1_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_11_20 = x1_11_20[with(x1_11_20, range == "11-20"),]
x1_11_20 = x1_11_20[with(x1_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_21_30 = x1_21_30[with(x1_21_30, range == "21-30"),]
x1_21_30 = x1_21_30[with(x1_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_31_40 = x1_31_40[with(x1_31_40, range == "31-40"),]
x1_31_40 = x1_31_40[with(x1_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_41_50 = x1_41_50[with(x1_41_50, range == "41-50"),]
x1_41_50 = x1_41_50[with(x1_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_51_60 = x1_51_60[with(x1_51_60, range == "51-60"),]
x1_51_60 = x1_51_60[with(x1_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_61 = x1_61[with(x1_61, range == "61+"),]
x1_61 = x1_61[with(x1_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_1_10 = x2_1_10[with(x2_1_10, range == "1-10"),]
x2_1_10 = x2_1_10[with(x2_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_11_20 = x2_11_20[with(x2_11_20, range == "11-20"),]
x2_11_20 = x2_11_20[with(x2_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_21_30 = x2_21_30[with(x2_21_30, range == "21-30"),]
x2_21_30 = x2_21_30[with(x2_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_31_40 = x2_31_40[with(x2_31_40, range == "31-40"),]
x2_31_40 = x2_31_40[with(x2_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_41_50 = x2_41_50[with(x2_41_50, range == "41-50"),]
x2_41_50 = x2_41_50[with(x2_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_51_60 = x2_51_60[with(x2_51_60, range == "51-60"),]
x2_51_60 = x2_51_60[with(x2_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_61 = x2_61[with(x2_61, range == "61+"),]
x2_61 = x2_61[with(x2_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_1_10 = x34_1_10[with(x34_1_10, range == "1-10"),]
x34_1_10 = x34_1_10[with(x34_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_11_20 = x34_11_20[with(x34_11_20, range == "11-20"),]
x34_11_20 = x34_11_20[with(x34_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_21_30 = x34_21_30[with(x34_21_30, range == "21-30"),]
x34_21_30 = x34_21_30[with(x34_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_31_40 = x34_31_40[with(x34_31_40, range == "31-40"),]
x34_31_40 = x34_31_40[with(x34_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_41_50 = x34_41_50[with(x34_41_50, range == "41-50"),]
x34_41_50 = x34_41_50[with(x34_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_51_60 = x34_51_60[with(x34_51_60, range == "51-60"),]
x34_51_60 = x34_51_60[with(x34_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_61 = x34_61[with(x34_61, range == "61+"),]
x34_61 = x34_61[with(x34_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_1_10 = x57_1_10[with(x57_1_10, range == "1-10"),]
x57_1_10 = x57_1_10[with(x57_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_11_20 = x57_11_20[with(x57_11_20, range == "11-20"),]
x57_11_20 = x57_11_20[with(x57_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_21_30 = x57_21_30[with(x57_21_30, range == "21-30"),]
x57_21_30 = x57_21_30[with(x57_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_31_40 = x57_31_40[with(x57_31_40, range == "31-40"),]
x57_31_40 = x57_31_40[with(x57_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_41_50 = x57_41_50[with(x57_41_50, range == "41-50"),]
x57_41_50 = x57_41_50[with(x57_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_51_60 = x57_51_60[with(x57_51_60, range == "51-60"),]
x57_51_60 = x57_51_60[with(x57_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_61 = x57_61[with(x57_61, range == "61+"),]
x57_61 = x57_61[with(x57_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_1_10 = x8_1_10[with(x8_1_10, range == "1-10"),]
x8_1_10 = x8_1_10[with(x8_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_11_20 = x8_11_20[with(x8_11_20, range == "11-20"),]
x8_11_20 = x8_11_20[with(x8_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_21_30 = x8_21_30[with(x8_21_30, range == "21-30"),]
x8_21_30 = x8_21_30[with(x8_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_31_40 = x8_31_40[with(x8_31_40, range == "31-40"),]
x8_31_40 = x8_31_40[with(x8_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_41_50 = x8_41_50[with(x8_41_50, range == "41-50"),]
x8_41_50 = x8_41_50[with(x8_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_51_60 = x8_51_60[with(x8_51_60, range == "51-60"),]
x8_51_60 = x8_51_60[with(x8_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_61 = x8_61[with(x8_61, range == "61+"),]
x8_61 = x8_61[with(x8_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

percent_mean_PABPC4WT_AU <- data.frame(percent=c(mean(x1_1_10$percent),mean(x1_11_20$percent),mean(x1_21_30$percent),mean(x1_31_40$percent),mean(x1_41_50$percent),mean(x1_51_60$percent),mean(x1_61$percent),
                                             mean(x2_1_10$percent),mean(x2_11_20$percent),mean(x2_21_30$percent),mean(x2_31_40$percent),mean(x2_41_50$percent),mean(x2_51_60$percent),mean(x2_61$percent),
                                             mean(x34_1_10$percent),mean(x34_11_20$percent),mean(x34_21_30$percent),mean(x34_31_40$percent),mean(x34_41_50$percent),mean(x34_51_60$percent),mean(x34_61$percent),
                                             mean(x57_1_10$percent),mean(x57_11_20$percent),mean(x57_21_30$percent),mean(x57_31_40$percent),mean(x57_41_50$percent),mean(x57_51_60$percent),mean(x57_61$percent),
                                             mean(x8_1_10$percent),mean(x8_11_20$percent),mean(x8_21_30$percent),mean(x8_31_40$percent),mean(x8_41_50$percent),mean(x8_51_60$percent),mean(x8_61$percent)),
                               U_range=c(rep("1",7),rep("2",7),rep("3-4",7),rep("5-7",7),rep("8+",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),5)),
                               sample=c(rep("WT",35)))


x1_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_1_10 = x1_1_10[with(x1_1_10, range == "1-10"),]
x1_1_10 = x1_1_10[with(x1_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_11_20 = x1_11_20[with(x1_11_20, range == "11-20"),]
x1_11_20 = x1_11_20[with(x1_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_21_30 = x1_21_30[with(x1_21_30, range == "21-30"),]
x1_21_30 = x1_21_30[with(x1_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_31_40 = x1_31_40[with(x1_31_40, range == "31-40"),]
x1_31_40 = x1_31_40[with(x1_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_41_50 = x1_41_50[with(x1_41_50, range == "41-50"),]
x1_41_50 = x1_41_50[with(x1_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_51_60 = x1_51_60[with(x1_51_60, range == "51-60"),]
x1_51_60 = x1_51_60[with(x1_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "1"),]
x1_61 = x1_61[with(x1_61, range == "61+"),]
x1_61 = x1_61[with(x1_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_1_10 = x2_1_10[with(x2_1_10, range == "1-10"),]
x2_1_10 = x2_1_10[with(x2_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_11_20 = x2_11_20[with(x2_11_20, range == "11-20"),]
x2_11_20 = x2_11_20[with(x2_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_21_30 = x2_21_30[with(x2_21_30, range == "21-30"),]
x2_21_30 = x2_21_30[with(x2_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_31_40 = x2_31_40[with(x2_31_40, range == "31-40"),]
x2_31_40 = x2_31_40[with(x2_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_41_50 = x2_41_50[with(x2_41_50, range == "41-50"),]
x2_41_50 = x2_41_50[with(x2_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_51_60 = x2_51_60[with(x2_51_60, range == "51-60"),]
x2_51_60 = x2_51_60[with(x2_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "2"),]
x2_61 = x2_61[with(x2_61, range == "61+"),]
x2_61 = x2_61[with(x2_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_1_10 = x34_1_10[with(x34_1_10, range == "1-10"),]
x34_1_10 = x34_1_10[with(x34_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_11_20 = x34_11_20[with(x34_11_20, range == "11-20"),]
x34_11_20 = x34_11_20[with(x34_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_21_30 = x34_21_30[with(x34_21_30, range == "21-30"),]
x34_21_30 = x34_21_30[with(x34_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_31_40 = x34_31_40[with(x34_31_40, range == "31-40"),]
x34_31_40 = x34_31_40[with(x34_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_41_50 = x34_41_50[with(x34_41_50, range == "41-50"),]
x34_41_50 = x34_41_50[with(x34_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_51_60 = x34_51_60[with(x34_51_60, range == "51-60"),]
x34_51_60 = x34_51_60[with(x34_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "3-4"),]
x34_61 = x34_61[with(x34_61, range == "61+"),]
x34_61 = x34_61[with(x34_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_1_10 = x57_1_10[with(x57_1_10, range == "1-10"),]
x57_1_10 = x57_1_10[with(x57_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_11_20 = x57_11_20[with(x57_11_20, range == "11-20"),]
x57_11_20 = x57_11_20[with(x57_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_21_30 = x57_21_30[with(x57_21_30, range == "21-30"),]
x57_21_30 = x57_21_30[with(x57_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_31_40 = x57_31_40[with(x57_31_40, range == "31-40"),]
x57_31_40 = x57_31_40[with(x57_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_41_50 = x57_41_50[with(x57_41_50, range == "41-50"),]
x57_41_50 = x57_41_50[with(x57_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_51_60 = x57_51_60[with(x57_51_60, range == "51-60"),]
x57_51_60 = x57_51_60[with(x57_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "5-7"),]
x57_61 = x57_61[with(x57_61, range == "61+"),]
x57_61 = x57_61[with(x57_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_1_10 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_1_10 = x8_1_10[with(x8_1_10, range == "1-10"),]
x8_1_10 = x8_1_10[with(x8_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_11_20 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_11_20 = x8_11_20[with(x8_11_20, range == "11-20"),]
x8_11_20 = x8_11_20[with(x8_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_21_30 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_21_30 = x8_21_30[with(x8_21_30, range == "21-30"),]
x8_21_30 = x8_21_30[with(x8_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_31_40 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_31_40 = x8_31_40[with(x8_31_40, range == "31-40"),]
x8_31_40 = x8_31_40[with(x8_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_41_50 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_41_50 = x8_41_50[with(x8_41_50, range == "41-50"),]
x8_41_50 = x8_41_50[with(x8_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_51_60 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_51_60 = x8_51_60[with(x8_51_60, range == "51-60"),]
x8_51_60 = x8_51_60[with(x8_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_61 = percent_PABPC4_AU[with(percent_PABPC4_AU, U_range == "8+"),]
x8_61 = x8_61[with(x8_61, range == "61+"),]
x8_61 = x8_61[with(x8_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

percent_mean_PABPC4X1_AU <- data.frame(percent=c(mean(x1_1_10$percent),mean(x1_11_20$percent),mean(x1_21_30$percent),mean(x1_31_40$percent),mean(x1_41_50$percent),mean(x1_51_60$percent),mean(x1_61$percent),
                                             mean(x2_1_10$percent),mean(x2_11_20$percent),mean(x2_21_30$percent),mean(x2_31_40$percent),mean(x2_41_50$percent),mean(x2_51_60$percent),mean(x2_61$percent),
                                             mean(x34_1_10$percent),mean(x34_11_20$percent),mean(x34_21_30$percent),mean(x34_31_40$percent),mean(x34_41_50$percent),mean(x34_51_60$percent),mean(x34_61$percent),
                                             mean(x57_1_10$percent),mean(x57_11_20$percent),mean(x57_21_30$percent),mean(x57_31_40$percent),mean(x57_41_50$percent),mean(x57_51_60$percent),mean(x57_61$percent),
                                             mean(x8_1_10$percent),mean(x8_11_20$percent),mean(x8_21_30$percent),mean(x8_31_40$percent),mean(x8_41_50$percent),mean(x8_51_60$percent),mean(x8_61$percent)),
                               U_range=c(rep("1",7),rep("2",7),rep("3-4",7),rep("5-7",7),rep("8+",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),5)),
                               sample=c(rep("X1KO",35)))

percent_mean_PABPC4_AU = rbind(percent_mean_PABPC4WT_AU,percent_mean_PABPC4X1_AU)
```

```{r fig.height=6, fig.width=7}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
my_colors=brewer.pal(9, "Blues")
my_colors = my_colors[4:8]

ggplot(percent_mean_PABPC4_AU, aes(fill=U_range, y=percent, x=range)) + 
    geom_bar(position="fill", stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) + 
    xlab("Range (total length of poly(AU) tail)") +
    labs(fill="U length") +
    scale_fill_manual(values=my_colors)
```

## PABPC4 Ulength in poly(U) and poly(AU)
```{r}
x1_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_1_10 = x1_1_10[with(x1_1_10, range == "1-10"),]
x1_1_10 = x1_1_10[with(x1_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_11_20 = x1_11_20[with(x1_11_20, range == "11-20"),]
x1_11_20 = x1_11_20[with(x1_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_21_30 = x1_21_30[with(x1_21_30, range == "21-30"),]
x1_21_30 = x1_21_30[with(x1_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_31_40 = x1_31_40[with(x1_31_40, range == "31-40"),]
x1_31_40 = x1_31_40[with(x1_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_41_50 = x1_41_50[with(x1_41_50, range == "41-50"),]
x1_41_50 = x1_41_50[with(x1_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_51_60 = x1_51_60[with(x1_51_60, range == "51-60"),]
x1_51_60 = x1_51_60[with(x1_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x1_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_61 = x1_61[with(x1_61, range == "61+"),]
x1_61 = x1_61[with(x1_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_1_10 = x2_1_10[with(x2_1_10, range == "1-10"),]
x2_1_10 = x2_1_10[with(x2_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_11_20 = x2_11_20[with(x2_11_20, range == "11-20"),]
x2_11_20 = x2_11_20[with(x2_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_21_30 = x2_21_30[with(x2_21_30, range == "21-30"),]
x2_21_30 = x2_21_30[with(x2_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_31_40 = x2_31_40[with(x2_31_40, range == "31-40"),]
x2_31_40 = x2_31_40[with(x2_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_41_50 = x2_41_50[with(x2_41_50, range == "41-50"),]
x2_41_50 = x2_41_50[with(x2_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_51_60 = x2_51_60[with(x2_51_60, range == "51-60"),]
x2_51_60 = x2_51_60[with(x2_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x2_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_61 = x2_61[with(x2_61, range == "61+"),]
x2_61 = x2_61[with(x2_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_1_10 = x34_1_10[with(x34_1_10, range == "1-10"),]
x34_1_10 = x34_1_10[with(x34_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_11_20 = x34_11_20[with(x34_11_20, range == "11-20"),]
x34_11_20 = x34_11_20[with(x34_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_21_30 = x34_21_30[with(x34_21_30, range == "21-30"),]
x34_21_30 = x34_21_30[with(x34_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_31_40 = x34_31_40[with(x34_31_40, range == "31-40"),]
x34_31_40 = x34_31_40[with(x34_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_41_50 = x34_41_50[with(x34_41_50, range == "41-50"),]
x34_41_50 = x34_41_50[with(x34_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_51_60 = x34_51_60[with(x34_51_60, range == "51-60"),]
x34_51_60 = x34_51_60[with(x34_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x34_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_61 = x34_61[with(x34_61, range == "61+"),]
x34_61 = x34_61[with(x34_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_1_10 = x57_1_10[with(x57_1_10, range == "1-10"),]
x57_1_10 = x57_1_10[with(x57_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_11_20 = x57_11_20[with(x57_11_20, range == "11-20"),]
x57_11_20 = x57_11_20[with(x57_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_21_30 = x57_21_30[with(x57_21_30, range == "21-30"),]
x57_21_30 = x57_21_30[with(x57_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_31_40 = x57_31_40[with(x57_31_40, range == "31-40"),]
x57_31_40 = x57_31_40[with(x57_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_41_50 = x57_41_50[with(x57_41_50, range == "41-50"),]
x57_41_50 = x57_41_50[with(x57_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_51_60 = x57_51_60[with(x57_51_60, range == "51-60"),]
x57_51_60 = x57_51_60[with(x57_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x57_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_61 = x57_61[with(x57_61, range == "61+"),]
x57_61 = x57_61[with(x57_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_1_10 = x8_1_10[with(x8_1_10, range == "1-10"),]
x8_1_10 = x8_1_10[with(x8_1_10, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_11_20 = x8_11_20[with(x8_11_20, range == "11-20"),]
x8_11_20 = x8_11_20[with(x8_11_20, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_21_30 = x8_21_30[with(x8_21_30, range == "21-30"),]
x8_21_30 = x8_21_30[with(x8_21_30, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_31_40 = x8_31_40[with(x8_31_40, range == "31-40"),]
x8_31_40 = x8_31_40[with(x8_31_40, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_41_50 = x8_41_50[with(x8_41_50, range == "41-50"),]
x8_41_50 = x8_41_50[with(x8_41_50, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_51_60 = x8_51_60[with(x8_51_60, range == "51-60"),]
x8_51_60 = x8_51_60[with(x8_51_60, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

x8_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_61 = x8_61[with(x8_61, range == "61+"),]
x8_61 = x8_61[with(x8_61, sample == c("WT_25","WT_26","WT_27","WT_28","WT_29","WT_30")),]

percent_mean_PABPC4WT_U <- data.frame(percent=c(mean(x1_1_10$percent),mean(x1_11_20$percent),mean(x1_21_30$percent),mean(x1_31_40$percent),mean(x1_41_50$percent),mean(x1_51_60$percent),mean(x1_61$percent),
                                             mean(x2_1_10$percent),mean(x2_11_20$percent),mean(x2_21_30$percent),mean(x2_31_40$percent),mean(x2_41_50$percent),mean(x2_51_60$percent),mean(x2_61$percent),
                                             mean(x34_1_10$percent),mean(x34_11_20$percent),mean(x34_21_30$percent),mean(x34_31_40$percent),mean(x34_41_50$percent),mean(x34_51_60$percent),mean(x34_61$percent),
                                             mean(x57_1_10$percent),mean(x57_11_20$percent),mean(x57_21_30$percent),mean(x57_31_40$percent),mean(x57_41_50$percent),mean(x57_51_60$percent),mean(x57_61$percent),
                                             mean(x8_1_10$percent),mean(x8_11_20$percent),mean(x8_21_30$percent),mean(x8_31_40$percent),mean(x8_41_50$percent),mean(x8_51_60$percent),mean(x8_61$percent)),
                               U_range=c(rep("1",7),rep("2",7),rep("3-4",7),rep("5-7",7),rep("8+",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),5)),
                               sample=c(rep("WT",35)))


x1_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_1_10 = x1_1_10[with(x1_1_10, range == "1-10"),]
x1_1_10 = x1_1_10[with(x1_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_11_20 = x1_11_20[with(x1_11_20, range == "11-20"),]
x1_11_20 = x1_11_20[with(x1_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_21_30 = x1_21_30[with(x1_21_30, range == "21-30"),]
x1_21_30 = x1_21_30[with(x1_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_31_40 = x1_31_40[with(x1_31_40, range == "31-40"),]
x1_31_40 = x1_31_40[with(x1_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_41_50 = x1_41_50[with(x1_41_50, range == "41-50"),]
x1_41_50 = x1_41_50[with(x1_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_51_60 = x1_51_60[with(x1_51_60, range == "51-60"),]
x1_51_60 = x1_51_60[with(x1_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x1_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "1"),]
x1_61 = x1_61[with(x1_61, range == "61+"),]
x1_61 = x1_61[with(x1_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_1_10 = x2_1_10[with(x2_1_10, range == "1-10"),]
x2_1_10 = x2_1_10[with(x2_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_11_20 = x2_11_20[with(x2_11_20, range == "11-20"),]
x2_11_20 = x2_11_20[with(x2_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_21_30 = x2_21_30[with(x2_21_30, range == "21-30"),]
x2_21_30 = x2_21_30[with(x2_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_31_40 = x2_31_40[with(x2_31_40, range == "31-40"),]
x2_31_40 = x2_31_40[with(x2_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_41_50 = x2_41_50[with(x2_41_50, range == "41-50"),]
x2_41_50 = x2_41_50[with(x2_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_51_60 = x2_51_60[with(x2_51_60, range == "51-60"),]
x2_51_60 = x2_51_60[with(x2_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x2_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "2"),]
x2_61 = x2_61[with(x2_61, range == "61+"),]
x2_61 = x2_61[with(x2_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_1_10 = x34_1_10[with(x34_1_10, range == "1-10"),]
x34_1_10 = x34_1_10[with(x34_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_11_20 = x34_11_20[with(x34_11_20, range == "11-20"),]
x34_11_20 = x34_11_20[with(x34_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_21_30 = x34_21_30[with(x34_21_30, range == "21-30"),]
x34_21_30 = x34_21_30[with(x34_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_31_40 = x34_31_40[with(x34_31_40, range == "31-40"),]
x34_31_40 = x34_31_40[with(x34_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_41_50 = x34_41_50[with(x34_41_50, range == "41-50"),]
x34_41_50 = x34_41_50[with(x34_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_51_60 = x34_51_60[with(x34_51_60, range == "51-60"),]
x34_51_60 = x34_51_60[with(x34_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x34_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "3-4"),]
x34_61 = x34_61[with(x34_61, range == "61+"),]
x34_61 = x34_61[with(x34_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_1_10 = x57_1_10[with(x57_1_10, range == "1-10"),]
x57_1_10 = x57_1_10[with(x57_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_11_20 = x57_11_20[with(x57_11_20, range == "11-20"),]
x57_11_20 = x57_11_20[with(x57_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_21_30 = x57_21_30[with(x57_21_30, range == "21-30"),]
x57_21_30 = x57_21_30[with(x57_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_31_40 = x57_31_40[with(x57_31_40, range == "31-40"),]
x57_31_40 = x57_31_40[with(x57_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_41_50 = x57_41_50[with(x57_41_50, range == "41-50"),]
x57_41_50 = x57_41_50[with(x57_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_51_60 = x57_51_60[with(x57_51_60, range == "51-60"),]
x57_51_60 = x57_51_60[with(x57_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x57_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "5-7"),]
x57_61 = x57_61[with(x57_61, range == "61+"),]
x57_61 = x57_61[with(x57_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_1_10 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_1_10 = x8_1_10[with(x8_1_10, range == "1-10"),]
x8_1_10 = x8_1_10[with(x8_1_10, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_11_20 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_11_20 = x8_11_20[with(x8_11_20, range == "11-20"),]
x8_11_20 = x8_11_20[with(x8_11_20, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_21_30 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_21_30 = x8_21_30[with(x8_21_30, range == "21-30"),]
x8_21_30 = x8_21_30[with(x8_21_30, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_31_40 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_31_40 = x8_31_40[with(x8_31_40, range == "31-40"),]
x8_31_40 = x8_31_40[with(x8_31_40, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_41_50 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_41_50 = x8_41_50[with(x8_41_50, range == "41-50"),]
x8_41_50 = x8_41_50[with(x8_41_50, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_51_60 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_51_60 = x8_51_60[with(x8_51_60, range == "51-60"),]
x8_51_60 = x8_51_60[with(x8_51_60, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

x8_61 = percent_PABPC4_U[with(percent_PABPC4_U, U_range == "8+"),]
x8_61 = x8_61[with(x8_61, range == "61+"),]
x8_61 = x8_61[with(x8_61, sample == c("X1KO_17","X1KO_18","X1KO_19","X1KO_20","X1KO_21","X1KO_22")),]

percent_mean_PABPC4X1_U <- data.frame(percent=c(mean(x1_1_10$percent),mean(x1_11_20$percent),mean(x1_21_30$percent),mean(x1_31_40$percent),mean(x1_41_50$percent),mean(x1_51_60$percent),mean(x1_61$percent),
                                             mean(x2_1_10$percent),mean(x2_11_20$percent),mean(x2_21_30$percent),mean(x2_31_40$percent),mean(x2_41_50$percent),mean(x2_51_60$percent),mean(x2_61$percent),
                                             mean(x34_1_10$percent),mean(x34_11_20$percent),mean(x34_21_30$percent),mean(x34_31_40$percent),mean(x34_41_50$percent),mean(x34_51_60$percent),mean(x34_61$percent),
                                             mean(x57_1_10$percent),mean(x57_11_20$percent),mean(x57_21_30$percent),mean(x57_31_40$percent),mean(x57_41_50$percent),mean(x57_51_60$percent),mean(x57_61$percent),
                                             mean(x8_1_10$percent),mean(x8_11_20$percent),mean(x8_21_30$percent),mean(x8_31_40$percent),mean(x8_41_50$percent),mean(x8_51_60$percent),mean(x8_61$percent)),
                               U_range=c(rep("1",7),rep("2",7),rep("3-4",7),rep("5-7",7),rep("8+",7)),
                               range=(rep(c("1-10","11-20","21-30","31-40","41-50","51-60","61+"),5)),
                               sample=c(rep("X1KO",35)))

percent_mean_PABPC4_U = rbind(percent_mean_PABPC4WT_U,percent_mean_PABPC4X1_U)
```

```{r fig.height=6, fig.width=7}
order = c("1-10","11-20","21-30","31-40","41-50","51-60","61+")
my_colors=brewer.pal(9, "Blues")
my_colors = my_colors[4:8]

ggplot(percent_mean_PABPC4_U, aes(fill=U_range, y=percent, x=range)) + 
    geom_bar(position="fill", stat="identity") + 
    facet_wrap(~sample) +
    ggtitle("PABPC4") +
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
          axis.title=element_text(size=14),
          axis.text=element_text(size=12),
          legend.title=element_text(size=14),
          legend.text=element_text(size=12),
          strip.text = element_text(size=10)) +
    scale_x_discrete(limits = order) + 
    xlab("Range (total length of poly(U) and poly(AU) tail)") +
    labs(fill="U length") +
    scale_fill_manual(values=my_colors)
```