[Bioc-devel] Fwd: Fwd: [biocore] show for GRanges

Valerie Obenchain vobencha at fhcrc.org
Wed Mar 27 21:21:47 CET 2013


Hi Vince,

Martin forwarded your message about allowing more control over the show 
method. There are now 2 global options that control the number of lines 
displayed in the head and tail:

showHeadLines
showTailLines

When set, these options affect GenomicRanges, GappedAlignments, Ranges 
and XStringSet objects. Essentially the objects that display with a 
"..." separating head and tail. Changes are in the following versions:

GenomicRanges (1.11.43)
IRanges (1.17.42)
Biostrings (2.27.14)


The default number of head/tail lines is now 5:

gr <- GRanges("chr1", IRanges(1:100, width=5))
 > gr
GRanges with 100 ranges and 0 metadata columns:
         seqnames     ranges strand
            <Rle>  <IRanges>  <Rle>
     [1]     chr1     [1, 5]      *
     [2]     chr1     [2, 6]      *
     [3]     chr1     [3, 7]      *
     [4]     chr1     [4, 8]      *
     [5]     chr1     [5, 9]      *
     ...      ...        ...    ...
    [96]     chr1 [ 96, 100]      *
    [97]     chr1 [ 97, 101]      *
    [98]     chr1 [ 98, 102]      *
    [99]     chr1 [ 99, 103]      *
   [100]     chr1 [100, 104]      *


Modify head and tail:

options("showHeadLines"=3)
options("showTailLines"=1)

 > gr
GRanges with 100 ranges and 0 metadata columns:
         seqnames     ranges strand
            <Rle>  <IRanges>  <Rle>
     [1]     chr1     [1, 5]      *
     [2]     chr1     [2, 6]      *
     [3]     chr1     [3, 7]      *
     ...      ...        ...    ...
   [100]     chr1 [100, 104]      *


Back to defaults:
options("showHeadLines"=NULL)
options("showTailLines"=NULL)

These options are not tied to a particular package or object type. Any 
author/user can make a show method aware of these, similar to the global 
option "width".

Let me know if you run into trouble or if this implementation isn't what 
you were after.

Valerie



-------- Original Message --------
Subject: [biocore] show for GRanges
Date: Wed, 20 Mar 2013 07:15:35 -0400
From: Vincent Carey <stvjc at channing.harvard.edu>
To: <biocore at stat.math.ethz.ch>

> GenomicRanges:::makePrettyMatrixForCompactPrinting
function (x, makeNakedMat.FUN)
{
     lx <- length(x)
     nms <- names(x)
     if (lx < 20L) {
         ans <- makeNakedMat.FUN(x)
         if (!is.null(nms)) {
             ans_rownames <- nms
         }
         else if (lx == 0L) {
             ans_rownames <- character(0)
         }
         else {
             ans_rownames <- paste0("[", seq_len(lx), "]")
         }
     }
     else {
         top_idx <- 1:9
         bottom_idx <- (lx - 8L):lx
...

would it be useful to have this constant (9) and its implied companion
settable by option?

	[[alternative HTML version deleted]]

_______________________________________________
Biocore mailing list
Biocore at r-project.org
https://stat.ethz.ch/mailman/listinfo/biocore



More information about the Bioc-devel mailing list