On Sun, Apr 6, 2014 at 2:48 PM, Simon Anders <and...@embl.de> wrote:

> Hi Michael
>
> On 06/04/14 23:32, Michael Lawrence wrote:
> > On an arbitrary vector, the names do not need to be unique, but they DO
> > need to be unique on a DataFrame (according to the data.frame
> > conventions). Conditioning on whether there are duplicate names would be
> > too complicated, so it is left to the user to declare whether the names
> > are expected on the result. Since in general the vector names are not
> > valid rownames, the default is FALSE. I guess if we really wanted to be
> > consistent with R, we would mangle the names to make them unique, but
> > that check is expensive.
>
> Thanks for the response, but I'm not sure I understand it. I thought
> "use.names=TRUE" instructs "mcols" to use the rownames of the
> SummerizedExperiment object as rownames for the returned DataFrame. Now,
> as the rownames of the SummerizedExperiment have to be unique anyway (at
> least, I suppose they have to -- they are names, too, after all, and not
> just an arbitrary vector), how can it happen that duplicate names might
> appear?
>
>
I don't think the SE rownames are constrained to be unique. I haven't
tested it, but I don't see the assertion in the code. This is because an SE
is modeled as a matrix, which does not have the same constraint as a
data.frame.


> The use case: I have a SummerizedExperiment object with gene IDs in the
> rownames. Let's say I want to get the value in the meta-data column
> "yellowness" for "gene_D".
>
> With en ExpressionSet, I could write:
>    fData(es)["gene_D","yellowness"]
>
> With SummerizeExperiment, it has to be:
>    mcols(se,use.names=TRUE)["gene_D","yellowness"]
>
> Of course, it's no big deal, but I find it quite clumsy, and I wonder
> why it has to be this way.
>

Well, there's this syntax:
mcols(se["gene_D",])$yellowness


>   Simon
>

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to