Created
February 8, 2019 01:16
-
-
Save mbk0asis/5ec600cefead58e9d79f4b4d069d6a7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(ggpmisc) | |
library(ggpubr) | |
library(ggrepel) | |
library(reshape2) | |
setwd("~/BIO2/DAM_ID/DamID_2018/SE/mm9") | |
setwd("~/BIO2/DAM_ID/RNAseq_shDnmt1/mm9") | |
te = "LINE.5kb" | |
te = "ERVL.1kb" | |
dta <- read.delim(paste("cnt.",te,".elements.aggregate.tsv",sep=""), header = F) | |
#dta <- read.delim(paste("cnt.",te,".top10.copyNumber.elements.tsv",sep=""), header = F) | |
#dta <- read.delim(paste("cnt.",te,".cnt2.top10",sep=""), header = F) | |
#dta <- read.delim(paste("cnt.",te,".cnt.agg2",sep=""), header = F) | |
#colnames(dta) <- c("name","Dnmt1","Dam") | |
colnames(dta) <- c("name","siDnmt1","siScrb") | |
head(dta) | |
dta2 <- dta[rowMeans(dta[,2:3]) > 0,] | |
mdta <- melt(dta2) | |
head(mdta) | |
mdta | |
means <- aggregate(value ~ variable, mdta, mean) | |
log2(means[,2]) | |
ggplot(mdta, aes(x=factor(variable), y=log2(value+1))) + theme_bw() + | |
geom_boxplot(width =.3, outlier.shape = NA) + | |
stat_summary(fun.y=mean, geom="point", shape=18, size=5, color="red") + | |
dev.off() | |
ggplot(mdta, aes(x=factor(variable), y=log2(value))) + theme_bw() + | |
geom_jitter(aes(fill=variable),width=.3) + | |
geom_line(group = mdta$name, color="grey50") + | |
geom_violin(aes(fill=variable, alpha=.3)) + | |
geom_boxplot(width =.3, outlier.shape = NA) + | |
stat_summary(fun.y=mean, geom="point", shape=18, size=5, color="red") + | |
stat_compare_means(size = 5, label.x.npc = .2,label.y = 21) + | |
stat_summary(fun.y=mean, colour="black", geom="text", show.legend = FALSE, size=4.5, vjust=-1, aes( label=round(..y.., digits=2))) + | |
scale_fill_manual(values=c("orange", "darkgreen")) + | |
theme(axis.title.y=element_blank(),axis.title.x=element_blank(), | |
axis.text.x=element_blank(), axis.ticks.x=element_blank(),legend.position="none") | |
#scale_fill_manual(values=c("salmon", "steelblue"))+ | |
#geom_point(aes(fill=variable),color="white") + | |
#stat_compare_means(aes(label=..p.adj..)) + #, label.y = 15) + | |
#scale_fill_manual(values=c("orange", "darkgreen")) + | |
#geom_text(aes(label=name),hjust=0, vjust=1, size = 3) | |
dev.off() | |
ggplot(mdta, aes(x=factor(variable), y=log2(1+value))) + theme_bw() + | |
geom_jitter(aes(fill=variable), alpha=.3, size = 1, color ="grey50") + | |
geom_violin(aes(fill=variable, group=variable), alpha=.4) + | |
#facet_grid(~name, scales = "free", space = "free_y") + | |
facet_wrap(~name, scales="free", ncol = 5) + #theme(aspect.ratio = 1) + | |
theme(strip.text.x = element_text(size = 12)) + | |
theme(axis.title.y=element_blank(),axis.title.x=element_blank(), axis.text.x=element_blank(), axis.ticks.x=element_blank(),legend.position="none") + | |
stat_summary(fun.y=mean, geom="point", shape=18, size=3, color="red") + | |
stat_summary(fun.y=mean, geom="line", color="red", size=1, aes(group=1)) + | |
stat_compare_means(label="p.signif", hide.ns=T, size=10, label.x.npc= .1, label.y.npc= .9, color="red") + | |
scale_fill_manual(values=c("salmon", "steelblue")) | |
#scale_fill_manual(values=c("orange", "darkgreen")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment