[BioC] shuffle the sample names of an expressionSet
Al Tango
time.is.flying at gmail.com
Tue Nov 11 17:01:15 CET 2008
Thanks, Martin,
I did find an error in my subsequent process. But your reply is really
helpful. I was calculating p-values of analysis using limma.
AT
On Mon, Nov 10, 2008 at 12:31 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
> Hi Al --
>
> "Al Tango" <time.is.flying at gmail.com> writes:
>
>> Hi, all, I want to randomly shuffle sample names in an object of
>> expressionSet, aiming
>> to perform permutation test. I did as follows, but the following test
>> result remained unchanged (When I shuffled the original data file
>> names before 'ReadAffy()' , the result did change). So it must be
>> wrong; what's the way please? Thanks to everybody who help / has
>> helped me.
>> e.g.
>>
>> library(affy)
>> eset=rma(ReadAffy(filenames=c('sample1.CEL','sample2.CEL','sample3.CEL'))
>>
>> # below was what I did to shuffle sample names
>>
>>
>
> This
>
>> data(sample.ExpressionSet)
>> obj1 <- obj <- sample.ExpressionSet
>> sampleNames(obj1) <- sample(sampleNames(obj))
>
> shuffles exprs and phenoData names.
>
>> head(exprs(obj), 2)
> A B C D E F G
> AFFX-MurIL2_at 192.742 85.7533 176.7570 135.5750 64.4939 76.3569 160.5050
> AFFX-MurIL10_at 97.137 126.1960 77.9216 93.3713 24.3986 85.5088 98.9086
> H I J K L M N
> AFFX-MurIL2_at 65.9631 56.9039 135.6080 63.4432 78.2126 83.0943 89.3372
> AFFX-MurIL10_at 81.6932 97.8015 90.4838 70.5733 94.5418 75.3455 68.5827
> O P Q R S T U
> AFFX-MurIL2_at 91.0615 95.9377 179.8450 152.467 180.834 85.4146 157.98900
> AFFX-MurIL10_at 87.4050 84.4581 87.6806 108.032 134.263 91.4031 -8.68811
> V W X Y Z
> AFFX-MurIL2_at 146.8000 93.8829 103.8550 64.4340 175.6150
> AFFX-MurIL10_at 85.0212 79.2998 71.6552 64.2369 78.7068
>> head(exprs(obj1), 2)
> S G W L C B I
> AFFX-MurIL2_at 192.742 85.7533 176.7570 135.5750 64.4939 76.3569 160.5050
> AFFX-MurIL10_at 97.137 126.1960 77.9216 93.3713 24.3986 85.5088 98.9086
> N Q O K R U J
> AFFX-MurIL2_at 65.9631 56.9039 135.6080 63.4432 78.2126 83.0943 89.3372
> AFFX-MurIL10_at 81.6932 97.8015 90.4838 70.5733 94.5418 75.3455 68.5827
> M Z E F Y D V
> AFFX-MurIL2_at 91.0615 95.9377 179.8450 152.467 180.834 85.4146 157.98900
> AFFX-MurIL10_at 87.4050 84.4581 87.6806 108.032 134.263 91.4031 -8.68811
> T P X A H
> AFFX-MurIL2_at 146.8000 93.8829 103.8550 64.4340 175.6150
> AFFX-MurIL10_at 85.0212 79.2998 71.6552 64.2369 78.7068
>> head(pData(obj), 2)
> sex type score
> A Female Control 0.75
> B Male Case 0.40
>> head(pData(obj1), 2)
> sex type score
> S Female Control 0.75
> G Male Case 0.40
>
> but I think it is just a tidier way of doing what you already
> did. Perhaps what you meant to do was to shuffle some aspects of
> phenoData, e.g.,
>
>> obj1 <- obj
>> pData(obj1)[["type"]] <- sample(pData(obj1)[["type"]])
>> head(pData(obj), 5)
> sex type score
> A Female Control 0.75
> B Male Case 0.40
> C Male Control 0.73
> D Male Case 0.42
> E Female Case 0.93
>> head(pData(obj1), 5)
> sex type score
> A Female Case 0.75
> B Male Case 0.40
> C Male Case 0.73
> D Male Control 0.42
> E Female Case 0.93
>
> ? What are you doing that you would like to see the permutation of?
>
> Martin
>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
> --
> 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 Bioconductor
mailing list