diff --git a/R/gset-meta.r b/R/gset-meta.r index b7a1a8a0..d533e026 100644 --- a/R/gset-meta.r +++ b/R/gset-meta.r @@ -530,7 +530,9 @@ gset.fitContrastsWithLIMMA <- function(gsetX, contr.matrix, design, vfit <- limma::lmFit(gsetX, design) vfit <- limma::contrasts.fit(vfit, contrasts = contr.matrix) ## efit <- limma::eBayes(vfit, trend = trend, robust = TRUE) - efit <- try({ limma::eBayes(vfit, trend = trend, robust = TRUE) }) + efit <- try({ + limma::eBayes(vfit, trend = trend, robust = TRUE) + }) if ("try-error" %in% class(efit)) { efit <- limma::eBayes(vfit, trend = trend, robust = FALSE) } diff --git a/R/pgx-annot.R b/R/pgx-annot.R index 25e418b3..fdeb18ce 100644 --- a/R/pgx-annot.R +++ b/R/pgx-annot.R @@ -626,19 +626,18 @@ getCustomAnnotation <- function(probes, custom_annot = NULL) { #' @export probe2symbol <- function(probes, annot_table, query = "symbol", key = NULL, fill_na = FALSE) { - # Prepare inputs - annot_table <- cbind( rownames = rownames(annot_table), annot_table ) - probes1 <- setdiff(probes, c(NA,"")) - if(is.null(key) || !key %in% colnames(annot_table)) { + annot_table <- cbind(rownames = rownames(annot_table), annot_table) + probes1 <- setdiff(probes, c(NA, "")) + if (is.null(key) || !key %in% colnames(annot_table)) { key <- which.max(apply(annot_table, 2, function(a) sum(probes1 %in% a))) } - if(is.null(key)) { + if (is.null(key)) { stop("[probe2symbol] FATAL. could not get key column.") } - + # match query - ii <- match( probes, annot_table[,key] ) + ii <- match(probes, annot_table[, key]) query_col <- annot_table[ii, query] # Deal with NA diff --git a/R/pgx-compute.R b/R/pgx-compute.R index 9c5b154d..b95732a2 100644 --- a/R/pgx-compute.R +++ b/R/pgx-compute.R @@ -893,8 +893,10 @@ pgx.add_GMT <- function(pgx, custom.geneset = NULL, max.genesets = 20000) { # Convert G feature/symbol/human_ortholog to SYMBOL rownames(G) <- probe2symbol( - rownames(G), pgx$genes, key = "human_ortholog", - query = "symbol", fill_na = TRUE) + rownames(G), pgx$genes, + key = "human_ortholog", + query = "symbol", fill_na = TRUE + ) ## -----------------------------------------------------------