A block track can be created from a GRanges or IRanges object, showing the coverage of a Range-like object.

suppressPackageStartupMessages({
    library(TnT)
    library(GenomicFeatures)
})
set.seed(42)

Basic Example

Construct a IRanges object and a GRanges object.

ir <- IRanges(start = c(69, 420, 6942), width = c(10, 100, 1000))
gr <- GRanges("chr12", ir)

To construct the track and create the visualization.

btrack <- TnT::BlockTrack(gr, tooltip = as.data.frame(gr),
                          label = "My GRanges", color = "yellow")
TnT::TnTBoard(btrack, range(gr))
## - Missing argument `coord.range` and seqlength is unknown:
##   automatically set coordinate limit to -1618..9628 ...
## Warning in readLines(con): incomplete final line found on '/home/jialin/R/
## x86_64-suse-linux-gnu-library/3.4/TnT/htmlwidgets/trackWidget.yaml'



Session Info

sessionInfo()
## R version 3.4.1 (2017-06-30)
## Platform: x86_64-suse-linux-gnu (64-bit)
## Running under: openSUSE Tumbleweed
## 
## Matrix products: default
## BLAS: /usr/lib64/R/lib/libRblas.so
## LAPACK: /usr/lib64/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] parallel  stats4    methods   stats     graphics  grDevices utils    
## [8] datasets  base     
## 
## other attached packages:
## [1] GenomicFeatures_1.30.3 AnnotationDbi_1.40.0   Biobase_2.38.0        
## [4] TnT_1.3.1              GenomicRanges_1.30.3   GenomeInfoDb_1.14.0   
## [7] IRanges_2.12.0         S4Vectors_0.16.0       BiocGenerics_0.24.0   
## 
## loaded via a namespace (and not attached):
##  [1] SummarizedExperiment_1.8.1 progress_1.1.2            
##  [3] lattice_0.20-35            colorspace_1.3-2          
##  [5] htmltools_0.3.6            rtracklayer_1.38.3        
##  [7] yaml_2.1.19                blob_1.1.1                
##  [9] XML_3.98-1.10              rlang_0.2.0.9001          
## [11] pkgdown_1.0.0              DBI_0.8                   
## [13] BiocParallel_1.12.0        bit64_0.9-7               
## [15] matrixStats_0.52.2         GenomeInfoDbData_1.0.0    
## [17] stringr_1.3.0              zlibbioc_1.24.0           
## [19] Biostrings_2.46.0          commonmark_1.4            
## [21] htmlwidgets_1.2            memoise_1.1.0             
## [23] evaluate_0.10.1            knitr_1.20                
## [25] biomaRt_2.34.2             Rcpp_0.12.16              
## [27] backports_1.1.2-9000       DelayedArray_0.4.1        
## [29] desc_1.2.0                 jsonlite_1.5              
## [31] XVector_0.18.0             fs_1.2.2                  
## [33] bit_1.1-12                 Rsamtools_1.30.0          
## [35] RMySQL_0.10.14             digest_0.6.15             
## [37] stringi_1.2.2              grid_3.4.1                
## [39] rprojroot_1.3-2            tools_3.4.1               
## [41] bitops_1.0-6               magrittr_1.5              
## [43] RCurl_1.95-4.10            RSQLite_2.1.0             
## [45] crayon_1.3.4               Matrix_1.2-10             
## [47] MASS_7.3-47                xml2_1.1.1                
## [49] prettyunits_1.0.2          assertthat_0.2.0          
## [51] rmarkdown_1.9              roxygen2_6.0.1            
## [53] httr_1.3.1                 R6_2.2.2                  
## [55] GenomicAlignments_1.14.2   compiler_3.4.1