Skip to content

Commit

Permalink
Style code (GHA)
Browse files Browse the repository at this point in the history
  • Loading branch information
ESCRI11 committed Jan 15, 2025
1 parent d2488c9 commit e18f406
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion R/gset-meta.r
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
13 changes: 6 additions & 7 deletions R/pgx-annot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions R/pgx-compute.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


## -----------------------------------------------------------
Expand Down

0 comments on commit e18f406

Please sign in to comment.