Error in running Combat function
0
Entering edit mode
Reza • 10
@Reza-24551
Last seen 4 days ago

I run the same commands on the same data in Rstudio in Windows and Linux, but I get different results in step removing batch effect using “Combat” function (sva package). Running “Combat” on Windows is error-free, while on Linux I get the following error:

Error in ((dat - t(design %*% B.hat))^2) %*% rep(1/n.array, n.array) : 
requires numeric/complex matrix/vector arguments

Commands

    all <- read.delim("All.txt", header = T, row.names = 1) 
    allm <- all - rowMeans(all)
    pc <- prcomp(allm)
    Sets <- (c(rep("GSEx", 12), rep("GSExx", 12), rep("GSExxx", 9), rep("GSExxxx", 13)))
    pcr <- data.frame(pc$r[,1:3], Sets)
    allc <- ComBat(all, Sets)

For reproducibility

> dput(head(all))
structure(list(A1 = c(6.9381, 7.5079, 7.2303, 8.9908, 8.2564, 
11.0564), A2 = c(6.9594, 7.3883, 7.1023, 8.9328, 8.1679, 10.8513
), A3 = c(6.8419, 7.2109, 6.9548, 8.7414, 8.0299, 10.8115), A4 = c(6.6619, 
7.1364, 6.887, 8.6863, 8.006, 10.8775), A5 = c(6.9296, 7.2845, 
7.0382, 8.8176, 8.1234, 10.9084), A6 = c(7.1549, 7.5539, 7.2842, 
9.0999, 8.3527, 11.1642), A7 = c(6.6192, 7.1043, 6.9482, 8.6802, 
7.9977, 10.7216), A8 = c(7.2778, 7.6654, 7.3542, 9.2437, 8.5063, 
11.2892), A9 = c(7.282, 7.5827, 7.3097, 9.116, 8.4326, 11.1977
), A10 = c(7.3402, 7.7757, 7.4926, 9.2278, 8.6172, 11.1968), 
    A11 = c(6.6635, 7.1918, 6.8924, 8.6318, 7.9105, 10.7312), 
    A12 = c(6.8926, 7.3513, 6.9834, 8.7605, 8.0945, 10.8734), 
    B1 = c(6.8014, 7.1908, 6.8015, 8.8403, 8.0259, 10.7076), 
    B2 = c(6.5855, 7.1594, 6.6593, 8.7153, 7.9119, 10.7066), 
    B3 = c(6.4392, 7.0688, 6.5803, 8.6158, 7.8153, 10.6042), 
    B4 = c(6.7046, 7.078, 6.7047, 8.6752, 7.8961, 10.6192), B5 = c(7.9128, 
    8.3322, 8.0958, 9.8519, 8.9967, 11.6034), B6 = c(6.9226, 
    7.4705, 7.1007, 8.9497, 8.2543, 10.711), B7 = c(6.421, 7.0791, 
    6.4662, 8.5758, 7.7724, 10.5219), B8 = c(6.4972, 7.1769, 
    6.7016, 8.7424, 7.9157, 10.7647), B9 = c(6.6425, 7.3366, 
    6.5679, 8.8394, 7.9696, 10.7032), B10 = c(6.3134, 6.7753, 
    6.4695, 8.4463, 7.644, 10.5063), B11 = c(6.4938, 7.0694, 
    6.336, 8.6302, 7.688, 10.5626), B12 = c(6.2451, 6.9604, 6.2342, 
    8.4628, 7.6297, 10.5476), C1 = c(4.9469, 5.1746, 5.1522, 
    9.5331, 8.9385, 11.4915), C2 = c(5.0953, 5.1003, 5.2505, 
    9.6333, 9.0602, 11.4867), C3 = c(5.0583, 5.0543, 5.1091, 
    9.6526, 9.0479, 11.5055), C4 = c(4.9402, 5.1395, 5.2561, 
    9.655, 9.0221, 11.5286), C5 = c(5.0406, 5.1575, 5.2761, 9.6413, 
    9.0673, 11.5767), C6 = c(4.9726, 5.3945, 5.1122, 9.5541, 
    9.0265, 11.5038), C7 = c(5.3879, 5.1028, 5.0608, 9.803, 9.2769, 
    11.8283), C8 = c(5.127, 5.142, 5.1496, 9.9158, 9.2543, 11.8024
    ), C9 = c(5.3067, 5.1215, 5.0303, 9.9562, 9.3744, 11.8254
    ), D1 = c(7.0772, 7.4086, 7.2877, 9.0927, 8.6348, 11.2268
    ), D2 = c(6.6349, 7.0915, 6.6813, 8.5535, 8.1593, 10.9012
    ), D3 = c(7.4336, 7.7217, 7.512, 9.3543, 8.8803, 11.5023), 
    D4 = c(7.4971, 7.8568, 7.672, 9.441, 9.0128, 11.6245), D5 = c(7.2505, 
    7.5549, 7.3561, 9.2116, 8.6796, 11.3779), D6 = c(6.8906, 
    7.2358, 7.054, 8.8379, 8.4158, 11.0953), D7 = c(6.6697, 7.0378, 
    6.9185, 8.7005, 8.1895, 11.0119), D8 = c(6.955, 7.2885, 7.1322, 
    8.922, 8.4309, 11.1848), D9 = c(7.4286, 7.628, 7.5056, 9.2589, 
    8.8542, 11.5108), D10 = c(7.1027, 7.3881, 7.2015, 9.0158, 
    8.5069, 11.2525), D11 = c(6.9174, 7.2366, 7.1286, 8.8789, 
    8.5092, 11.1913), D12 = c(7.3573, 7.6144, 7.4158, 9.231, 
    8.7868, 11.4215), D13 = c(7.3078, 7.5243, 7.4756, 9.2333, 
    8.7521, 11.4136)), row.names = c("AFFX-BioB-3_at", "AFFX-BioB-5_at", 
"AFFX-BioB-M_at", "AFFX-BioC-3_at", "AFFX-BioC-5_at", "AFFX-BioDn-3_at"
), class = "data.frame")

