nf-core / nf-core/modules

gprofiler generated GMT does not match the fitlering that the gprofiler website does for GO

Open
#8,786 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Nextflow
Stars
429
Forks
1.1k
Avg merge
1d 6h
Merged PRs (30d)
153

Description

Have you checked the docs?
Description of the bug

In the GOST template, there is a line that filters the organism GMT to focus on certain sources.
https://github.com/nf-core/modules/blob/8b6514c107bac9520a69aac3471f33e2ab07f269/modules/nf-core/gprofiler2/gost/templates/gprofiler2_gost.R#L255

This line basically searches the beginning of each gene set to see if it matches the sources.
However, this is not how the gprofiler website filtes Gene Ontology (GO) gene sets, since they ALL start with GO:XXXXX (where XXXXX) is an ID number. None of them start with GO:CC, but GProfiler will still filter by it.

To see this, run gprofiler with sources="GO:CC,WP", such as using the test params while modifying sources.

You get a detailed enrichment that includes GO:CC (in all_enriched_pathways.tsv, ondition_genotype_WT_KO.gprofiler2.GO:CC.sub_enriched_pathways.tsv and Condition_genotype_WT_KO.gprofiler2.GO:CC.sub_enriched_pathways.png).

However, the filtered GMT file contains only lines that start wit;h WP. If GPRofiler was running on the filtered file, it would only output WP enrichment (upload the filtered file, and run again to see).

Options to fix

  1. Remove all filtering lines, since GProfiler does some filtering. Were these filtering lines added for a specific reason?
  2. use something else like https://bioconductor.org/packages/devel/bioc/vignettes/topGO/inst/doc/topGO.pdf. Problem, since it probably won't include WP and TF, which are very useful.
  3. Use something like the R pacakge GO.db to filter sources that start with "GO".
GO_onto_table = AnnotationDbi::select(GO.db, keys=keys(GO.db), columns = "ONTOLOGY")
GO_terms = dplyr::filter(GO_onto_table, Ontology %in% sources)
filtered_gmt = cbind(Filter(function(line) any(startsWith(line, sources)), readLines(opt\$gmt)),
                                  Filter(function(line) any(startsWith(line, GO_terms)), readLines(opt\$gmt))

I would probably rewrite the dplyr line using base R, so we don't need dplyr.
4. Ask the GProfiler people how they filter, and see if it is a callable function.

If we don't mind adding GO.db to the image, I can see about adding some extra filter lines.

Command used and terminal output

Relevant files

No response

System information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at modules/nf-core/gprofiler2/gost/templates/gprofiler2_gost.R around line 255 and run the test parameters with sources="GO:CC,WP". Compare the filtered GMT with the enrichment outputs and with a rerun using the uploaded GMT. Done means GO:CC and WP filtering agrees with the g:Profiler website behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.