tanghaibao / goatools

Python library to handle Gene Ontology (GO) terms
BSD 2-Clause "Simplified" License
771 stars 211 forks source link
bioinfomatics fdr fdr-benjamini fisher-tests gene-ontology gene-set-enrichment genomics goslim-terms holm-sidak sidak

GOATOOLS: A Python library for Gene Ontology analyses

Latest PyPI version bioconda Github Actions Downloads

Authors Haibao Tang (tanghaibao)
DV Klopfenstein (dvklopfenstein)
Brent Pedersen (brentp)
Fidel Ramirez (fidelram)
Aurelien Naldi (aurelien-naldi)
Patrick Flick (patflick)
Jeff Yunes (yunesj)
Kenta Sato (bicycle1885)
Chris Mungall (cmungall)
Greg Stupp (stuppie)
David DeTomaso (deto)
Olga Botvinnik (olgabot)
Email tanghaibao@gmail.com
License BSD

How to cite

[!TIP] GOATOOLS is now published in Scientific Reports!

Klopfenstein DV, ... Tang H (2018) GOATOOLS: A Python library for Gene Ontology analyses Scientific reports

GOATOOLS example

Contents

This package contains a Python library to

Installation

Make sure your Python version >= 3.7, and download an .obo file of the most current GO:

wget http://current.geneontology.org/ontology/go-basic.obo

or .obo file for the most current GO Slim terms (e.g. generic GOslim) :

wget http://current.geneontology.org/ontology/subsets/goslim_generic.obo

PyPI

pip install goatools

To install the development version:

pip install git+git://github.com/tanghaibao/goatools.git

Bioconda

conda install -c bioconda goatools

Dependencies

When installing via PyPI or Bioconda as described above, all dependencies are automatically downloaded. Alternatively, you can manually install:

Cookbook

run.sh contains example cases, which calls the utility scripts in the scripts folder.

Find GO enrichment of genes under study

See examples in find_enrichment

The find_enrichment.py takes as arguments files containing:

Please look at tests/data folder to see examples on how to make these files. when ready, the command looks like:

python scripts/find_enrichment.py --pval=0.05 --indent data/study \
                                  data/population data/association

and can filter on the significance of (e)nrichment or (p)urification. it can report various multiple testing corrected p-values as well as the false discovery rate.

The e in the "Enrichment" column means "enriched" - the concentration of GO term in the study group is significantly higher than those in the population. The "p" stands for "purified" - significantly lower concentration of the GO term in the study group than in the population.

Important note: by default, find_enrichment.py propagates counts to all the parents of a GO term. As a result, users may find terms in the output that are not present in their association file. Use --no_propagate_counts to disable this behavior.

Write GO hierarchy

Plot GO lineage

python scripts/plot_go_term.py --term=GO:0008135

This command will plot the following image.

GO term lineage

Sometimes people like to stylize the graph themselves, use option --gml to generate a GML output which can then be used in an external graph editing software like Cytoscape. The following image is produced by importing the GML file into Cytoscape using yFile orthogonal layout and solid VizMapping. Note that the GML reader plugin may need to be downloaded and installed in the plugins folder of Cytoscape:

python scripts/plot_go_term.py --term=GO:0008135 --gml

GO term lineage (Cytoscape)

Map GO terms to GOslim terms

See map_to_slim.py for usage. As arguments it takes the gene ontology files:

The script either maps one GO term to its GOslim terms, or protein products with multiple associations to all its GOslim terms.

To determine the GOslim terms for a single GO term, you can use the following command:

python scripts/map_to_slim.py --term=GO:0008135 go-basic.obo goslim_generic.obo

To determine the GOslim terms for protein products with multiple associations:

python scripts/map_to_slim.py --association_file=data/association go-basic.obo goslim_generic.obo

Where the association file has the same format as used for find_enrichment.py.

The implementation is similar to map2slim.

Technical notes

Available statistical tests for calculating uncorrected p-values

For calculating uncorrected p-values, we use SciPy:

Available multiple test corrections

We have implemented several significance tests:

Additional methods are available if statsmodels is installed:

In total 15 tests are available, which can be selected using option --method. Please note that the default FDR (fdr) uses a resampling strategy which may lead to slightly different q-values between runs.

iPython Notebooks

Optional attributes

definition

Run a Ontology Enrichment Analysis (GOEA)

goea_nbt3102 human phenotype ontologies

Show many study genes are associated with RNA, translation, mitochondria, and ribosomal

goea_nbt3102_group_results

Report level and depth counts of a set of GO terms

report_depth_level

Find all human protein-coding genes associated with cell cycle

cell_cycle

Calculate annotation coverage of GO terms on various species

annotation_coverage

Determine the semantic similarities between GO terms

semantic_similarity semantic_similarity_wang

Obsolete GO terms are loaded upon request

godag_obsolete_terms

Want to Help?

Prior to submitting your pull request, please add a test which verifies your code, and run:

make test

Items that we know we need include:

Star History

Star History Chart

Copyright (C) 2010-2021, Haibao Tang et al. All rights reserved.