LIMMA: warning coercing argument of type 'double' to logical
1
0
Entering edit mode
Guido Hooiveld ★ 4.0k
@guido-hooiveld-2020
Last seen 3 days ago
Wageningen University, Wageningen, the …

I am learning myselves to run a paired t-test in limma. Everything goes fine, but i do encounter a warning, which for me is very vague...

> fit2 <- contrasts.fit(fit, cont.matrix)
Warning message:
In any(contrasts[-est, ]) : coercing argument of type 'double' to logical

(find the complete code is used below; warning happens at almost the end)

I do know that warnings are not equal to errors, but still i would like to know what this warning means, and if possible how to avoid it.

Thanks,
Guido

> library(affy)
Loading required package: Biobase

Welcome to Bioconductor

  Vignettes contain introductory material. To view, type
  'openVignette()'. To cite Bioconductor, see
  'citation("Biobase")' and for packages 'citation(pkgname)'.

> library(limma)
> targets <- readTargets("targets_A23_paired.txt")
> targets
          FileName SibShip Strain Treatment
1   KOcontrol2.CEL       1     KO       Con
2   KOcontrol3.CEL       2     KO       Con
3   KOcontrol5.CEL       3     KO       Con
4        KOWY7.CEL       1     KO        WY
5        KOWY8.CEL       2     KO        WY
6        KOWY9.CEL       3     KO        WY
7  WTcontrol20.CEL       4     WT       Con
8  WTcontrol21.CEL       5     WT       Con
9  WTcontrol22.CEL       6     WT       Con
10      WTWY25.CEL       4     WT        WY
11      WTWY26.CEL       5     WT        WY
12      WTWY27.CEL       6     WT        WY


> data <- ReadAffy(filenames=targets$FileName)
> eset <- rma(data)
Background correcting
Normalizing
Calculating Expression
> eset
ExpressionSet (storageMode: lockedEnvironment)
assayData: 22690 features, 12 samples
  element names: exprs
phenoData
  sampleNames: KOcontrol2.CEL, KOcontrol3.CEL, ..., WTWY27.CEL  (12 total)
  varLabels and varMetadata description:
    sample: arbitrary numbering
featureData
  featureNames: 1415670_at, 1415671_at, ..., AFFX-TrpnX-M_at  (22690 total)
  fvarLabels and fvarMetadata description: none
experimentData: use 'experimentData(object)'
Annotation: moe430a


> TS <- paste(targets$Strain, targets$Treatment, sep=".")
> TS
 [1] "KO.Con" "KO.Con" "KO.Con" "KO.WY"  "KO.WY"  "KO.WY"  "WT.Con"
"WT.Con" "WT.Con" "WT.WY"  "WT.WY"  "WT.WY"
> TS <- factor(TS, levels=c("WT.Con","WT.WY","KO.Con","KO.WY"))
> SibShip <- factor(targets$SibShip)
> TS
 [1] KO.Con KO.Con KO.Con KO.WY  KO.WY  KO.WY  WT.Con WT.Con WT.Con
WT.WY  WT.WY  WT.WY
Levels: WT.Con WT.WY KO.Con KO.WY
> SibShip
 [1] 1 2 3 1 2 3 4 5 6 4 5 6
Levels: 1 2 3 4 5 6
> design <- model.matrix(~0+TS+SibShip)
> design
   TSWT.Con TSWT.WY TSKO.Con TSKO.WY SibShip2 SibShip3 SibShip4 SibShip5 SibShip6
1         0       0        1       0        0        0        0 0 0
2         0       0        1       0        1        0        0 0 0
3         0       0        1       0        0        1        0 0 0
4         0       0        0       1        0        0        0 0 0
5         0       0        0       1        1        0        0 0 0
6         0       0        0       1        0        1        0 0 0
7         1       0        0       0        0        0        1 0 0
8         1       0        0       0        0        0        0 1 0
9         1       0        0       0        0        0        0 0 1
10        0       1        0       0        0        0        1 0 0
11        0       1        0       0        0        0        0 1 0
12        0       1        0       0        0        0        0 0 1
attr(,"assign")
[1] 1 1 1 1 2 2 2 2 2
attr(,"contrasts")
attr(,"contrasts")$TS
[1] "contr.treatment"

attr(,"contrasts")$SibShip
[1] "contr.treatment"

> fit <- lmFit(eset, design)
Coefficients not estimable: SibShip6
Warning message:
Partial NA coefficients for 22690 probe(s)

> cont.matrix <- makeContrasts(WTwyvWTc=TSWT.WY-TSWT.Con,
KOwyvKOc=TSKO.WY-TSKO.Con, Diff=(TSWT.WY-TSWT.Con)-(TSKO.WY-TSKO.Con), levels=design)
> fit2 <- contrasts.fit(fit, cont.matrix)
Warning message:
In any(contrasts[-est, ]) : coercing argument of type 'double' to logical

> fit2 <- eBayes(fit2)
> topTable(fit2, coef=1, adjust="BH")
                ID    logFC  AveExpr        t      P.Value adj.P.Val B
17177   1449065_at 4.528581 6.713129 66.51179 3.781733e-16 8.580752e-12 24.96342
7192  1422997_s_at 4.298410 8.311977 56.45944 2.444477e-15 2.773259e-11 23.90403
16494   1448382_at 3.386068 9.658716 50.20860 9.290666e-15 6.124439e-11 23.04600
13289 1431833_a_at 3.538370 7.856618 49.48486 1.095883e-14 6.124439e-11 22.93425
7120  1422925_s_at 3.149781 8.072523 48.58693 1.349590e-14 6.124439e-11 22.79159
18706 1450643_s_at 2.847376 7.907519 44.87659 3.329207e-14 1.258995e-10 22.15116
296     1415965_at 3.749143 5.293939 43.70413 4.497336e-14 1.457779e-10 21.93016
12200   1428005_at 3.232843 6.882881 42.99986 5.408650e-14 1.534028e-10 21.79272
9048  1424853_s_at 4.716858 8.082727 40.20307 1.160545e-13 2.845272e-10 21.20948
6721    1422526_at 2.772829 8.060643 39.92966 1.253976e-13 2.845272e-10 21.14905

> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

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


other attached packages:
[1] moe430acdf_2.4.0 limma_2.18.0     affy_1.22.0      Biobase_2.4.1

loaded via a namespace (and not attached):
[1] affyio_1.12.0        preprocessCore_1.6.0 tools_2.9.0
limma • 4.3k views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 3 hours ago
WEHI, Melbourne, Australia

Dear Guido,

The warning is not a problem, it does not affect your results. However I will fix the code so the warning does not occur in this situation.

Best wishes
Gordon

ADD COMMENT

Login before adding your answer.

Traffic: 495 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6