Skip to contents

biocmask uses pillar for its printing. If you want to change how your S4 object is printed within biocmask's print method, consider writing a method for this function.

To print S4 objects in a tibble, biocmask hacks a custom integer vector built from vctrs where the S4 object lives in an attribute named "phantomData". You can create your own S4 phantom vector with vec_phantom(). This function is not used outside of printing for biocmask

The default method for formatting a vec_phantom() is to call showAsCell().

Usage

vec_phantom(x)

biocmask_pillar_format(x, ...)

Arguments

x

The S4 object

...

other arguments passed from pillar_shaft

Value

biocmask_pillar_format -> formatted version of your S4 vector vec_phantom -> integer vector with arbitrary object in phatomData attribute.

Examples


if(require("IRanges")) {
  ilist <- IRanges::IntegerList(list(c(1L,2L,3L),c(5L,6L)))
  phantom <- vec_phantom(ilist)
  pillar::pillar_shaft(phantom)
  
  biocmask_pillar_format.CompressedIntegerList <- function(x) {
   sprintf("Int: [%i]", lengths(x))
  }
  pillar::pillar_shaft(phantom)
  rm(biocmask_pillar_format.CompressedIntegerList)
}
#> Loading required package: IRanges
#> Loading required package: BiocGenerics
#> 
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
#>     union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> Loading required package: stats4
#> 
#> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:utils’:
#> 
#>     findMatches
#> The following objects are masked from ‘package:base’:
#> 
#>     I, expand.grid, unname