[BioC] rtracklayer export: enable trackline for GRanges and RleLists, etc?

Janet Young jayoung at fhcrc.org
Wed Apr 2 20:40:21 CEST 2014


Hi there,

I'd love to put in a request, if I can?   Using the devel version of tracklayer, I'd like to be able to include a trackline when I export GRanges, and RleLists, etc.  It looks like that's not implemented right now?  I know there's a manual way to do this (write a trackline to its own file, then append the export to that file), but it'd be really nice to have that functionality in the export function at some point in the future.  

I've included some code below to show you what I mean.

thanks very much,

Janet

------------

library(rtracklayer)

### demo test item from ?export
test_path <- system.file("tests", package = "rtracklayer")
test_bed <- file.path(test_path, "test.bed")
test <- import(test_bed, asRangedData = FALSE)
test
  
## demo export from ?export: I do get a trackline in this file
test_bed_out <- file.path(tempdir(), "test.bed")
export(test, test_bed_out)

## for GRanges objects there's no trackline exported by default (that's OK):
gr <- as(test,"GRanges")
export(gr, test_bed_out)

### but it'd be really nice to be able to request a trackline specifically - it doesn't seem to be implemented right now:
myTrackLine <- new("TrackLine", name="gr", color=col2rgb("red")[,1])
export(gr, test_bed_out, trackLine=myTrackLine)
# Error in .local(object, con, format, ...) : 
#   unused argument (trackLine = <S4 object of class "TrackLine">)

## same thing for SimpleRleList
export(coverage(gr), con=test_bed_out, format="bedGraph", trackLine=myTrackLine)
#Error in .local(object, con, format, ...) : 
#  unused argument (trackLine = <S4 object of class "TrackLine">)

### my own examples include bed files for GRanges objects, and bedGraph files for SimpleRleList, but I can imagine other examples too. Would it be hard to implement trackLine option for any output format where tracklines are acceptable?

sessionInfo()

R Under development (unstable) (2013-11-06 r64163)
Platform: x86_64-unknown-linux-gnu (64-bit)

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  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] rtracklayer_1.23.20   GenomicRanges_1.15.42 GenomeInfoDb_0.99.26 
[4] IRanges_1.21.39       BiocGenerics_0.9.3   

loaded via a namespace (and not attached):
 [1] BatchJobs_1.2             BBmisc_1.5               
 [3] BiocParallel_0.5.18       Biostrings_2.31.20       
 [5] bitops_1.0-6              brew_1.0-6               
 [7] BSgenome_1.31.12          codetools_0.2-8          
 [9] DBI_0.2-7                 digest_0.6.4             
[11] fail_1.2                  foreach_1.4.1            
[13] GenomicAlignments_0.99.36 iterators_1.0.6          
[15] plyr_1.8.1                Rcpp_0.11.1              
[17] RCurl_1.95-4.1            Rsamtools_1.15.38        
[19] RSQLite_0.11.4            sendmailR_1.1-2          
[21] stats4_3.1.0              stringr_0.6.2            
[23] tools_3.1.0               XML_3.98-1.1             
[25] XVector_0.3.7             zlibbioc_1.9.0           



More information about the Bioconductor mailing list