• Stars
    star
    774
  • Rank 58,703 (Top 2 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created almost 15 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python library to handle Gene Ontology (GO) terms

Tools for Gene Ontology

DOI 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 [email protected]
License BSD

Description

This package contains a Python library to

To Cite

Klopfenstein DV, Zhang L, Pedersen BS, ... Tang H GOATOOLS: A Python library for Gene Ontology analyses Scientific reports | (2018) 8:10872 | DOI:10.1038/s41598-018-28948-z

  • GO Grouping: Visualize the major findings in a gene ontology enrichment analysis (GOEA) more easily with grouping. A detailed description of GOATOOLS GO grouping is found in the manuscript.
  • Compare GO lists: Compare two or more lists of GO IDs using compare_gos.py, which can be used with or without grouping.
  • Stochastic GOEA simulations: One of the findings resulting from our simulations is: Larger study sizes result in higher GOEA sensitivity, meaning fewer truly significant observations go unreported. The code for the stochastic GOEA simulations described in the paper is found here

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:

  • For statistical testing of GO enrichment:

  • To plot the ontology lineage, install one of these two options:

    • Graphviz, for graph visualization.
    • pygraphviz, Python binding for communicating with Graphviz:
    • pydot, a Python interface to Graphviz's Dot language.

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:

  • gene names in a study
  • gene names in population (or other study if --compare is specified)
  • an association file that maps a gene name to a GO category.

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

  • wr_hier.py: Given a GO ID, write the hierarchy below (default) or above (--up) the given GO.

Plot GO lineage

  • go_plot.py:
    • Plots user-specified GO term(s) up to root
    • Multiple user-specified GOs
    • User-defined colors
    • Plot relationships (-r)
    • Optionally plot children of user-specfied GO terms
  • plot_go_term.py can plot the lineage of a certain GO term, by:
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 current gene ontology file go-basic.obo
  • the GOslim file to be used (e.g. goslim_generic.obo or any other GOslim file)

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:

  • bonferroni, bonferroni correction
  • sidak, sidak correction
  • holm, hold correction
  • fdr, false discovery rate (fdr) implementation using resampling

Additional methods are available if statsmodels is installed:

  • sm_bonferroni, bonferroni one-step correction
  • sm_sidak, sidak one-step correction
  • sm_holm-sidak, holm-sidak step-down method using Sidak adjustments
  • sm_holm, holm step-down method using Bonferroni adjustments
  • simes-hochberg, simes-hochberg step-up method (independent)
  • hommel, hommel closed method based on Simes tests (non-negative)
  • fdr_bh, fdr correction with Benjamini/Hochberg (non-negative)
  • fdr_by, fdr correction with Benjamini/Yekutieli (negative)
  • fdr_tsbh, two stage fdr correction (non-negative)
  • fdr_tsbky, two stage fdr correction (non-negative)
  • fdr_gbs, fdr adaptive Gavrilov-Benjamini-Sarkar

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:

  • Add code coverage runs

  • Edit tests in the makefile under the comment

  • Help setting up documentation. We are using Sphinx and Python docstrings to create documentation. For documentation practice, use make targets:

    make mkdocs_practice

    To remove practice documentation:

    make rmdocs_practice

    Once you are happy with the documentation do:

    make gh-pages

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

More Repositories

1

jcvi

Python library to facilitate genome assembly, annotation, and comparative genomics
Python
745
star
2

bio-pipeline

My collection of light bioinformatics analysis pipelines for specific tasks
CAP CDS
70
star
3

allhic

Genome scaffolding based on HiC data in heterozygous and high ploidy genomes
Jupyter Notebook
59
star
4

quota-alignment

Guided synteny alignment between duplicated genomes (within specified quota constraint)
Python
55
star
5

treecut

Find nodes in hierarchical clustering that are statistically significant
Python
28
star
6

mcscan

Command-line program to wrap dagchainer and combine pairwise results into multi-alignments in column format
C++
21
star
7

trimReads

Utility programs to trim or sort Illumina reads with adapter sequences
C++
15
star
8

rust-wfa2

Rust binding for WFA2-lib
Rust
9
star
9

klassify

Classify chimeric reads based on unique kmer contents
Jupyter Notebook
9
star
10

jcvi-bin

Collection of third-party softwares used in jcvi library
Java
5
star
11

dna-pygments

Javascript code to highlight features in biological sequences
JavaScript
5
star
12

Splithunter

Identify split reads in given chromosomal regions
C++
5
star
13

positional-history

Internal scripts to run the pipeline to determine the transpositions of A. thaliana genes with respect to multiple outgroups
Python
5
star
14

pybind11_log

A bridge from C++ to Python logging
C++
5
star
15

pgdd

Dynamic contents within the plant genome duplication database
Python
4
star
16

dotfiles

bashrc, vimrc, gitconfig and various other configuration files
C++
4
star
17

nannou-playground

Animation projects that leverage the excellent nannou library
Rust
2
star
18

tanghaibao

1
star