-
Notifications
You must be signed in to change notification settings - Fork 0
/
mummerplot.R
executable file
·52 lines (42 loc) · 1.41 KB
/
mummerplot.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
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
#!/usr/bin/env Rscript
library("ggplot2")
args <- commandArgs(TRUE)
if (length(args) < 3) {
print("usage: prog output coords xticks yticks")
quit()
}
output <- args[1]
coords <- args[2]
xticks <- args[3]
yticks <- args[4]
t <- read.table(coords,
col.names=c("x1", "y1", "x2", "y2", "pid", "dir"))
t$dir <- factor(t$dir, levels=c("+","-"))
xticks <- read.table(xticks,
sep=",",
col.names=c("labels", "breaks"))
yticks <- read.table(yticks,
sep=",",
col.names=c("labels", "breaks"))
p <- ggplot(t, aes(x=x1,xend=x2,y=y1,yend=y2,alpha=pid,colour=dir)) +
geom_segment() +
geom_point() +
geom_point(aes(x2,y2)) +
scale_x_continuous(name="Reference",
breaks=xticks$breaks,
labels=xticks$labels,
minor_breaks=NULL) +
scale_y_continuous(name="Assembly",
breaks=yticks$breaks,
labels=yticks$labels,
minor_breaks=NULL) +
scale_colour_discrete(guide=FALSE) +
scale_alpha_continuous(guide=FALSE) +
theme(axis.text.y=element_text(size=6,angle=45),
axis.text.x=element_text(size=6,angle=45,hjust=1))
pdf(file=sprintf("%s-gg.pdf",output), width=7, height=6.5)
print(p)
dev.off()
png(file=sprintf("%s-gg.png",output), width=800, height=800)
print(p)
dev.off()