Hi all,
i'm using the fsva
function from the sva
package to correct batch effects in my data and i think that i might have found a bug in the function
Here is an example from the fsva
documentation:
library(bladderbatch)
library(pamr)
data(bladderdata)
dat <- bladderEset[1:50,]
pheno = pData(dat)
edata = exprs(dat)
set.seed(1234)
trainIndicator = sample(1:57,size=30,replace=FALSE)
testIndicator = (1:57)[-trainIndicator]
trainData = edata[,trainIndicator]
testData = edata[,testIndicator]
trainPheno = pheno[trainIndicator,]
testPheno = pheno[testIndicator,]
mydata = list(x=trainData,y=trainPheno$cancer)
mytrain = pamr.train(mydata)
table(pamr.predict(mytrain,testData,threshold=2),testPheno$cancer)
trainMod = model.matrix(~cancer,data=trainPheno)
trainMod0 = model.matrix(~1,data=trainPheno)
trainSv = sva(trainData,trainMod,trainMod0)
fsvaobj = fsva(trainData,trainMod,trainSv,testData)
which works great.
However, if i run the function without the newdat
argument, i get the following error message:
fsvaobj = fsva(trainData,trainMod,trainSv)
Error in fsva(trainData, trainMod, trainSv) : object 'newV' not found
after setting the newV
variable in my global environment, it works well again:
newV <- NULL
fsvaobj = fsva(trainData,trainMod,trainSv)
I guess that the variable is not defined within the function if the newdat
argument is NULL
.
In summary, i think it is not a very important bug, but the authors might want to correct it anyway.
Cheers, Jakob
PS: here is the sessionInfo()
output. Hope that it is not a versioning problem (sva version sva_3.30.1
).
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sva_3.30.1 BiocParallel_1.16.6 genefilter_1.64.0 mgcv_1.8-28 nlme_3.1-141
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 compiler_3.5.3 pillar_1.4.2 bitops_1.0-6 tools_3.5.3 zeallot_0.1.0
[7] digest_0.6.20 bit_1.1-14 annotate_1.60.1 RSQLite_2.1.2 memoise_1.1.0 tibble_2.1.3
[13] lattice_0.20-38 pkgconfig_2.0.2 rlang_0.4.0 Matrix_1.2-17 DBI_1.0.0 rstudioapi_0.10
[19] yaml_2.2.0 parallel_3.5.3 S4Vectors_0.20.1 vctrs_0.2.0 IRanges_2.16.0 stats4_3.5.3
[25] bit64_0.9-7 grid_3.5.3 Biobase_2.42.0 AnnotationDbi_1.44.0 survival_2.44-1.1 XML_3.98-1.20
[31] limma_3.38.3 blob_1.2.0 matrixStats_0.54.0 backports_1.1.4 splines_3.5.3 BiocGenerics_0.28.0
[37] xtable_1.8-4 RCurl_1.95-4.12 crayon_1.3.4