-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComplentation Plot.Rmd
56 lines (48 loc) · 1.66 KB
/
Complentation Plot.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "Complementation Graph"
author: "Julin N Maloof"
date: "3/31/2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(tidyverse)
library(stringr)
data <- read_csv("tie1comp.csv") %>%
filter(!is.na(line_1)) %>%
mutate(line_1=str_replace(line_1,"(^[24])","GA2ox7-\\1")) %>%
mutate(length=ifelse(str_detect(line,"mix"),NA,length))
data
```
```{r}
unique(data$line_1)
data$line_1 <- factor(data$line_1, levels = c("tie1","GA2ox7-2","GA2ox7-4","M82"))
lm1 <- lm(length~line_1,data=data)
summary(lm1)
```
```{r}
data$line_1 <- relevel(data$line_1, ref="M82")
lm2 <- lm(length~line_1,data=data)
summary(lm2)
```
```{r}
data %>% mutate(line_1=relevel(line_1,ref="tie1")) %>%
group_by(line_1) %>%
summarize(mean_expression=mean(expression,na.rm=TRUE),
mean_length=mean(length,na.rm=TRUE),
exp_error=sd(expression,na.rm=TRUE)/sqrt(length(na.omit(expression))),
length_error=sd(length,na.rm=TRUE)/sqrt(length(na.omit(length)))) %>%
ggplot(aes(x=mean_expression,y=mean_length,color=line_1,shape=line_1) )+
geom_point(size=3) +
geom_errorbar(aes(ymax=mean_length+length_error,ymin=mean_length-length_error),width=.35) +
geom_errorbarh(aes(xmax=mean_expression+exp_error,xmin=mean_expression-exp_error),height=1.8) +
scale_shape_manual(values=15:18) +
scale_color_manual(values=c("M82"="grey80","tie1"="grey20","GA2ox7-2"="grey50","GA2ox7-4"="grey50")) +
xlab("Relative Expression Level") +
ylab("Epicotyl Length (mm)") +
theme_bw() +
theme(legend.title = element_blank())
ggsave("~/Google Drive/tie paper resubmission/ComplementationFigure.pdf",height=2.75,width=4)
```