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){ ...@@ -107,7 +107,7 @@ to_megabase <- function(y){
#' Interval plot GRanges #' Interval plot GRanges
#' @param gr \code{\link[GenomicRanges]{GRanges-class}} #' @param gr \code{\link[GenomicRanges]{GRanges-class}}
#' @param xref gr var used for scaling x axis #' @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 #' @param nperchrom number (default 1): n head (and n tail) targets
#' shown per chromosome #' shown per chromosome
#' @param nchrom number (default 6) of chromosomes shown #' @param nchrom number (default 6) of chromosomes shown
......
...@@ -365,22 +365,22 @@ double_flank <- function( ...@@ -365,22 +365,22 @@ double_flank <- function(
names(up) %<>% paste0('_u') # ensure unique names names(up) %<>% paste0('_u') # ensure unique names
names(dn) %<>% paste0('_d') names(dn) %<>% paste0('_d')
newgr <- c(up, dn) newgr <- c(up, dn)
txt <- sprintf('\t\t%d flank ranges: %d up + %d down',
length(newgr), length(up), length(dn))
message(txt)
# Plot # Plot
if (plot){ if (plot){
gr$set <- 'original' gr$set <- 'original'
newgr$set <- 'flanks' up$set <- 'upstream flank'
allgr <- c(gr, newgr) dn$set <- 'downstream flank'
allgr$set %<>% factor(c('original', 'flanks')) allgr <- c(gr, up, dn)
allgr$set %<>% factor(c('original', 'upstream flank', 'downstream flank'))
print(plot_intervals( print(plot_intervals(
allgr, linetype_var = linetype_var, title = txt, ...)) allgr, linetype_var = linetype_var, title = txt, y = 'targetname', ...))
newgr$set <- NULL
} }
# Return # Return
txt <- sprintf('\t\t%d flank ranges: %d up + %d down',
length(newgr), length(up), length(dn))
message(txt)
newgr newgr
} }
......
...@@ -24,7 +24,7 @@ plot_intervals( ...@@ -24,7 +24,7 @@ plot_intervals(
\item{xref}{gr var used for scaling x axis} \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 \item{nperchrom}{number (default 1): n head (and n tail) targets
shown per chromosome} 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