Skip to content

Hic dev #3

Merged
merged 11 commits into from
Aug 16, 2018
9 changes: 5 additions & 4 deletions RLIB/cis_matrix_body_multi.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require(plyr, quietly = TRUE)
require(RColorBrewer, quietly = TRUE)
require(gridExtra, quietly = TRUE)
require(grid, quietly = TRUE)
require(ggplot2 ,quietly = TRUE)
##require(ggplot2 ,quietly = TRUE)
require(ggpmisc, quietly = TRUE)
if ( !(require("ggbio")) ) {
biocLite("ggbio")
Expand Down Expand Up @@ -145,7 +145,7 @@ if(colour_range[2] == 0){
#}

wh <- GenomicRanges::GRanges(region[["chr"]], IRanges::IRanges(as.integer(region[["start"]]),as.integer(region[["end"]])))
tset <- ggbio::autoplot(txdb , which = wh, genome.axis = FALSE, names.expr = "tx_name")
tset <- ggbio::autoplot(txdb , which = wh, genome.axis = FALSE, names.expr = "gene_id")
p2 <- tset@ggplot


Expand All @@ -154,15 +154,16 @@ palette <- c(
rgb(0,0,255,maxColorValue=255),
rgb(152,20,18,maxColorValue=255),
rgb(240,48,0,maxColorValue=255),
rgb(255,188,39,maxColorValue=255))
rgb(255,188,39,maxColorValue=255),
rgb(124,252,0,maxColorValue=255))

# triangle plot
message(paste("Constructing plot"))
p <- ggplot2::ggplot()
p <- p + geom_polygon(aes(x=x, y=y, group=group), fill="black", data=rotated_bg)
if(add_borders_to_elements){
p <- p + geom_polygon(aes(x=x, y=y, group=group, fill=signal, colour=signal), data=rotated_data, size=0.2)
p <- p + scale_colour_gradientn(limits=colour_range, colours=palette, na.value = "green")
p <- p + scale_colour_gradientn(limits=colour_range, colours=palette, na.value = "green", guide = "colourbar")
} else {
p <- p + geom_polygon(aes(x=x, y=y, group=group, fill=signal), data=rotated_data)
}
Expand Down