[BioC] bug in beadarray::setWeights

Mehrdad Shamsi Mehrdad.Shamsi at oicr.on.ca
Sun Dec 13 23:20:11 CET 2009


Hi, 
As reported in my  previous email, there is still one issue remaining to be fixed in beadarray:setWeights function, namely:

>In the current implementation, if one passes a vector of weights (not a list that contains one vector) to the function, all >the weights are set to the **first element** of the vector, which is the direct result of using wts[[1]] for the special case >of length(array==1).

A possible workaround is suggested below, where the cases where the wts argument is not a list is treated differently than the rest:

setWeights <- function (BLData, wts, array, combine = FALSE) 
{
    BLData.copy = copyBeadLevelList(BLData)
    an = arrayNames(BLData)
    if (mode(wts) != "list") {
        if (combine) {
            if (is.null(BLData.copy at beadData[[an[array]]]$wts)) {
                BLData.copy at beadData[[an[array]]]$wts = wts
            }
            else {
                BLData.copy at beadData[[an[array]]]$wts = pmin(wts, 
                  BLData.copy at beadData[[an[array]]]$wts)
            }
        }
        else {
            BLData.copy at beadData[[an[array]]]$wts = wts[[1]]
        }
    }
    else {
        if (combine) {
            for (i in array) {
                if (is.null(BLData.copy at beadData[[an[i]]]$wts)) {
                  BLData.copy at beadData[[an[i]]]$wts = wts[[i]]
                }
                else {
                  BLData.copy at beadData[[an[i]]]$wts = pmin(wts[[i]], 
                    BLData.copy at beadData[[an[i]]]$wts)
                }
            }
        }
        else {
            for (i in array) {
                BLData.copy at beadData[[an[i]]]$wts = wts[[i]]
            }
        }
    }
    BLData.copy
}

	
Regards
-- M. S

________________________________________
From: Mehrdad Shamsi
Sent: Wednesday, November 25, 2009 10:46 AM
To: Mark Dunning
Cc: bioconductor at stat.math.ethz.ch
Subject: RE: [BioC] bug in beadarray::setWeights

Mark,
Thanks for the help. I upgraded to the new version. The problem is resolved. But it seems that in this version's implementation of beadarray::setWeigths, the check for "length(array)==1" is redundant. In other words, the special case of length(array==1) is treated in the same way as other cases; and therefore one can get rid of check for (array(length==1) entirely.
There is still one problem (bug) to be resolved: In the current implementation, if one passes a vector of weights (not a list that contains one vector) to the function, all the weights are set to the **first element** of the vector, which is the direct result of using wts[[1]] for the special case of length(array==1).

One more question. I noticed that you copy BLData object to a new object, BLData.copy, and use the copy in the body of the function. Is there any specific reason for that?

Regards
-- M. S.


From: Mark Dunning [mark.dunning at gmail.com]
Sent: Monday, November 23, 2009 4:48 AM
To: Mehrdad Shamsi
Cc: bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] bug in beadarray::setWeights

Hi,

You may need to upgrade your version of beadarray. I recall this bug
being present in older versions, but it should now be fixed for
Bioconductor 2.5 (beadarray 1.14.0).

Regards,

Mark

On Sun, Nov 22, 2009 at 6:46 PM, Mehrdad Shamsi
<Mehrdad.Shamsi at oicr.on.ca> wrote:
> Hi,
>
> Passing a list of weights, that has one vector of weights as the only component,
> to beadarray::setWeights causes R to aquire the entire available memory.
> After grabbing the maximum available memory, the function produces insufficient memory error and quits.
>
> Example:
> library(beadarray)
> data(BLData);
> output <- BASH(BLData, array = 1);
> BLData <- setWeights(BLData, wts = output$wts, array = 1);
>
> Error: cannot allocate vector of size 389 Kb
> In addition: Warning messages:
> 1: In class(x) <- NULL :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 2: In class(x) <- NULL :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 3: In x[[name]] <- value :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 4: In x[[name]] <- value :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 5: In x[[name]] <- value :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 6: In x[[name]] <- value :
>  Reached total allocation of 1535Mb: see help(memory.size)
>
> Source of the problem:
> The way the special case of "length(array) == 1" is dealth with in is the source of the problem.
>
>
> Best regards
> -- M. S.
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list