Skip to content

Commit 6defb0e

Browse files
committed
suppress message (not error) from fgsea
1 parent 37abf50 commit 6defb0e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

fgsea.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@ mtable <- mtable[mtable$logFC!=0,]
3030
gRank <- sort(setNames(mtable$logFC,mtable$gene_name))
3131
GS <- gmtPathways(strGMT)
3232

33-
suppressMessages(suppressWarnings(fgseaRes <- fgsea(GS,gRank,nperm=1e5,minSize=gsMin,maxSize=gsMax)))
34-
fwrite(fgseaRes,file=strCSV)
35-
if(sum(upN+dnN)==0){
36-
message("")
33+
fgseaRes <- NULL
34+
fgseaRes <- tryCatch(suppressMessages(suppressWarnings(fgsea(GS,gRank,nperm=1e5,minSize=gsMin,maxSize=gsMax))),error=function(e){return(NULL)})
35+
if(!is.null(fgseaRes)) fwrite(fgseaRes,file=strCSV)#gsub("csv$","fgse.csv",strCSV)
36+
if(sum(upN+dnN)==0 || is.null(fgseaRes) || nrow(fgseaRes)==0){
37+
cat("")
3738
q()
3839
}
40+
3941
if(collapseF){
4042
collapsedPathways <- collapsePathways(fgseaRes[order(pval)][padj<padjCut],GS,gRank)
4143
fgseaRes <- fgseaRes[pathway %in% collapsedPathways$mainPathways]
4244
}
4345
topPathways <- c(fgseaRes[ES>0][head(order(pval),n=upN), pathway],
4446
rev(fgseaRes[ES<0][head(order(pval), n=dnN), pathway]))
4547
if(length(topPathways)==0){
46-
message("")
48+
cat("")
4749
q()
4850
}
4951
pathwayW <- max(nchar(topPathways))/4.5

0 commit comments

Comments
 (0)