how can solve this problem?

Thanks for your helps

sva ComBat • 56 views
ADD COMMENTlink
0
Entering edit mode
@u16406
Last seen 1 hour ago
Republic of Ireland

Thanks for posting the reproducible data. Using this data, the command runs okay here on Linux:

allc <- sva::ComBat(all, Sets)

Found4batches
Adjusting for0covariate(s) or covariate level(s)
Standardizing Data across genes
Fitting L/S model and finding priors
Finding parametric adjustments
Adjusting the Data

Perhaps you can show the output of your sessionInfo()? - here is mine:

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.7 LTS

Matrix products: default
BLAS:   /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=pt_BR.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=pt_BR.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6         AnnotationDbi_1.50.0 edgeR_3.30.3        
 [4] BiocGenerics_0.34.0  splines_4.0.3        IRanges_2.22.2      
 [7] bit_1.1-15.2         BiocParallel_1.22.0  lattice_0.20-41     
[10] xtable_1.8-4         rlang_0.4.6          blob_1.2.1          
[13] grid_4.0.3           parallel_4.0.3       nlme_3.1-149        
[16] Biobase_2.48.0       mgcv_1.8-33          DBI_1.1.0           
[19] genefilter_1.70.0    matrixStats_0.56.0   survival_3.2-3      
[22] bit64_0.9-7          digest_0.6.25        Matrix_1.2-18       
[25] sva_3.36.0           vctrs_0.3.1          S4Vectors_0.26.1    
[28] bitops_1.0-6         RCurl_1.98-1.2       memoise_1.1.0       
[31] RSQLite_2.2.0        limma_3.44.3         compiler_4.0.3      
[34] locfit_1.5-9.4       stats4_4.0.3         XML_3.99-0.3        
[37] annotate_1.66.0
ADD COMMENTlink
1
Entering edit mode

Thank you very much for your answer and your effort to help me, I will post here the results of sessionInfo() at the first opportunity, I will not have access to the university server for two days now. Thank you again.

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.3