-
Notifications
You must be signed in to change notification settings - Fork 17
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
[WIP] Helper function to remove batch effects #280
base: v1.6rc
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- small review comments below
beta <- fit$coefficients[,-(1:ncol(design)),drop=FALSE] | ||
beta[is.na(beta)] <- 0 | ||
as.matrix(x) - beta %*% t(X.batch) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would benefit from a small test -- we wouldn't need to mock up a bunch of RNA-seq data for this, we could just use a small matrix.
And maybe as a temporary test you could copy the function over to a real-world RNA-seq analysis and give it a shot there -- no need to wait for a merge for that.
@hertafeldsr in 6095688 I added a test Rmd you can use for trying out the function. We may need to find another Bioconductor package with a more complex design in order to test multiple batches. |
This is for issue #255 . I refactored the code from this function: https://rdrr.io/bioc/limma/src/R/removeBatchEffect.R to be able to accept an arbitrary number of factors. I haven't tested it much yet so I'll have to wait to merge until that's done.