Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning is produced when running in parallel #7

Closed
mmahmoudian opened this issue May 22, 2023 · 0 comments
Closed

Warning is produced when running in parallel #7

mmahmoudian opened this issue May 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@mmahmoudian
Copy link
Owner

The following warning is thrown when the code is run in parallel.

1: In `[<-.data.frame`(`*tmp*`, , tmp.columns.to.zscore, value = list( :
  provided 114 variables to replace 25 variables

The issue is that in some unlucky cases there are only one column left while we are binning the columns to send to each CPU core. In those cases, selection of columns from a matrix object does not return a table but rather a numeric vector. This means that on the line 677 of the following chuck, we are sending a vector to our func.zscore function rather than a matrix.

sivs/R/sivs.R

Lines 665 to 678 in 7e629e2

tmp.zscore.res <- foreach::foreach(i = 1:length(tmp.bins),
.inorder = TRUE,
.combine = cbind.data.frame) %mydo% {
# if user wants to have progressbar
if(progressbar){
# increment the progressbar
setTxtProgressBar(pb = pb, value = getTxtProgressBar(pb) + 1)
}
lapply(x[, tmp.bins[[i]]], func.zscore)
}

The x[, tmp.bins[[i]]] in line 677 of the chunk above is equivalent of:

base::getElement(object = x, name = tmp.bins[[i]])

The solution is pretty obvious, using base::subset(), although I think it will add some overhead on the runtime of the code. But because it is run only once per each SIVS run, it is pretty okay. The fix will come in PR #8.

mmahmoudian added a commit that referenced this issue May 22, 2023
@mmahmoudian mmahmoudian added the bug Something isn't working label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant