[Bioc-devel] Sample names on NChannelSet

Martin Morgan mtmorgan at fhcrc.org
Mon Mar 23 20:38:02 CET 2009


Hi Benilton --

Benilton Carvalho <bcarvalh at jhsph.edu> writes:

> (apologies in case this is a duplicated message - the first email was
> returned with an error)
>
> NChannelSet accepts the elements of assayData to have different
> colnames. For example:
>
> setClass("myClass", contains="NChannelSet")
> x <- y <- matrix(0, 5, 5)
> colnames(x) <- paste("x", 1:5, sep="")
> colnames(y) <- paste("y", 1:5, sep="")
> (zz1 <- new("myClass", x=x, y=y))
> (zz2 <- new("myClass", x=x, y=x))
>
> Note that the show method suggests that the sample names for zz1 is
> x1, ..., x5 (identical for zz2).
>
> Also, sampleNames() returns a list:
>
>  > sampleNames(zz1)
> $x
> [1] "x1" "x2" "x3" "x4" "x5"
>
> $y
> [1] "y1" "y2" "y3" "y4" "y5"
>
>  > sampleNames(zz2)
> $x
> [1] "x1" "x2" "x3" "x4" "x5"
>
> $y
> [1] "x1" "x2" "x3" "x4" "x5"
>
> The fact that NChannelSet accepts different sampleNames also affects
> subsetting:
>
> cols <- c("x1", "x4")
> (zz1[, cols])  ## Error: subscript out of bounds
> (zz2[, cols])
>
> Is this an intended behavior? I'd expect sample names to be the same

NChannelSet assayData is meant to have elements that have the same
dimensions, but that might have different names.

In terms of subsetting, you're right that subsetting by names (or in
general subsetting so that you select different columns from different
assayData elements) is not implemented when the assayData elements
have different sampleNames (note that zz1[,c(1, 4)] works). I could
implement a method taking a list to use for subsetting. but I suspect
that is not really what you're after?

Martin

> across elements of AssayData and sampleNames() to return a vector
> (instead of a list - side-effect of eapply).
>
> Thank you,
>
> benilton
>
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the Bioc-devel mailing list