goatools.goea.algorithms package

Submodules

Module contents

GOEA term-scoring algorithms.

>>> from goatools.goea.algorithms import get_algorithm
>>> get_algorithm('classic')
class goatools.goea.algorithms.GoeaAlgorithm[source]

Bases: object

Abstract base for GOEA term-scoring algorithms.

name = None
default_alternative = None
pvals_precorrected = False
run(ctx)[source]

Score ctx.goids. Returns a GoeaAlgoResult.

class goatools.goea.algorithms.GoeaAlgoResult(go2pval, go2flds)

Bases: tuple

go2flds

Alias for field number 1

go2pval

Alias for field number 0

class goatools.goea.algorithms.GoeaContext(goids, go2studyitems, go2popitems, study_ids, study_n, pop_n, godag, relationships, propagate_counts, calc_pvalue, log)

Bases: tuple

calc_pvalue

Alias for field number 9

go2popitems

Alias for field number 2

go2studyitems

Alias for field number 1

godag

Alias for field number 6

goids

Alias for field number 0

log

Alias for field number 10

pop_n

Alias for field number 5

propagate_counts

Alias for field number 8

relationships

Alias for field number 7

study_ids

Alias for field number 3

study_n

Alias for field number 4

class goatools.goea.algorithms.ClassicAlgorithm[source]

Bases: GoeaAlgorithm

Score each GO term on its own, ignoring the GO DAG topology.

This is the historical goatools behaviour and remains the default.

name = 'classic'
run(ctx)[source]

One independent test per GO term.

class goatools.goea.algorithms.ElimAlgorithm(cutoff=0.01, bonferroni=False)[source]

Bases: GoeaAlgorithm

Score GO terms bottom-up, eliminating the genes of significant children.

cutoff – a term is “significant”, and so eliminates its genes from its

ancestors, when its p-value is <= this. topGO’s default is 0.01, applied raw.

bonferroni – if True, use cutoff/N instead, where N is the number of terms

scored. The 2006 paper describes this Bonferroni-style adjustment, but topGO ships with the line commented out and uses the raw cutoff, so it is opt-in here.

name = 'elim'
default_alternative = 'greater'
pvals_precorrected = True
run(ctx)[source]

Score every GO ID in ctx.goids, bottom-up with gene elimination.

goatools.goea.algorithms.get_algorithm(algorithm=None, **kws)[source]

Get a GOEA algorithm from a name, an instance, or a class.

Keyword args prefixed with the algorithm’s name are passed to its constructor, e.g. get_algorithm(‘elim’, elim_cutoff=.01) -> ElimAlgorithm(cutoff=.01)