SAM和samR输出的问题

时间:2012-11-24 21:41:53

标签: r

我在csv格式表中有以下基因信息:

                    1       1       1       2     2         2
1415670_at  1   365.1   293.4   288.9   394.5   312     381.6
1415671_at  2   556.1   584.2   567.8   592.8   471.6   513.1
1415672_at  3   1048.3  763.1   1074.9  852.3   826.1   898.3
1415673_at  4   60.8    51.7    51.6    224     248.4   150.7
1415674_at  5   129.1   107.2   230.4   175.5   250.5   172.4

我一直在运行SAM for Excel,可在http://www-stat.stanford.edu/~tibs/SAM/中找到 结果如下:

Positive genes (3)                              
Row Gene ID Gene Name   Score(d)    Numerator(r)    Denominator(s+s0)   Fold Change q-value(%)
5   1415673_at  4   2.539689902 153 60.24357537 1.14E+46    0
2   1415670_at  1   0.707325294 46.9    66.30612588 1.31313E+14 0
6   1415674_a_at    5   0.574118361 43.9    76.46506883 1.64141E+13 0

我正在使用的参数如下图所示:

enter image description here

当我使用samR for R时使用以下程序:

 filename<-"test.csv"
 y <- c(1,1,1,2,2,2)        
 m <- read.csv(filename,sep=",",row.names=1)
 t <- as.matrix(m)
 samfit <- SAM(t, y, resp.type="Two class unpaired",
          nperms=100, testStatistic=c("standard"),
          knn.neighbor=10, random.seed=1234567, logged2=TRUE)
 print(samfit)
 rownames(m)[ as.numeric( samfit$siggenes.table$genes.up[ , "Gene Name"]) ]
 rownames(m)[ as.numeric( samfit$siggenes.table$genes.lo[ , "Gene Name"]) ]

结果更加不同:

Call:
SAM(x = t, y = y, resp.type = "Two class unpaired", nperms = 100, 
    testStatistic = c("standard"), knn.neighbors = 10, random.seed = 1234567, 
    logged2 = TRUE)

Genes up
     Gene ID Gene Name Score(d) Numerator(r) Denominator(s+s0)
[1,] g5      5         1.173    115.375      98.348           
[2,] g4      4         0.877    107.867      122.948          
     Fold Change          q-value(%)
[1,] 5.38686075651057e+34 0         
[2,] 2.95870863324773e+32 0         

Genes down
NULL
     rownames(m)[ as.numeric( samfit$siggenes.table$genes.up[ , "Gene Name"])]

     [1] "1415674_a_at" "1415673_at"  
     rownames(m)[ as.numeric( samfit$siggenes.table$genes.lo[ , "Gene Name"])]

     character(0)

这对于庞大的数据集来说会变得更糟,有人知道为什么吗?

未格式化的数据是:

,,1,1,1,2,2,2
1415670_at,1,365.1,293.4,288.9,394.5,312,381.6
1415671_at,2,556.1,584.2,567.8,592.8,471.6,513.1
1415672_at,3,1048.3,763.1,1074.9,852.3,826.1,898.3
1415673_at,4,60.8,51.7,51.6,224,248.4,150.7
1415674_a_at,5,129.1,107.2,230.4,175.5,250.5,172.4

我也尝试过未记录的数据,SAM和samR的结果仍然不同。

1 个答案:

答案 0 :(得分:1)

我加载了库(我猜?案例很重要,你说samR

library(samr)

和您的样本输入数据

txt <- textConnection(",,1,1,1,2,2,2
1415670_at,1,365.1,293.4,288.9,394.5,312,381.6
1415671_at,2,556.1,584.2,567.8,592.8,471.6,513.1
1415672_at,3,1048.3,763.1,1074.9,852.3,826.1,898.3
1415673_at,4,60.8,51.7,51.6,224,248.4,150.7
1415674_a_at,5,129.1,107.2,230.4,175.5,250.5,172.4")

m <- read.csv(txt, row.names=1)

我有

> head(as.matrix(m))
             X.1     X1  X1.1   X1.2    X2  X2.1  X2.2
1415670_at     1  365.1 293.4  288.9 394.5 312.0 381.6
1415671_at     2  556.1 584.2  567.8 592.8 471.6 513.1
1415672_at     3 1048.3 763.1 1074.9 852.3 826.1 898.3
1415673_at     4   60.8  51.7   51.6 224.0 248.4 150.7
1415674_a_at   5  129.1 107.2  230.4 175.5 250.5 172.4

不需要m的第一列,所以我在转换为矩阵之前删除它 - 这是你的错误吗?

t <- as.matrix(m[,-1])

然后适合

y <- rep(1:2, each=3)
samfit <- SAM(t, y, resp.type="Two class unpaired",
              nperms=100, testStatistic=c("standard"),
              knn.neighbor=10, random.seed=1234567, logged2=TRUE,
              genenames=rownames(t))

结果与m的第一列未删除时的结果不同。