RGLab / flowStats

flowStats: algorithms for flow cytometry data analysis using BioConductor tools
15 stars 10 forks source link

latest `fda` breaks `warpSet` function #11

Closed mikejiang closed 10 years ago

mikejiang commented 10 years ago

flowStats failed to build on BioC lately due to the upgrade of fda package. Here is the call stack:

16: stop("WFDOBJ is not a single function")
15: monfn(x, Wfdobj)
14: fngrad.smooth.morph(y, x, wt, Wfdobj, lambda, Kmat, inact, basislist)
13: smooth.morph(xval, yval, WfdPar)
12: landmarkreg(fdobj, landmarks, WfdPar = WfdPar, monwrd = monwrd, 
        ...)
11: eval(expr, envir, enclos)
10: eval(expr, pf)
9: withVisible(eval(expr, pf))
8: evalVis(expr)
7: capture.output(regDens <- landmarkreg(fdobj, landmarks, WfdPar = WfdPar, 
       monwrd = monwrd, ...))
6: warpSet(x, parameters, ...) at #1
5: (function (x, parameters, ...) 
   warpSet(x, parameters, ...))(grouping = "GroupID", monwrd = TRUE, 
       x = <S4 object of class "flowSet">, parameters = c("CD8", 
       "CD69", "CD4", "HLADr"))
4: do.call(x@normFunction, args)
3: .local(data, x, ...)
2: normalize(Data(wf[["TCells+"]]), norm)
1: normalize(Data(wf[["TCells+"]]), norm)
mikejiang commented 10 years ago

By installing both versions of fda, stepping into warpSet and comparing the output from each fda function call, here we found the source of problem. The fda2.4.0::fdPar returns a single-column matrix

Browse[1]> WfdPar$fd$coefs
         [,1]
bspl4.1     0
bspl4.2     0
bspl4.3     0
bspl4.4     0
bspl4.5     0
bspl4.6     0
bspl4.7     0
bspl4.8     0
bspl4.9     0
bspl4.10    0
bspl4.11    0
bspl4.12    0
bspl4.13    0

yet the fda2.4.3::fdPar returns a n by n squared matrix

WfdPar$fd$coefs
         [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
bspl4.1     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.2     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.3     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.4     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.5     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.6     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.7     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.8     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.9     0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.10    0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.11    0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.12    0    0    0    0    0    0    0    0    0     0     0     0     0
bspl4.13    0    0    0    0    0    0    0    0    0     0     0     0     0

This breaks fda::landmarkreg call later on.

diff on the code base of fda package further confirms this:

diff ../otherPkgs/fda_2.4.3/R/fdPar.R ../otherPkgs/fda_2.4.0/R/fdPar.R 
62c62
<         
---
>         coefs   <- matrix(0,nbasis-length(dropind),1)

For now we will simply inline the fdPar function from fda2.4.0 before its author addresses this issue.