Yea, unfortunately rtracklayer export is still completely based on
RangedData, which forces the ordering by chromosome. Over this release
cycle, I'll try to rewrite everything. Shouldn't be too bad.


On Tue, Oct 22, 2013 at 6:29 AM, Nathan Sheffield [guest] <
guest@bioconductor.org> wrote:

>
> 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)))
> export.bed(gr, "gr_order.bed");
>
> 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)
>
> locale:
>  [1] 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
>  [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=C                 LC_NAME=C
>            LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] 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):
>  [1] 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
>  [9] XML_3.98-1.1      zlibbioc_1.4.0
>
> --
> Sent via the guest posting facility at bioconductor.org.
>

	[[alternative HTML version deleted]]

