pypath.utils.go.GeneOntology§

class pypath.utils.go.GeneOntology(terms=None, ancestors=None, descendants=None, aspect=None, term=None, name=None)[source]§

Bases: Logger

__init__(terms=None, ancestors=None, descendants=None, aspect=None, term=None, name=None)[source]§

Loads data about Gene Ontology terms and their relations.

Methods

__init__([terms, ancestors, descendants, ...])

Loads data about Gene Ontology terms and their relations.

all_from_aspect(aspect)

Returns the set of all GO terms of one aspect.

aspect_from_name(name)

Tells about a Gene Ontology term name which aspect does it belong to.

flatten(terms, *args[, lowest])

Returns a set of terms by removing either all redundant ancestors or descendants from the provided set terms.

get_all_ancestors(terms[, relations, ...])

Returns a set of all ancestors of a single term or a set of terms.

get_all_descendants(terms[, relations, ...])

Returns a set of all descendants of a single term or a set of terms.

get_aspect(term)

For a GO term tells which aspect does it belong to.

get_name(term)

For a GO accession number returns the name of the term.

get_term(name)

For a GO term name returns its GO accession number.

highest(terms, *args)

From a set of terms returns the highest level ones, removing all which are descendants of some others in the set.

is_leaf(term)

Tells if a term is a leaf of the graph i.e. it has no descendants.

is_name(name)

Tells if name is a GO term name.

is_root(term)

Tells if a term is the root of the graph i.e. it has no ancestors.

is_term(term)

Tells if term is a GO accession number.

lowest(terms, *args)

From a set of terms returns the lowest level ones, removing all which are parents of some others in the set.

names_to_terms(names)

For a list of GO terms returns a list of tuples with the terms and their names.

names_to_terms_aspects(names)

For a list of GO namess returns a list of tuples with the terms, their names and ontology aspects.

reload()

Reloads the object from the module level.

set_of(terms_names, *args[, to_terms])

Converts anything to a set of terms or names.

set_of_names(terms_names, *args)

Converts anything to a set of names.

set_of_terms(terms_names, *args)

Converts anything to a set of terms.

subgraph_nodes(direction, terms[, ...])

Returns a set of all nodes either in the subgraph of ancestors or descendants of a single term or a set of terms.

terms_to_names(terms)

For a list of GO names returns a list of tuples with the terms and their names.

terms_to_names_aspects(terms)

For a list of GO terms returns a list of tuples with the terms, their names and the ontology aspect.

Attributes

all_relations

all_from_aspect(aspect)[source]§

Returns the set of all GO terms of one aspect.

aspect_from_name(name)[source]§

Tells about a Gene Ontology term name which aspect does it belong to.

flatten(terms, *args, lowest=True)[source]§

Returns a set of terms by removing either all redundant ancestors or descendants from the provided set terms. By removing the ancestors you get the lowest level set of terms, by removing the descendants the result will be the highest level non-redundant terms.

Parameters:

direction (str) – Either lowest or highest.

get_all_ancestors(terms, relations=None, include_seed=True)[source]§

Returns a set of all ancestors of a single term or a set of terms.

get_all_descendants(terms, relations=None, include_seed=True)[source]§

Returns a set of all descendants of a single term or a set of terms.

get_aspect(term)[source]§

For a GO term tells which aspect does it belong to. Returns None if the term is not in the ontology.

get_name(term)[source]§

For a GO accession number returns the name of the term. If term is already a GO term name returns it unchanged.

get_term(name)[source]§

For a GO term name returns its GO accession number. If name is a GO accession returns it unchanged.

highest(terms, *args)[source]§

From a set of terms returns the highest level ones, removing all which are descendants of some others in the set.

is_leaf(term)[source]§

Tells if a term is a leaf of the graph i.e. it has no descendants.

is_name(name)[source]§

Tells if name is a GO term name.

is_root(term)[source]§

Tells if a term is the root of the graph i.e. it has no ancestors.

is_term(term)[source]§

Tells if term is a GO accession number.

lowest(terms, *args)[source]§

From a set of terms returns the lowest level ones, removing all which are parents of some others in the set.

names_to_terms(names)[source]§

For a list of GO terms returns a list of tuples with the terms and their names.

names_to_terms_aspects(names)[source]§

For a list of GO namess returns a list of tuples with the terms, their names and ontology aspects.

reload()[source]§

Reloads the object from the module level.

set_of(terms_names, *args, to_terms=True)[source]§

Converts anything to a set of terms or names. terms_names can be either a single term or name or an iterable of terms and names.

Parameters:

to_terms (bool) – The target identifier type is term; if False the target will be name.

set_of_names(terms_names, *args)[source]§

Converts anything to a set of names. terms_names can be either a single term or name or an iterable of terms and names.

set_of_terms(terms_names, *args)[source]§

Converts anything to a set of terms. terms_names can be either a single term or name or an iterable of terms and names.

subgraph_nodes(direction, terms, relations=None, include_seed=True)[source]§

Returns a set of all nodes either in the subgraph of ancestors or descendants of a single term or a set of terms.

Parameters:
  • direction (str) – Possible values: ancestors or descendants.

  • include_seed (bool) – Include terms in the subgraph or only the related nodes.

terms_to_names(terms)[source]§

For a list of GO names returns a list of tuples with the terms and their names.

terms_to_names_aspects(terms)[source]§

For a list of GO terms returns a list of tuples with the terms, their names and the ontology aspect.