-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathplot_sfig2.R
26 lines (22 loc) · 1012 Bytes
/
plot_sfig2.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
26
library(ggplot2)
library(ggpubr)
library(ComplexHeatmap)
library(reshape2)
library(dplyr)
#plot SFig 2 number of reads vs number of peaks
plot.sfig2 <- function(peakcaller,read.label){
finame <- paste0('fig2/reads_vs_',peakcaller,'_peaks_',read.label,'.txt')
reads.v.peaks <- read.csv(finame,sep=" ")
reads.v.peaks$label <- gsub('_',' ',reads.v.peaks$label)
pdf(paste0('fig2/sfig2_',read.label,'_',peakcaller,'_reads_vs_peaks.pdf'),height=6,width=7)
g <- ggscatter(reads.v.peaks,x="reads",y="peaks", add="reg.line",add.params = list(color = "black"),
conf.int = FALSE, cor.coef = TRUE, cor.method = "pearson",
xlab=paste("#",read.label,"reads"), ylab="# peaks",color="label",shape="label",alpha=1,
legend.title = '',legend='top',font.legend = c(7, "plain", "black")) + scale_shape_manual(values=rep(c(8,seq(15,18)),8))
grid.draw(g)
dev.off()
}
args <- commandArgs(TRUE)
peakcaller <- args[1]
read.label <- args[2]
plot.sfig2(peakcaller,read.label)