[BioC] BUG? when setting mcols of a GRanges to a DataFrame one of whose columns is an ordered factor
Hervé Pagès
hpages at fhcrc.org
Tue Aug 13 21:33:10 CEST 2013
Hi Malcolm,
On 08/13/2013 11:39 AM, Cook, Malcolm wrote:
> 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
Thanks for the report. Note that this is a display bug only. Fixed in
IRanges 1.19.24:
> gr1
GRanges with 1 range and 4 metadata columns:
seqnames ranges strand | score GC f fo
<Rle> <IRanges> <Rle> | <integer> <numeric> <factor> <ordered>
[1] chr2 [3, 6] + | 5 0.45 x x
---
seqlengths:
chr2
NA
Cheers,
H.
>> 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
>>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
--
Hervé Pagès
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the Bioconductor
mailing list