The first line of sva_network function applies SVD transformation to mean-centered (over columns, i.e., genes) expression matrix:
ss<-svd(dat - colMeans(dat))
I think dat - colMeans(dat) is not the correct code for mean-centering columns of the data frame or matrix – instead of subtracting the mean of the column from all rows of the column, it does the job with a vector recycling approach.
You can easily see that by using the bladder cancer dataset from the documentation – printing the result of
colMeans(dat - colMeans(dat)) shows that the means are not zero.
Hello,
The first line of sva_network function applies SVD transformation to mean-centered (over columns, i.e., genes) expression matrix:
ss<-svd(dat - colMeans(dat))
I think
dat - colMeans(dat)
is not the correct code for mean-centering columns of the data frame or matrix – instead of subtracting the mean of the column from all rows of the column, it does the job with a vector recycling approach.You can easily see that by using the bladder cancer dataset from the documentation – printing the result of
colMeans(dat - colMeans(dat))
shows that the means are not zero.