[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 22:54:01 CEST 2013


On 08/13/2013 01:29 PM, Cook, Malcolm wrote:
> Great Herve,
>
> Any chance of a back port to released version?

Sure. Back ported to IRanges 1.18.3.

H.

>
> THx,
>
> Malcolm
>
>   >-----Original Message-----
>   >From: Hervé Pagès [mailto:hpages at fhcrc.org]
>   >Sent: Tuesday, August 13, 2013 2:33 PM
>   >To: Cook, Malcolm
>   >Cc: 'bioconductor at r-project.org'
>   >Subject: Re: [BioC] BUG? when setting mcols of a GRanges to a DataFrame one of whose columns is an ordered factor
>   >
>   >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
>

-- 
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