-
Notifications
You must be signed in to change notification settings - Fork 4
/
plot_chrom.r
39 lines (29 loc) · 1.04 KB
/
plot_chrom.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
require(IdeoViz)
require(RColorBrewer)
args = commandArgs(trailingOnly=TRUE)
fileA = args[1]
fileB = args[2]
# fileA = "pgWatson.coverage"
# fileB = "pgVenter.coverage"
A = read.table(fileA, as.is = T, sep="\t", header=F)
B = read.table(fileB, as.is = T, sep="\t", header=F)
windows_size = A$V3[1] - A$V2[1]
ideo <- getIdeo("hg19")
data = GRanges(A$V1, IRanges(start = A$V2, end = A$V3) )
mcols(data)$group1 = scale(B$V4) - 2
mcols(data)$group2 = scale(A$V4) + 2
png("both.png", width = 4000, height = 1200, units = "px")
par(mar = c(0, 0, 0, 0), mfrow = c(1,1))
plotOnIdeo(chrom = seqlevels(data),
ideoTable = ideo,
values_GR = data,
value_cols = colnames(mcols(data)),
col = c('orange', 'blue'),
addScale = F,
val_range=c(-5,5),
plotType='lines',
plot_title = paste("Differrence between", gsub(".coverage","",fileA), gsub(".coverage","",fileB), "bin",windows_size),
cex.axis = 0.8,
chromName_cex = 0.6,
vertical = T)
dev.off()