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

Error in apply(tmp[iGeneSet, ], 1, function(x) mean(x[x >= 0])) #2

Open
rronen opened this issue May 18, 2018 · 2 comments
Open

Error in apply(tmp[iGeneSet, ], 1, function(x) mean(x[x >= 0])) #2

rronen opened this issue May 18, 2018 · 2 comments

Comments

@rronen
Copy link

rronen commented May 18, 2018

First, thanks for making piano. It is a super useful package.

I've had some cases where the fdr procedure implemented in fdrGSEA.R fails with:

Error in apply(tmp[iGeneSet, ], 1, function(x) mean(x[x >= 0]))
dim(X) must have a positive length

which happens if iGeneSet contains only a single element.

Introducing drop=FALSE in the two relevant lines seems to resolve the issue. I.e., changing tmp[iGeneSet, ] to tmp[iGeneSet, , drop=FALSE].

@varemo
Copy link
Owner

varemo commented May 23, 2018

Hi, sorry for slow response here, I am abroad on vacation with limited time and access to a computer. Thanks for reporting this bug and suggesting the fix. I will implement it as soon as possible!

@rronen
Copy link
Author

rronen commented Nov 21, 2019

Update (>1 year later :) it is also necessary to add drop=FALSE in the following section:

      # Normalize ES:
      ES <- gsStatsAll[, iContrast]
      if(signMethod == "geneperm") {
          tmp <- randBgMat[as.character(sizeGS), , drop=FALSE]  # HERE
      } else {
          tmp <- randBgMat
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants