[BioC] Renaming row names (U133A/B joining problem)
Daniel Brewer
daniel.brewer at icr.ac.uk
Fri Mar 23 16:51:05 CET 2007
expr.matrix is a matrix and it did work when I inverted the syntax.
Many thanks
Daniel
Martin Morgan wrote:
> Hi Daniel,
>
> I think the basic syntax is inverted --
>
> rownames(obj)[1:3] <- 3:1
>
> instead of
>
> rownames(obj[1:3,]) <- 3:1
>
> It's a little hard to tell what expr.matrix is. A matrix?
>
>> m <- matrix(0,10,5)
>> rownames(m)[1:4] <- 4:1 # need to have dims before they can be changed!
> Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent
>> rownames(m) <- 1:10
>> rownames(m)[1:4] <- 4:1
>> m
> [,1] [,2] [,3] [,4] [,5]
> 4 0 0 0 0 0
> 3 0 0 0 0 0
> 2 0 0 0 0 0
> 1 0 0 0 0 0
> 5 0 0 0 0 0
> 6 0 0 0 0 0
> 7 0 0 0 0 0
> 8 0 0 0 0 0
> 9 0 0 0 0 0
> 10 0 0 0 0 0
>
>
> But maybe it's an 'ExpressionSet' or 'exprSet'. What does
>
>> class(expr.matrix)
>
> say? If it's an ExpressionSet (or I think also an exprSet), then
> you'll want to do the equivalent of
>
>> obj <- new("ExpressionSet", exprs=matrix(0,10,5))
>> obj
> ExpressionSet (storageMode: lockedEnvironment)
> assayData: 10 features, 5 samples
> element names: exprs
> phenoData
> sampleNames: 1, 2, ..., 5 (5 total)
> varLabels and varMetadata: none
> featureData
> featureNames: 1, 2, ..., 10 (10 total)
> varLabels and varMetadata: none
> experimentData: use 'experimentData(object)'
> Annotation character(0)
>> featureNames(obj)
> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
>> featureNames(obj)[2:4] <- 4:2
>> featureNames(obj)
> [1] "1" "4" "3" "2" "5" "6" "7" "8" "9" "10"
>> obj
> ExpressionSet (storageMode: lockedEnvironment)
> assayData: 10 features, 5 samples
> element names: exprs
> phenoData
> sampleNames: 1, 2, ..., 5 (5 total)
> varLabels and varMetadata: none
> featureData
> featureNames: 1, 4, ..., 10 (10 total)
> varLabels and varMetadata: none
> experimentData: use 'experimentData(object)'
> Annotation character(0)
>
> Hope that helps,
>
> Martin
>
>
> Daniel Brewer <daniel.brewer at icr.ac.uk> writes:
>
>> Hi,
>>
>> I have a expression dataset where I want to join Affymetrix U133A and B
>> arrays. The rownames of the expression matrix are set to the probe
>> names. To do this I want to treat all the probe names that are shared
>> between the arrays as unique by appending an "_A" or "_B". I do this by
>> finding the names of the probe that are shared and then running:
>>
>> rownames(expr.matrix[match(ProbeIntersect,rownames(expr.matrix)),]) <-
>> paste(rownames(expr.matrix[match(ProbeIntersect,rownames(expr.matrix)),]),"_A",sep="")
>>
>> Where "expr.matrix" is the expression matrix and "ProbeIntersect" is the
>> list of probe names that are shared. This command though does not seem
>> to change the row names. Any idea what I am doing wrong?
>>
>> Thanks
>>
>> Daniel
>>
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Email: daniel.brewer at icr.ac.uk
**************************************************************
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.
This e-mail message is confidential and for use by the addre...{{dropped}}
More information about the Bioconductor
mailing list