error in running Combat function
0
0
Entering edit mode
4 months ago
reza ▴ 250

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("GSExxx", 30), rep("GSExxxx", 12), rep("GSExx", 14), rep("GSEx", 12)))
pcr <- data.frame(pc$r[,1:3], Sets)
allc <- ComBat(all, Sets)

how can solve this problem?

Thanks for your helps

R sva Combat R studio • 260 views
ADD COMMENT
0
Entering edit mode

Hello, can you please provide a minumal data example for the relevant variables that allows reproduction of the error, for example via the dput() function?

ADD REPLY
0
Entering edit mode

how can I do that using dput() function?

ADD REPLY
0
Entering edit mode

For example dput(head(all)) would give you a text representation that you can copy/paste of the all variable. Please provide example data for Sets and all.

ADD REPLY
0
Entering edit mode
 Sets <- (c(rep("GSEx", 12), rep("GSExx", 12), rep("GSExxx", 9), rep("GSExxxx", 13)))

AND

> 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")
ADD REPLY
0
Entering edit mode

Dear ATpoint, you have no advice to solve this error?

ADD REPLY
0
Entering edit mode

The code runs without error on my machine (macOS 10.14). I suggest you post this over at support.bioconductor.org using the sva tag and hope that the developers can help.

ADD REPLY

Login before adding your answer.

Traffic: 1365 users visited in the last hour
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.6