[BioC] [devteam-bioc] Error in calculating P-values with Genefilter function

Martin Morgan mtmorgan at fhcrc.org
Mon Jun 3 20:22:46 CEST 2013


Not sure whether you saw this part of the response to your earlier email


This error is generated when the test in the 'if' statement is NA

 > if (NA) TRUE else FALSE
Error in if (NA) TRUE else FALSE : missing value where TRUE/FALSE needed

it looks like the line of code causing the problem is from 'Anova'

 > Anova(class7,p=0.01)
function (x)
{
...
     m1 <- lm(x ~ cov)
     m2 <- lm(x ~ 1)
     av <- anova(m2, m1)
     fstat <- av[["Pr(>F)"]][2]
     if (fstat < p)
...
}

You could gain more insight by debugging this function

   afilt = Anova(class7, p=0.01)
   debug(afilt)
   Func7P0.01<-filterfun(afilt)
   ...

this should break into the browser (see ?browser) and allow you to step through 
the function, explore variables, and figure out what is going on.

We'd need a short reproducible example to provide more insight...

Martin



On 06/03/2013 11:12 AM, Maintainer wrote:
>
> To whom it may concern,
>
> I am having trouble with the genefilter function in R. I am attempting to extract genes from 7 arrays using a p-value of 0.01 using the following code:
>
> Func7P0.01<-filterfun(Anova(class7,p=0.01))
> Func7P0.01
> Anova7_P0.01<-genefilter(SCDexprs7,Func7P0.01)
> Anova7_P0.01
>
> Creating Func7P0.01 works fine, but when I run the genefilter using my data matrix and Func7P0.01 i get the following error.
>
>
>> Anova7_P0.01<-genefilter(SCDexprs7,Func7P0.01)
> Error in if (fstat < p) return(TRUE) :
>    missing value where TRUE/FALSE needed
>
>
> and when I runtraceback(), I get:
>
>> traceback()
> 4: fun(x)
> 3: FUN(newX[, i], ...)
> 2: apply(expr, 1, flist)
> 1: genefilter(SCDexprs7, Func7P0.01)
>
>
> Im not entirely sure what is going on, but when I extract genes from the same 7 arrays, plus another array (8 arrays total) using the same code structure (below) it works fine.
>
>
> Func8P0.01<-filterfun(Anova(class8,p=0.01))
> Func8P0.01
> Anova8_P0.01<-genefilter(SCDexprs8,Func8P0.01)
> Anova8_P0.01
>
>
> Any help with this matter would be greatly appreciated as I am not sure what else to try.


>
> Thanks in advance!
> Brad Cattrysse
>
>
>   -- output of sessionInfo():
>
>> sessionInfo()
> R version 3.0.0 (2013-04-03)
> 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
> [8] base
>
> other attached packages:
>   [1] pd.mogene.1.1.st.v1_3.8.0 RSQLite_0.11.3
>   [3] DBI_0.2-6                 ggplot2_0.9.3.1
>   [5] e1071_1.6-1               class_7.3-7
>   [7] pvac_1.8.0                pgmm_1.0
>   [9] mclust_4.1                cluster_1.14.4
> [11] genefilter_1.42.0         oligoData_1.8.0
> [13] oligo_1.24.0              Biobase_2.20.0
> [15] oligoClasses_1.22.0       BiocGenerics_0.6.0
>
> loaded via a namespace (and not attached):
>   [1] affxparser_1.32.0     affy_1.38.1           affyio_1.28.0
>   [4] annotate_1.38.0       AnnotationDbi_1.22.5  BiocInstaller_1.10.1
>   [7] Biostrings_2.28.0     bit_1.1-10            codetools_0.2-8
> [10] colorspace_1.2-2      dichromat_2.0-0       digest_0.6.3
> [13] ff_2.2-11             foreach_1.4.0         GenomicRanges_1.12.2
> [16] grid_3.0.0            gtable_0.1.2          IRanges_1.18.0
> [19] iterators_1.0.6       labeling_0.1          MASS_7.3-26
> [22] munsell_0.4           plyr_1.8              preprocessCore_1.22.0
> [25] proto_0.3-10          RColorBrewer_1.0-5    reshape2_1.2.2
> [28] scales_0.2.3          splines_3.0.0         stats4_3.0.0
> [31] stringr_0.6.2         survival_2.37-4       tools_3.0.0
> [34] XML_3.95-0.2          xtable_1.7-1          zlibbioc_1.6.0
>>
>
> --
> Sent via the guest posting facility at bioconductor.org.
>
> ________________________________________________________________________
> devteam-bioc mailing list
> To unsubscribe from this mailing list send a blank email to
> devteam-bioc-leave at lists.fhcrc.org
> You can also unsubscribe or change your personal options at
> https://lists.fhcrc.org/mailman/listinfo/devteam-bioc
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioconductor mailing list