[Bioc-devel] lumi: estimateMethylationBG problem

Wong, Chao-Jen cwon2 at fhcrc.org
Wed May 11 01:47:36 CEST 2011

Hi, Pan,

I am working with Illumina Infinium 540K array and have problems using the 'estimateMethylationBG' function from the lumi package.  Suppose 'methyLumiM' is my methyLumiM instance and I got the following error message:

> methyLumiM
MethyLumiM (storageMode: lockedEnvironment)
assayData: 485577 features, 24 samples
  element names: detection, exprs, methylated, unmethylated
protocolData: none
  sampleNames: 3343-WWC-SQ 3344-WWC-NSE ... 3368-NF BE (24 total)
  varLabels: sampleID label sampleGroup
  varMetadata: labelDescription
  featureNames: cg00000029 cg00000108 ... rs9839873 (485577 total)
  fvarLabels: Index TargetID ... COLOR_CHANNEL (13 total)
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation: IlluminaHumanMethylation450k
> estimateMethylationBG(methyLumiM)
Error in apply(grnData[neg.ind, ], 2, median) :
  dim(X) must have a positive length

I've tried to make sure that 'methyLumiM' has a controlData slot by the following

> controlData <- controlData(methyLumiM)
> controlData
MethyLumiQC (storageMode: lockedEnvironment)
assayData: 14 features, 24 samples
  element names: methylated, pvals, unmethylated
protocolData: none
phenoData: none
    TARGET REMOVAL (14 total)
  fvarLabels: Index TargetID
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'

I read closely the code of estimateMethylationBG(), and this is what I found:

I think the problem occurs when 'featureData' instance of the 'controlData' object only have one 'NEGATIVE'. For example,
> featureNames(controlData)
 [3] "EXTENSION"               "HYBRIDIZATION"
 [5] "NEGATIVE"                "NON-POLYMORPHIC"
 [7] "NORM_A"                  "NORM_C"
 [9] "NORM_G"                  "NORM_T"
[13] "STAINING"                "TARGET REMOVAL"
> grnData <- assayDataElement(controlData, "methylated")
> redData <- assayDataElement(controlData, "unmethylated")
> allControlType <- sapply(strsplit(featureNames(controlData), "\\."), function(x) x[1])
> allControlType <- toupper(allControlType)
> neg.ind <- which(allControlType == "NEGATIVE")
> neg.ind
[1] 5

The neg.ind variable is with length of one, and this would render the result of subsetting the grnData matrix to be a numeric vector:

> grnData[neg.ind, ]
 3343-WWC-SQ 3344-WWC-NSE  3345-RWV-SQ 3346-RWV-NSE  3347-DAF-SQ 3348-DAF-NSE
    276.8050     163.6250     185.8183     230.0850     407.9767     459.0500
 3349-PEI-SQ 3350-PEI-NSE  3351-SCO-SQ 3352-SCO-NSE  3353-SRW-SQ 3354-SRW-NSE
    260.1967     246.7550     352.0200     346.6967     483.1767     535.9650
 3555-FAM BE  3356-FAM BE  3358-FAM BE  3359-FAM BE  3360-FAM BE  3361-FAM BE
    238.0683     158.5200     176.8467     226.7267     247.6667     265.1533
  3363-NF BE   3364-NF BE   3365-NF BE   3366-NF BE   3367-NF BE   3368-NF BE
    154.0900     196.1933     184.3333     266.5150     262.8833     378.9000

grnData[neg.ind, ] is no longer a matrix, and apply does not like it. This cause the problem when I try to run the following line:

> bg.grn <- apply(grnData[neg.ind, ], 2, median)
Error in apply(grnData[neg.ind, ], 2, median) :
  dim(X) must have a positive length

I think, naively, the way to remedy it to modify the lines (603, 604 in methylation_preprocessing.R) to

			bg.grn <- apply(grnData[neg.ind, , drop=FALSE], 2, median)
			bg.red <- apply(redData[neg.ind, , drop=FALSE], 2, median)

such that grnData[neg.ind, , drop=FALSE] would still be an 1-by-n matrix, rather than just a vector.

What do you think? Do you want me to send you a small subset of my methyLumiM instance so that you can reproduce the error?


> sessionInfo()
R version 2.13.0 Under development (unstable) (2011-02-01 r54193)
Platform: x86_64-unknown-linux-gnu (64-bit)

[1] C

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

other attached packages:
[1] lumi_2.4.0      nleqslv_1.8     methylumi_1.8.0 Biobase_2.11.10

loaded via a namespace (and not attached):
 [1] AnnotationDbi_1.13.17 DBI_0.2-5             KernSmooth_2.23-4
 [4] MASS_7.3-9            Matrix_0.999375-46    RSQLite_0.9-4
 [7] affy_1.29.2           affyio_1.19.5         annotate_1.29.2
[10] grid_2.13.0           hdrcde_2.15           lattice_0.19-17
[13] mgcv_1.7-2            nlme_3.1-97           preprocessCore_1.13.6
[16] tools_2.13.0          xtable_1.5-6
Warning message:
'DESCRIPTION' file has 'Encoding' field and re-encoding is not possible

Chao-Jen Wong 
Program in Computational Biology 
Division of Public Health Sciences 
Fred Hutchinson Cancer Research Center 
1100 Fairview Avenue N., M1-B514 
PO Box 19024 
Seattle, WA 98109 
cwon2 at fhcrc.org

More information about the Bioc-devel mailing list