[BioC] Question about rtracklayer GenomicRanges bed export order
Nathan Sheffield [guest]
guest at bioconductor.org
Tue Oct 22 15:29:15 CEST 2013
Is there a way to specify order for the export.bed function in rtracklayer? I have searched but cannot find a way.
Here is a simple example. Say you import a bed file, do some operation (like shift each region by 500 bp), then you want to export it, in the same order it was when you imported it.
It seems to me that rtracklayer's export.bed is automatically ordering to the "natural order" of the genomic ranges -- I cannot find a way to disable this.
Here's a reproducible example:
gr = GRanges(seqnames=c("chr6", "chr4"), ranges=IRanges(c(1,50), c(70,90)))
The exported file, gr_order.bed, will have the order inverted to put chr4 first. Even if you try to specify an order by subsetting gr, it still orders it how it wants.
I feel like I'm missing something simple but for some reason can't track it down...
-- output of sessionInfo():
R version 2.15.1 (2012-06-22)
Platform: x86_64-redhat-linux-gnu (64-bit)
 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=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
 stats graphics grDevices utils datasets methods base
other attached packages:
 data.table_1.8.10 rtracklayer_1.18.2 GenomicRanges_1.10.7 IRanges_1.16.6 BiocGenerics_0.4.0
loaded via a namespace (and not attached):
 Biostrings_2.26.3 bitops_1.0-6 BSgenome_1.26.1 parallel_2.15.1 RCurl_1.95-4.1 Rsamtools_1.10.2 stats4_2.15.1 tools_2.15.1
 XML_3.98-1.1 zlibbioc_1.4.0
Sent via the guest posting facility at bioconductor.org.
More information about the Bioconductor