I would like to perform a pathway analysis in R.
In particular, I have the genes signatures (that define pathways) that I want to investigate.
I have just perform the differential expression analysis between the conditions.
I would like to know, using ONLY deg, which signatures are enriched.

You can use your own signatures with these types of tests, because they're basically repeated chi-square, or Fisher exact tests, where you test whether the proportion of DEG is different between the population and your signature. i.e
You test 20000 genes of which 200 ( 1%) are DE, your signatures contains 100 genes of which 10 are DE (10%) the Fisher exact test will tell you if this difference in proportion is significant.
i

There are a lot of options. Here are a couple specific recommendations:

clusterProfiler - actively maintained R package with great documentation. Includes built-in support for GO analysis, but can also plugin GMT files from WikiPathways or even of your own creation.

rSEA - one of the newer options in this space. According to their paper, it resolves a lot of statistical issues with prior approaches. It's also flexible enough to use with GO, WikiPathways or your own GMTs. Note: this method, uses p-values from all genes in your DE analysis (not just a pre-selected subset of DEGs).

You could use the globaltest bioconductor package

Hi Julia, you may want to use genecodis or DAVID tool for this type of analysis by selecting the more expressed and significant genes

But in this way I can only investigate public signatures (such as gene ontology terms, reactome etc.), right?

But I have some signatures, that I defined, that I want to investigate in a differential expression analysis that I performed.

You can use your own signatures with these types of tests, because they're basically repeated chi-square, or Fisher exact tests, where you test whether the proportion of DEG is different between the population and your signature. i.e You test 20000 genes of which 200 ( 1%) are DE, your signatures contains 100 genes of which 10 are DE (10%) the Fisher exact test will tell you if this difference in proportion is significant. i

Check this new thread: C: for go enrichment analysis which tool do you recommend?