hi,
My code for my analysis is as the following then my ask is in the end :
> dat
AffyBatch object
size of arrays=640x640 features (19 kb)
cdf=HG_U95Av2 (12625 affyids)
number of samples=8
number of genes=12625
annotation=hgu95av2
notes=
> dat2<-rma(dat)
> dat.m<-exprs(dat2)
> rsd<-rowSds(dat.m)
> i<-rsd>=2
> dat.f<-dat.m[i,]
> ff<-pOverA(A=1, p=0.5)
> i<-genefilter(dat.m, ff)
> dat.fo<-dat.m[i,]
> ff<-pOverA(A=1, p=0.5)
> i<-genefilter(-dat.m, ff)
> dat.fu<-dat.m[i,]
dat.f<-rbinddat.fo, dat.fu)
> design
absent10 absent48 present10 present48
1 1 0 0 0
2 1 0 0 0
3 0 0 1 0
4 0 0 1 0
5 0 1 0 0
6 0 1 0 0
7 0 0 0 1
8 0 0 0 1
attr(,"assign")
[1] 1 1 1 1
attr(,"contrasts")
attr(,"contrasts")$f
[1] "contr.treatment"
> fit<-lmFit(dat.f, design)
> fit<-eBayes(fit)
> toptable(fit, coef=2)
logFC t P.Value adj.P.Val B
AFFX-hum_alu_at 14.74942 192.5894 9.712584e-17 8.264148e-14 24.92559
31962_at 14.68759 192.0779 9.934044e-17 8.264148e-14 24.91928
35905_s_at 14.67268 191.2009 1.032704e-16 8.264148e-14 24.90838
33824_at 14.68408 190.7521 1.053488e-16 8.264148e-14 24.90275
31957_r_at 14.65359 190.7216 1.054917e-16 8.264148e-14 24.90237
34593_g_at 14.59091 189.6964 1.104239e-16 8.264148e-14 24.88938
32744_at 14.53773 189.4014 1.118907e-16 8.264148e-14 24.88561
40887_g_at 14.60499 189.0208 1.138153e-16 8.264148e-14 24.88072
2016_s_at 14.44201 188.6353 1.158025e-16 8.264148e-14 24.87575
31527_at 14.43456 188.5953 1.160108e-16 8.264148e-14 24.87523
> rn<-rownames(toptable(fit, coef=2, n=100))
> tt<-toptable(fit, coef=2, n=nrow(dat.m))
> rn<-rownames(tt)[tt$P.Value<=0.001]
Those names are actually stored in a character vector, but I
need to convert it into a numeric vector:
> rn<-as.numeric(rn)
Warning message:
NAs introduced by coercion
Also I tried the following :
> which.min(rn)
integer(0)
any help to get rn<-as.numeric(rn) please ?? Because I need it for extract the genes from the original data by the next command:
dat.s<-dat.m[rn,]
which will stores the data for the genes that were selected (as
differentially expressed).
cheers,
Tahani.
Why use an explicit match, instead of just the character subscript? You can subscript rectangular objects by rownames on the first dimension.
Ah... that's probably the simpler way. I've been using
match
in my code, mostly so that I can handle cases where the requested row name doesn't exist by intercepting the resultingNA
values. But that seems to be unnecessary here.Thanks a lot Aaron Lun ..