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

[WIP] Helper function to remove batch effects #280

Draft
wants to merge 10 commits into
base: v1.6rc
Choose a base branch
from
Draft

Conversation

hertafeldsr
Copy link

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.

@hertafeldsr hertafeldsr changed the base branch from master to v1.6rc May 8, 2020 21:06
@hertafeldsr hertafeldsr changed the title Issue 255 Helper function to remove batch effects (Issue 255) May 8, 2020
Copy link
Contributor

@daler daler left a 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

workflows/rnaseq/downstream/helpers.Rmd Show resolved Hide resolved
workflows/rnaseq/downstream/helpers.Rmd Outdated Show resolved Hide resolved
beta <- fit$coefficients[,-(1:ncol(design)),drop=FALSE]
beta[is.na(beta)] <- 0
as.matrix(x) - beta %*% t(X.batch)
}
Copy link
Contributor

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.

workflows/rnaseq/downstream/helpers.Rmd Outdated Show resolved Hide resolved
@daler
Copy link
Contributor

daler commented May 23, 2020

@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.

@daler daler changed the title Helper function to remove batch effects (Issue 255) [WIP] Helper function to remove batch effects Nov 12, 2022
@daler daler marked this pull request as draft November 12, 2022 14:36
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.

4 participants