2222# ' Types can be either "numeric" or "categorical"
2323# ' @param pathways : a list of pathways (e.g. KEGG, GO, Reactome etc.
2424# ' downloaded from http://www.gsea-msigdb.org/gsea/msigdb/human/collections.jsp)
25+ # ' @param compute_cor : Whether or not to compute the correlation matrix. Default is TRUE.
2526# ' Outputs:
2627# ' @return results : a list containing three objects
2728# ' results$coexpression: a gene x gene Pearson correlation matrix.
5152# ' results <- seahorse(expression_data, phenotype_data, phenotype_dictionary, pathways)
5253# '
5354# ' @export
54- seahorse <- function (expression , phenotype , phenotype_dictionary , pathways ){
55+ seahorse <- function (expression , phenotype , phenotype_dictionary , pathways , compute_cor = TRUE ){
5556 if (! requireNamespace(" fgsea" , quietly = TRUE )) {
5657 stop(" Package 'fgsea' is required but not installed." )
5758 }
@@ -60,7 +61,10 @@ seahorse <- function(expression, phenotype, phenotype_dictionary, pathways){
6061 results = list ()
6162
6263 # Compute coexpression of genes
63- results $ coexpression = cor(t(expression ), use = " pairwise.complete.obs" )
64+ results $ coexpression <- NA
65+ if (compute_cor == TRUE ){
66+ results $ coexpression = cor(t(expression ), use = " pairwise.complete.obs" )
67+ }
6468
6569 # Compute association of gene expression with phenotypes and run GSEA
6670 results $ phenotype_association = list ()
0 commit comments