Entering edit mode
Hiya,
I find that setting mcol of a GRanges to a DataFrame one of whose
columns is an ordered factor does "the wrong thing".
Not sure how to approach this other than report it for now.
Best,
Malcolm
viz:
> library(GenomicRanges)
> example(GRangesList)
> gr1
GRanges with 1 range and 2 metadata columns:
seqnames ranges strand | score GC
<rle> <iranges> <rle> | <integer> <numeric>
[1] chr2 [3, 6] + | 5 0.45
---
seqlengths:
chr2
NA
> mc1<-mcols(gr1)
> mc1$f<-factor('x')
> mcols(gr1)<-mc1
> gr1
GRanges with 1 range and 3 metadata columns:
seqnames ranges strand | score GC f
<rle> <iranges> <rle> | <integer> <numeric> <factor>
[1] chr2 [3, 6] + | 5 0.45 x
---
seqlengths:
chr2
NA
> mc1$fo<-ordered('x')
> mcols(gr1)<-mc1
> gr1
GRanges with 1 range and 4 metadata columns:
seqnames ranges strand | score GC
f fo
"<rle>" "<iranges>" "<rle>" "|" "<integer>" "<numeric>"
"<factor>" Character,2
[1] "chr2" "[3, 6]" "+" "|" "5" "0.45"
"x" "x"
---
seqlengths:
chr2
NA
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-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 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:
[1] parallel stats graphics grDevices datasets utils
methods base
other attached packages:
[1] GenomicRanges_1.12.4 IRanges_1.18.2 BiocGenerics_0.6.0
loaded via a namespace (and not attached):
[1] stats4_3.0.1 tools_3.0.1
>