Skip to content

Fix160 fgsea implementation#161

Merged
mtiberti merged 4 commits intodevelfrom
fix160_fgsea_implementation
Apr 14, 2026
Merged

Fix160 fgsea implementation#161
mtiberti merged 4 commits intodevelfrom
fix160_fgsea_implementation

Conversation

@AlessiaCampo
Copy link
Copy Markdown
Contributor

  • A new dataset called DAPsmatrix is added in data/ and documented in Rdata.R. The dataset contains Differentially Abundant Proteins along with logFC and p values.

  • The method fgsea for functional enrichment analysis has been added in the FEA() module. The FEA() can now take as input both DEGsmatrix and DAPsmatrix and a new method keyword, indicating which Functional Enrichment Analysis method will be used. The default method is called "ora" and is associated with the already present implementation of the Over Representation Analysis method. A new method has been added called "fgsea" which perform FEA using a ranking-based method. The final output in both cases would be the TableDiseaseNew containing information about which BP was found to be enriched in the input DAPs or DEGs matrix. When running the fgsea method, the output table will contain different values compared to the ora output, reflecting the specific scores (e.g. ES, NES) computed by the method itself. In both cases, a Moonlight Z-score will be computed for each BP and included in the output table. Its calculation in both method follows the same logic.

  • FEA.Rd was updated accordingly

  • DESCRIPTION was updated with the version number and to include the new fgsea package

  • NAMESPACE was updated to include the import of the fgsea package

Copy link
Copy Markdown
Contributor

@mtiberti mtiberti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also please

  • detail the change in the vignette; we don't necessarily need to add a call to it using the new method, just modifying the already-existing call so that we use the old method explicitly, and add a bit of an explainer of why we support both
  • can you add a test with either mode in the test suite (one for ora, one for fgsa)

Comment thread R/FEA.R
Comment thread R/FEA.R Outdated
#' This function carries out the functional enrichment analysis (FEA)
#' @param BPname BPname biological process such as "proliferation of cells", "ALL" (default) if FEA should be carried out for all 101 biological processes
#' @param DEGsmatrix DEGsmatrix output from DEA such as dataDEGs
#' @param DEGsmatrix output from DEA such as dataDEGs or from DAA such as differential abundace matrix
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add the name of the object as in dataDEGs?

ideally both the name of the object and explanation of what they are for both

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About this, I have a doubt: as far as I understood- the dataDEGs argument is defined for the first time in the moonlight.R, specifically in the moonlight() wrapper function when the dataDEGs argument is passed in the method. So, If I am correct- to be consistent- we should define a more generic data table parameter name (that would refer to both genes and proteins tables since we now have the support for the DAPsmatrix) also in the moonlight.R. But since dataDEGs is used in many other functions of Moonlight- this would imply to change the input object name in all the other functions that takes as input the dataDEGs object, but I am not sure on how to proceed on this.
Another option would be to define two separate objects: one for proteomics and one for transcriptomics and use the proteomics object only in the FEA() function.
What do you think about it?

Copy link
Copy Markdown
Contributor

@mtiberti mtiberti Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid the second option - if we end up in a situation in which our function with two (mostly) separate code paths and two independent arguments that use the two code paths, then it should be split into two independent functions.

I don't think we should change how the moonlight() wrapper works before we have a full understanding of the new "proteomics" pipeline (or other functions) will work from start to end. But I agree that it would be better to define a more generic argument name for the data for this function.

Maybe we can start by defining a new more generic parameter name in this function and change moonlight.R accordingly (and potentially on other functions that run FEA if any), until we have a good idea of what else we need to change

Comment thread R/FEA.R Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should update this and following errors as we don't consider just DEGs anymore

Comment thread R/FEA.R Outdated
@@ -2,8 +2,10 @@
#'
#' This function carries out the functional enrichment analysis (FEA)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a bit more to the description - the fact that there are two possible methods and what inputs they are expected to be used

Comment thread R/FEA.R
Comment thread data/datalist
Comment thread vignettes/Moonlight2R.Rmd Outdated
For each DEG in the gene set a z-score is calculated. This score indicates how the genes act in the gene set.

To perform the analysis, the user can choose among two different methods:
the default method is "ora" and it is based on Fisher's test. It is used to tests whether a gene set is overrepresented in a subset of DEGs or DAPs.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have we defined what the acronym of DAP/DEG is?

Comment thread R/FEA.R Outdated
Zscore <- 0
}

return (Zscore)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nitpick - can you remove the space between return and (Zscore)?

Comment thread NEWS.md
Comment on lines -1 to +5
# Moonlight2R 1.9.1
# Moonlight2R 1.9.2

## Summary

* Removed hotfix in GSEA() module
* Added new dataset for proteomics data and implemented fgsea method in the FEA function
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you have replaced the entry for 1.9.1 with the one for 1.9.2 - can we keep both?

@mtiberti mtiberti merged commit 8b179ea into devel Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants