# [BioC] Most stable gene pairs in array experiment

Michael Dondrup Michael.Dondrup at bccs.uib.no
Tue Oct 20 10:44:56 CEST 2009

```Hi,

you can  try something like this or use two for loops:

> apply (mygenes, 1 , function(row) { apply (mygenes, 1, function(x)
{ var(row-x)  } ) } )

geneA   geneB   geneC   geneD   geneE
geneA 0.00000 0.04108 0.06397 0.12217 0.08233
geneB 0.04108 0.00000 0.15543 0.12807 0.09365
geneC 0.06397 0.15543 0.00000 0.08628 0.08903
geneD 0.12217 0.12807 0.08628 0.00000 0.01517
geneE 0.08233 0.09365 0.08903 0.01517 0.00000

Cheers
Michael

Am 20.10.2009 um 10:09 schrieb David martin:

> Exactly that what i want to do.
> How could i do that on the whole matrix taking all pairs (or at
> least one fixed gene ,e.g geneA and compute all var comparisons
> var(geneA-geneB) var(geneA-geneC) var(geneA-geneC) and see which
> variance is better ??
> thanks
>
> Naomi Altman wrote:
>> It sounds to me like you are looking for var(geneA-geneB).
>> --Naomi
>> At 05:54 AM 10/19/2009, anna freni sterrantino wrote:
>>> Hi  David,
>>> not sure what do you mean with stable,
>>> but you might be interested in correlation,
>>>
>>> a=matrix(sample(1:100),4,5)
>>> rownames(a)=paste("gene", letters[1:4])
>>> colnames(a)=paste("cond", letters[1:5])
>>>  >a
>>> cond a cond b cond c cond d cond e
>>> gene a     95     31      3      9     93
>>> gene b     16     67     83     81     86
>>> gene c     59     79     44     77     39
>>> gene d     36     92     41     57     66
>>> > cor(t(a))
>>>          gene a     gene b     gene c     gene d
>>> gene a  1.0000000 -0.5362894 -0.3830295 -0.1109239
>>> gene b -0.5362894  1.0000000 -0.1710537  0.3790986
>>> gene c -0.3830295 -0.1710537  1.0000000  0.4612277
>>> gene d -0.1109239  0.3790986  0.4612277  1.0000000
>>>
>>> and then  across all the pairs the most correlated will be those
>>> that have  a correlation value that is close to  |1|.
>>> The correlation tells you how much close are two variables in terms
>>> of linear relationship.
>>>
>>> Hope this helps.
>>> Cheers
>>>
>>> A
>>>
>>>
>>>
>>> Anna Freni Sterrantino
>>> Ph.D Student
>>> Department of Statistics
>>> University of Bologna, Italy
>>> via Belle Arti 41, 40124 BO.
>>>
>>>
>>>
>>>
>>> ________________________________
>>> Da: David martin <vilanew at gmail.com>
>>> A: bioconductor at stat.math.ethz.ch
>>> Inviato: Lun 19 ottobre 2009, 10:37:08
>>> Oggetto: [BioC] Most stable gene pairs in array experiment
>>>
>>> Hi,
>>> I have the following matrix with normalized log2 values:
>>> CondA    CondB    CondC    CondD    CondE
>>> geneA    -6.19    -5.74    -5.82    -5    -5.59
>>> geneB    -6.33    -5.32    -5.6    -4.88    -5.39
>>> geneC    -6.15    -6.07    -5.6    -4.88    -5.9
>>> geneD    -6.57    -6.11    -6.36    -5.36    -5.96
>>> geneD    -6.74    -6.2    -5.49    -5.35    -5.95
>>> geneE    -6.75    -6.24    -5.73    -5.63    -6.02
>>>
>>>
>>> Created as follows:
>>> geneA<-c(-6.19,   -5.74,   -5.82,   -5,  -5.59)
>>> geneB<-c(-6.33,   -5.32,   -5.6,    -4.88,   -5.39)
>>> geneC<-c(-6.15, -6.07, -5.6, -4.88, -5.9)
>>> geneD<-c(-6.57,   -6.11,   -6.36,   -5.36,   -5.96)
>>> geneD<-c(-6.74,   -6.2,    -5.49,   -5.35,   -5.95)
>>> geneE<-c(-6.75,   -6.24,   -5.73,   -5.63,   -6.02)
>>>
>>> mygenes<-rbind(geneA, geneB, geneC, geneD, geneE)
>>> colnames(mygenes)<-c("CondA",   "CondB",   "CondC",   "CondD",
>>> "CondE")
>>>
>>> I'm looking for most stable pair genes across conditions. I'm not
>>> looking for individual gene variance but really for most stable
>>> pairs ratios.
>>> For e.g What is the variance of geneA vs geneB across all
>>> conditions. What is the most stable pair ?
>>>
>>> Any help would be appreciated.
>>>
>>> david
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> 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
>> Naomi S. Altman                                814-865-3791 (voice)
>> Associate Professor
>> Dept. of Statistics                              814-863-7114 (fax)
>> Penn State University                         814-865-1348
>> (Statistics)
>> University Park, PA 16802-2111
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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

```