forked from moka-guys/coverage_boxplots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage_boxplot.r
25 lines (20 loc) · 948 Bytes
/
coverage_boxplot.r
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
install.packages("tidyverse")
install.packages("stringr")
library("tidyverse")
library("stringr")
# import coverage data
covtidy <- read_tsv("covtidy.txt")
# check the dataframe - for 100 exomes, should return: A tibble: 2,551,722 × 3
covtidy
# examples of plotting box plots for a few genes
covtsubset <- filter(covtidy, Gene=="COL9A2" | Gene=="MATN3" | Gene=="SLC26A2" | Gene=="COL9A1" | Gene=="COMP" | Gene=="COL9A3" | Gene=="CA5BP1")
ggplot(covtsubset, aes(x="", y=above20X)) +
geom_boxplot(aes(group = Gene)) +
facet_wrap(~ Gene, ncol = 1)
ggsave("170210.pdf", width=2, height=20, limitsize=FALSE)
# example of plotting box plots for a range of gene symbols
covtsubset <- filter(covtidy, Gene=="E" | str_detect(Gene, "^E[0-9].*") | str_detect(Gene, "^E[A-N].*") )
ggplot(covtsubset, aes(x="", y=above20X)) +
geom_boxplot(aes(group = Gene)) +
facet_wrap(~ Gene, ncol = 6)
ggsave("E1-EN.pdf", width=8, height=100, limitsize=FALSE)