[BioC] genefilter problem

Wayne Xu wxu at msi.umn.edu
Wed Mar 18 20:03:51 CET 2009


Hello,

I created a filter function to filter the microarray data set by row 
variance, but got follow error:

 > dim(data1)
[1] 7129   38
 > data1[1,2:4]
  data[, 4] data[, 6] data[, 8]
1      -139       -76      -135


 > myfilter<-function(j){
+    function(x){
+    rowVars(x)<j
+    }
+ }
 >
 > ff<-filterfun(myfilter(20))
 > filt<-genefilter(data1,ff)
Error in rowSums(!is.na(x)) :
  'x' must be an array of at least two dimensions

I know the error occurred in:
 > rowSums
function (x, na.rm = FALSE, dims = 1)
{
    if (is.data.frame(x))
        x <- as.matrix(x)
    if (!is.array(x) || length(dn <- dim(x)) < 2)
        stop("'x' must be an array of at least two dimensions")
    if (dims < 1 || dims > length(dn) - 1)
        stop("invalid 'dims'")
    p <- prod(dn[-(1:dims)])
    dn <- dn[1:dims]
    z <- if (is.complex(x))
        .Internal(rowSums(Re(x), prod(dn), p, na.rm)) + (0+1i) *
            .Internal(rowSums(Im(x), prod(dn), p, na.rm))
    else .Internal(rowSums(x, prod(dn), p, na.rm))
    if (length(dn) > 1) {
        dim(z) <- dn
        dimnames(z) <- dimnames(x)[1:dims]
    }
    else names(z) <- dimnames(x)[[1]]
    z
}
<environment: namespace:base>

I wrote other filters and they work fine, but the rowVars or rowSums 
function does not work for me.

Can someone help? Thanks in advance !

Wayne
--



More information about the Bioconductor mailing list