Created
January 19, 2016 21:26
-
-
Save stephenturner/36216f32349d8003ce9f to your computer and use it in GitHub Desktop.
# Function to merge topTable output with original expression values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Function to merge topTable output with original expression values | |
| mergett <- function(tt, eset) { | |
| if (class(tt)!="data.frame") stop("tt should be a data.frame") | |
| if (class(eset)!="ExpressionSet") stop("eset should be an ExpressionSet") | |
| exprset <- data.frame(exprs(eset)) | |
| exprset$ID <- rownames(exprset) | |
| rownames(exprset) <- NULL | |
| print(paste("nrow(tt):", nrow(tt))) | |
| print(paste("nrow(exprset):", nrow(exprset))) | |
| if (nrow(tt)==nrow(exprset)) { | |
| newtt <- merge(tt, exprset) # merge with intensities | |
| } else { | |
| stop("nrow(tt) != nrow(exprset)") | |
| } | |
| print(paste("nrow(newtt):", nrow(newtt))) | |
| newtt <- newtt[order(newtt$P.Val), ] #reorder by p-value | |
| rownames(newtt) <- NULL | |
| newtt | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment