8000 Avoid error from rowMeans() if there is only one DMP by mcol · Pull Request #21 · YuanTian1991/ChAMP · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Avoid error from rowMeans() if there is only one DMP #21

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcol
Copy link
@mcol mcol commented Jul 29, 2021

When running champ.DMP(), if there is only one differentially expressed probe, the following fails:

avg <-  cbind(rowMeans(beta[com.idx,which(pheno==Compare[[i]][1])]),
              rowMeans(beta[com.idx,which(pheno==Compare[[i]][2])]))

because com.idx has length 1, and beta[com.idx,which(pheno==Com 8000 pare[[i]][1])] instead of a matrix becomes a vector, over which cannot be computed row names. By adding drop=FALSE, we can make it return a matrix with one row, and the operation works.

In the patch I've also removing the use of which() as it seems unnecessary. The only case where it would make a difference is if pheno or Compare contain NAs, but I don't know if that is actually possible. In case, I can put the 'which()' back.

@robinjugas
Copy link

Thanks @mcol mcol, this helped me.

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

Successfully merging this pull request may close these issues.

2 participants
0