Dear all,

i have problem in comparing two toptable

toptable A

data<-ReadAffy(widget=T)
data.rma<-rma(data)
design <- cbind(WT=c(0,0,1,1),MU=c(1,1,0,0))
colnames(design) <- c("WT","MU")
fit <- lmFit(data.rma, design)
cont.matrix <- makeContrasts(MUvsWT=MU-WT, levels=design)
cont.matrix
fit2 <- contrasts.fit(fit, cont.matrix)
fit2 <- eBayes(fit2)
topTable(fit2, adjust="BH")
topTable(fit2, adjust="BH",confint=TRUE)

            ID     logFC    CI.025    CI.975  AveExpr         t      P.Value
9878  1377329_at  6.471733  6.285806  6.657660 7.237431  68.22231
5.128839e-10
7779  1375230_at  6.021966  5.799411  6.244521 7.699632  53.03330
2.372552e-09
5602  1373053_at  3.943716  3.772685  4.114748 9.863075  45.19368
6.271905e-09
18553 1386128_at -3.451197 -3.627397 -3.274997 6.755917 -38.38945
1.689248e-08
10322 1377774_at  4.027673  3.812603  4.242744 9.383797  36.70470
2.217963e-08
28230 1396344_at -3.598380 -3.793991 -3.402770 5.265303 -36.05482
2.471829e-08
16850 1384309_at -3.665845 -3.877730 -3.453960 6.425085 -33.90959
3.585708e-08
23580 1391512_at -3.120271 -3.302527 -2.938015 5.871875 -33.55511
3.821572e-08
3686  1371137_at  3.838997  3.609084  4.068909 6.590163  32.72682
4.446685e-08
1751  1369202_at  3.881571  3.631429  4.131713 6.100156  30.41373
6.932570e-08
         adj.P.Val         B
9878  1.595018e-05 10.405175
7779  3.689199e-05 10.000273
5602  6.501666e-05  9.653808
18553 1.281190e-04  9.217486
10322 1.281190e-04  9.081870
28230 1.281190e-04  9.025965
16850 1.485588e-04  8.825615
23580 1.485588e-04  8.789987
3686  1.536527e-04  8.703707
1751  2.044349e-04  8.438207



### NOW I TAKE THE LIST CONTAINING ONLY THE GENES THAT I WOULD LIKE TO
COMPARE IN THE NEXT ANALISYS ###

geni<-topTable(fit2, adjust="BH",confint=TRUE)$ID

> geni
 [1] "1377329_at" "1375230_at" "1373053_at" "1386128_at" "1377774_at"
 [6] "1396344_at" "1384309_at" "1391512_at" "1371137_at" "1369202_at"


### i load the next dataset ###

data1<-ReadAffy(widget=T)
data1.rma<-rma(data1)
fit1 <- lmFit(data1.rma, design)
fit12 <- contrasts.fit(fit1, cont.matrix)
fit12 <- eBayes(fit12)
topTable(fit12, adjust="BH")
fit12

### i select in the second toptable only the genes that i have found in the
first toptable ###

fit12[geni,]
topTable(fit12[geni,], adjust="BH")

toptable B

          ID       logFC      CI.025     CI.975  AveExpr          t
5  1377774_at  0.59097177  0.42056801 0.76137553 7.420289  6.7972876
9  1371137_at  0.35342217  0.18354810 0.52329624 3.910452  4.0776955
3  1373053_at  0.14288085 -0.03031712 0.31607882 7.923810  1.6168857
10 1369202_at  0.29962748 -0.11431021 0.71356517 3.526088  1.4187137
1  1377329_at  0.23248032 -0.09254813 0.55750878 3.740884  1.4018867
8  1391512_at -0.09952800 -0.27547764 0.07642164 7.373388 -1.1086769
7  1384309_at  0.08555764 -0.08479778 0.25591306 8.014597  0.9843532
4  1386128_at -0.09997307 -0.30833095 0.10838482 8.220204 -0.9404185
6  1396344_at -0.09588201 -0.30467205 0.11290802 6.850412 -0.9000683
2  1375230_at -0.05188944 -0.22442774 0.12064887 3.864847 -0.5894426
        P.Value   adj.P.Val         B
5  0.0006301981 0.006301981 -3.000510
9  0.0073493692 0.036746846 -3.402337
3  0.1599104563 0.426525478 -4.370428
10 0.2085487414 0.426525478 -4.473515
1  0.2132627388 0.426525478 -4.482193
8  0.3123780439 0.449663059 -4.628625
7  0.3650716821 0.449663059 -4.686366
4  0.3853275454 0.449663059 -4.705891
6  0.4046967527 0.449663059 -4.723360
2  0.5782805807 0.578280581 -4.839556


now i have two toptable with the same genes

i would like to know if there is a way in order to create a table with 5
columns:

1° column: geneName
2° column: logFC (for the first analisys)
3° column: logFC (for the second analisys)

for the first 3 columns there are no problems, but now i would like to
obtain:

4° column: Here a value estimate the% change in each gene (comparing the
logFC from Column 3 respect to the logFC from Column 2)
5° column: only if it is possible, to have a statistical value that can
compare column 3 with respect to 2

thanks a lot for the help!

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] tools     tcltk     stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
 [1] rat2302cdf_2.9.1      AnnotationDbi_1.16.8  tkWidgets_1.32.0
 [4] DynDoc_1.32.0         widgetTools_1.32.0    multtest_2.10.0
 [7] factDesign_1.30.0     affyPLM_1.30.0        preprocessCore_1.16.0
[10] gcrma_2.26.0          vsn_3.22.0            affy_1.32.0
[13] limma_3.10.0          RColorBrewer_1.0-5    GeneMeta_1.26.0
[16] genefilter_1.36.0     Biobase_2.14.0        BiocInstaller_1.2.1
[19] metafor_1.6-0         Formula_1.0-1         nlme_3.1-102

loaded via a namespace (and not attached):
 [1] affyio_1.22.0     annotate_1.32.0   Biostrings_2.22.0 DBI_0.2-5
 [5] grid_2.14.0       IRanges_1.12.4    lattice_0.20-0    MASS_7.3-16
 [9] RSQLite_0.11.0    splines_2.14.0    survival_2.36-10  xtable_1.6-0
[13] zlibbioc_1.0.0


-- 
-----------------------------------------------------
Dr. Alberto Goldoni
Parma, Italy
-----------------------------------------------------

	[[alternative HTML version deleted]]

