Question: rtracklayer export: enable trackline for GRanges and RleLists, etc?
5.6 years ago by
Janet Young • 740
Fred Hutchinson Cancer Research Center, Seattle, WA, USA
Janet Young • 740 wrote:
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:  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C  LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8  LC_PAPER=en_US.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages:  parallel stats graphics grDevices utils datasets methods  base other attached packages:  rtracklayer_1.23.20 GenomicRanges_1.15.42 GenomeInfoDb_0.99.26  IRanges_1.21.39 BiocGenerics_0.9.3 loaded via a namespace (and not attached):  BatchJobs_1.2 BBmisc_1.5  BiocParallel_0.5.18 Biostrings_2.31.20  bitops_1.0-6 brew_1.0-6  BSgenome_1.31.12 codetools_0.2-8  DBI_0.2-7 digest_0.6.4  fail_1.2 foreach_1.4.1  GenomicAlignments_0.99.36 iterators_1.0.6  plyr_1.8.1 Rcpp_0.11.1  RCurl_1.95-4.1 Rsamtools_1.15.38  RSQLite_0.11.4 sendmailR_1.1-2  stats4_3.1.0 stringr_0.6.2  tools_3.1.0 XML_3.98-1.1  XVector_0.3.7 zlibbioc_1.9.0
ADD COMMENT • link •