Commit 590f1bad authored by aditya.bhagwat's avatar aditya.bhagwat
Browse files

double_flank: improve plot (have flanks and target on same y line)

parent af755ac7
......@@ -107,7 +107,7 @@ to_megabase <- function(y){
#' Interval plot GRanges
#' @param gr \code{\link[GenomicRanges]{GRanges-class}}
#' @param xref gr var used for scaling x axis
#' @param y 'contig' (default) or name of gr variable
#' @param y 'names' (default) or name of gr variable
#' @param nperchrom number (default 1): n head (and n tail) targets
#' shown per chromosome
#' @param nchrom number (default 6) of chromosomes shown
......
......@@ -365,22 +365,22 @@ double_flank <- function(
names(up) %<>% paste0('_u') # ensure unique names
names(dn) %<>% paste0('_d')
newgr <- c(up, dn)
txt <- sprintf('\t\t%d flank ranges: %d up + %d down',
length(newgr), length(up), length(dn))
message(txt)
# Plot
if (plot){
gr$set <- 'original'
newgr$set <- 'flanks'
allgr <- c(gr, newgr)
allgr$set %<>% factor(c('original', 'flanks'))
up$set <- 'upstream flank'
dn$set <- 'downstream flank'
allgr <- c(gr, up, dn)
allgr$set %<>% factor(c('original', 'upstream flank', 'downstream flank'))
print(plot_intervals(
allgr, linetype_var = linetype_var, title = txt, ...))
newgr$set <- NULL
allgr, linetype_var = linetype_var, title = txt, y = 'targetname', ...))
}
# Return
txt <- sprintf('\t\t%d flank ranges: %d up + %d down',
length(newgr), length(up), length(dn))
message(txt)
newgr
}
......
......@@ -24,7 +24,7 @@ plot_intervals(
\item{xref}{gr var used for scaling x axis}
\item{y}{'contig' (default) or name of gr variable}
\item{y}{'names' (default) or name of gr variable}
\item{nperchrom}{number (default 1): n head (and n tail) targets
shown per chromosome}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment