Question: Help resovling"Error in lm.fit" with 'dmpFinder' function in minfi
0
5.0 years ago by
michael.zulyniak0 wrote:

Hello,

I've begun processing Methylation450 data using them infi package. The operation has been flawless through data input: (read.450k.exp), phenotype table (pData), Illumina background normalization (preprocessIllumina), and SWAN normalization (preprocessSWAN). However, I am some difficulty with dmpFinder that I cannot figure out or find on any chat/help forums other than 'Iimma' but they have not provided a solution.

After successfully creating a SWAN normalized dataset I'm ready to find differentially methylated regions between individuals at the start and end of a trial (e.g.,"0" and "1") using dmpHunter. However, I am getting an error that I cannot solve: Error in lm.fit(design, t(M)) : incompatible dimensions. Here is my process that produces the error.

>pd1 <- pData(RGset)

>Mset.swan <- preprocessSWAN(RGset, MSet.norm)

>M <- getM(Mset.swan, type = "beta", betaThreshold = 0.001)

>dmpTimePoint <- dmpFinder(M, pheno=pd1$TimePoint, type = "categorical") Error in lm.fit(design, t(M)) : incompatible dimensions At first I thought the issue was with the dimensions of 'M' or 'pd', but they're both 168: > dim(M) [1] 485512 168 > dim(pd) [1] 168 17 I then tried removing any 'NA' values in 'pd' but that resulted in the same error message: Error in lm.fit(design, t(M)) : incompatible dimensions As requested, here is the output for the sessionInfo() command: R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods base other attached packages: [1] GPArotation_2012.3-1 [2] psych_1.4.8.11 [3] minfiData_0.3.4 [4] IlluminaHumanMethylation450kannotation.ilmn.v1.2_0.1.3 [5] IlluminaHumanMethylation450kmanifest_0.4.0 [6] minfi_1.6.0 [7] Biostrings_2.28.0 [8] GenomicRanges_1.12.5 [9] IRanges_1.18.4 [10] reshape_0.8.5 [11] lattice_0.20-29 [12] Biobase_2.20.1 [13] BiocGenerics_0.6.0 loaded via a namespace (and not attached): [1] beanplot_1.1 grid_3.0.1 illuminaio_0.2.0 [4] limma_3.16.8 MASS_7.3-34 matrixStats_0.10.0 [7] mclust_4.3 multtest_2.16.0 nor1mix_1.2-0 [10] plyr_1.8.1 preprocessCore_1.22.0 R.methodsS3_1.6.1 [13] RColorBrewer_1.0-5 Rcpp_0.11.2 siggenes_1.34.0 [16] splines_3.0.1 stats4_3.0.1 survival_2.37-7 [19] tools_3.0.1 Thank you in advance, any and all help would be greatly appreciated. Sincerely, Mike Zulyniak McMaster University ADD COMMENTlink modified 5.0 years ago by James W. MacDonald51k • written 5.0 years ago by michael.zulyniak0 Answer: Help resovling"Error in lm.fit" with 'dmpFinder' function in minfi 0 5.0 years ago by United States James W. MacDonald51k wrote: Hi Michael, That's a weird error, given that dmpFinder() ensures that the the length of your pheno vector is equal to the number of columns in M: n <- length(pheno) if (n != ncol(M)) stop("length of pheno does not equal number of samples") Without knowing more about your M and pheno arguments, you will have to debug yourself: debug(dmpFinder) dmpTimePoint <- dmpFinder(M, pheno=pd1$TimePoint, type = "categorical") Then step through the function until you get to the lines (right near the beginning) if (type == "categorical") { pheno <- factor(as.character(pheno)) design <- model.matrix(~pheno) fit <- lmFit(M, design) and check the dimensions of M and the design matrix, because they are obviously not compatible at that point. Best, Jim On Thu, Sep 18, 2014 at 2:31 PM, michael.zulyniak on Biostar < noreply@bioconductor.org> wrote: > Activity on a post you are following on support.bioconductor.org > > User michael.zulyniak <https: support.bioconductor.org="" u="" 6748=""/> wrote Question: > Help with function 'dmpFinder' in minfi library > <https: support.bioconductor.org="" p="" 61544=""/>: > > Hello, > > I've begun processing Methylation450 data using them infi package. The > operation has been flawless through data input: (read.450k.exp), phenotype > table (pData), Illumina background normalization (preprocessIllumina), and > SWAN normalization (preprocessSWAN). However, I am some difficulty with *dmpFinder > *that I cannot figure out or find on any chat/help forums other than > 'Iimma' but they have not provided a solution. > > After successfully creating a SWAN normalized dataset I'm ready to find > differentially methylated regions between individuals at the start and end > of a trial (e.g.,"0" and "1") using dmpHunter. However, I am getting an > error that I cannot solve. > > *>pd1 <- pData(RGset)* > > *>Mset.swan <- preprocessSWAN(RGset, MSet.norm)* > > *>M <- getM(Mset.swan, type = "beta", betaThreshold = 0.001)* > > *>dmpTimePoint <- dmpFinder(M, pheno=pd1\$TimePoint, type = "categorical")* > > *Error in lm.fit(design, t(M)) : incompatible dimensions* > > > > At first I thought the issue was with the dimensions of 'M' or 'pd', but > they're both 168: > > > > > *> dim(M) [1] 485512 168 > dim(pd) [1] 168 17* > > I then tried removing any 'NA' values in 'pd' but that resulted in the > same error message: > > *Error in lm.fit(design, t(M)) : incompatible dimensions* > > > > As requested, here is the output for the sessionInfo() command: > > R version 3.0.1 (2013-05-16) > Platform: x86_64-apple-darwin10.8.0 (64-bit) > > locale: > [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 > > attached base packages: > [1] parallel stats graphics grDevices utils datasets methods > base > > other attached packages: > [1] GPArotation_2012.3-1 > [2] psych_1.4.8.11 > [3] minfiData_0.3.4 > [4] IlluminaHumanMethylation450kannotation.ilmn.v1.2_0.1.3 > [5] IlluminaHumanMethylation450kmanifest_0.4.0 > [6] minfi_1.6.0 > [7] Biostrings_2.28.0 > [8] GenomicRanges_1.12.5 > [9] IRanges_1.18.4 > [10] reshape_0.8.5 > [11] lattice_0.20-29 > [12] Biobase_2.20.1 > [13] BiocGenerics_0.6.0 > > loaded via a namespace (and not attached): > [1] beanplot_1.1 grid_3.0.1 illuminaio_0.2.0 > [4] limma_3.16.8 MASS_7.3-34 matrixStats_0.10.0 > [7] mclust_4.3 multtest_2.16.0 nor1mix_1.2-0 > [10] plyr_1.8.1 preprocessCore_1.22.0 R.methodsS3_1.6.1 > [13] RColorBrewer_1.0-5 Rcpp_0.11.2 siggenes_1.34.0 > [16] splines_3.0.1 stats4_3.0.1 survival_2.37-7 > [19] tools_3.0.1 > > > > > > Thank you in advance, any and all help would be greatly appreciated. > > > > Sincerely, > > Mike Zulyniak > > McMaster University > > ------------------------------ > > You may reply via email or visit Help resovling"Error in lm.fit" with 'dmpFinder' function in minfi > -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099

Hi Jim,

Thanks for the reply. I'll give it shot and let you know how it turns out. The debug() function is a new one to me but certainly makes sense as a good place to start.

I'll let you know how it turns out.

Mike