[Bioc-devel] Sample names on NChannelSet

Wolfgang Huber huber at ebi.ac.uk
Thu Apr 2 22:58:10 CEST 2009


Hi Martin

my understanding of NChannelSet is that the element matrices of the 
assayData should have the same column names, which are identical with 
the "sampleNames".

Or do you see a convincing use case for different column names?

  Best wishes
	Wolfgang


Martin Morgan wrote:
> 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
> 


-- 

Best wishes
      Wolfgang

----------------------------------------------------
Wolfgang Huber, EMBL-EBI, http://www.ebi.ac.uk/huber



More information about the Bioc-devel mailing list