Created
December 1, 2017 03:03
-
-
Save itsvenu/fe7fc479539e4eb81daeac8f67e1df6b 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
plotSE<-function(seFile, seCol="red", teCol="black", mark="H3K27ac", bg=TRUE){ | |
dat=read.delim(seFile, comment.char = '&', nrows=3) | |
colnames(dat)<-"V1" | |
se.signal.cut=as.character(dat$V1[3]) | |
se.signal.cut=as.numeric(strsplit(se.signal.cut, " ")[[1]][4]) | |
se=read.delim(seFile, comment.char = '#', header = TRUE) | |
se.count.cut=dim(subset(se, se$isSuper==1))[1] | |
subData=if(bg) subset(se, select = c(7,9,10)) else subset(se, select=c(7,8,9)) | |
colnames(subData)<-paste("V", 1:ncol(subData), sep="") | |
suppressPackageStartupMessages(require(dplyr)) | |
subData=mutate(subData, type=ifelse(subData$V3==1, "SE", "TE")) | |
suppressPackageStartupMessages(require(ggplot2)) | |
suppressPackageStartupMessages(require(scales)) | |
ggplot(subData, aes(V2, V1))+geom_line()+ | |
geom_point(aes(col=type, size=0.01))+ | |
scale_color_manual(values = c(seCol, teCol))+ | |
theme_classic(base_size = 16)+scale_y_continuous(labels=comma)+ | |
xlab("Enhancer Rank")+ylab(paste(mark, "Normalized read density", sep=" "))+ | |
theme(legend.position = "none")+ | |
geom_hline(yintercept = se.signal.cut, linetype=2, color="gray")+ | |
geom_vline(xintercept = se.count.cut, linetype=2, color="gray") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code was throwing error. I did below mentioned modification
line no. 13 -- colnames(subData)<-paste("V1", 1:ncol(subData), sep="")
line no. 16 -- subData=mutate(subData, type=ifelse(subData$V13==1, "SE", "TE"))
line no. 20 -- ggplot(subData, aes(V12, V11))+geom_line()+