pypath.utils.go.GOAnnotation§
- class pypath.utils.go.GOAnnotation(organism=9606, ontology=None, pickle_file=None, use_pickle_cache=True)[source]§
Bases:
Logger
- __init__(organism=9606, ontology=None, pickle_file=None, use_pickle_cache=True)[source]§
For one organism loads Gene Ontology annotations, in addition it accepts or creates a
GeneOntology
object.
Methods
__init__
([organism, ontology, pickle_file, ...])For one organism loads Gene Ontology annotations, in addition it accepts or creates a
GeneOntology
object.Returns all UniProt IDs having annotations.
expr_names_to_terms
(expr)Processes an expression built by names to expressions of terms.
get_annot
(uniprot, aspect)For a UniProt ID returns its direct annotations from one aspect of Gene Ontology.
get_annot_ancestors
(uniprot, aspect)For a UniProt ID returns its annotations including lowest level terms and their ancestors from one aspect of Gene Ontology.
get_annots
(uniprot)For a UniProt ID returns its direct annotations from all aspects of Gene Ontology.
get_annots_ancestors
(uniprot)For a UniProt ID returns its annotations including lowest level terms and their ancestors from all aspects of Gene Ontology.
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.
has_any_term
(uniprot, terms)Tells if an UniProt ID is annotated with any of a set of GO terms.
has_term
(uniprot, term)Tells if an UniProt ID is annotated with a GO term.
i_select_by_term
(term[, uniprots])Accepts a list of UniProt IDs and one or more gene ontology terms and returns a set of indices of those UniProts which are annotated with any of the terms.
load_from_pickle
([pickle_file])reload
()Reloads the object from the module level.
save_to_pickle
([pickle_file])select
(terms[, uniprots, return_uniprots])Retrieves the UniProt IDs annotated with any Gene Ontology terms or their descendants, or evaluates string expression (see
select_by_expr
).select_by_all
(terms[, uniprots, return_uniprots])Selects the nodes annotated by all GO terms in
terms
.select_by_expr
(expr[, uniprots, return_uniprots])Selects UniProts based on an expression of Gene Ontology terms.
select_by_expr_terms
(expr[, uniprots, ...])Selects UniProts based on an expression of Gene Ontology terms.
select_by_name
(name[, uniprots, return_uniprots])Accepts a list of UniProt IDs and one or more gene ontology names and returns the UniProts which are annotated with any of the names.
select_by_term
(term[, uniprots])Accepts a list of UniProt IDs and one or more gene ontology terms and returns the UniProts which are annotated with any of the terms.
Attributes
aspects
- expr_names_to_terms(expr)[source]§
Processes an expression built by names to expressions of terms.
- Parameters:
expr (str) – An expression using Gene Ontology names, parentheses and logical operators.
- get_annot(uniprot, aspect)[source]§
For a UniProt ID returns its direct annotations from one aspect of Gene Ontology. Returns set.
- get_annot_ancestors(uniprot, aspect)[source]§
For a UniProt ID returns its annotations including lowest level terms and their ancestors from one aspect of Gene Ontology. Returns set.
- get_annots(uniprot)[source]§
For a UniProt ID returns its direct annotations from all aspects of Gene Ontology. Returns set.
- get_annots_ancestors(uniprot)[source]§
For a UniProt ID returns its annotations including lowest level terms and their ancestors from all aspects of Gene Ontology. Returns set.
- has_any_term(uniprot, terms)[source]§
Tells if an UniProt ID is annotated with any of a set of GO terms.
- i_select_by_term(term, uniprots=None)[source]§
Accepts a list of UniProt IDs and one or more gene ontology terms and returns a set of indices of those UniProts which are annotated with any of the terms. If no UniProts given all annotated UniProts considered.
- Parameters:
term (str,set) – A single GO term or set of terms.
- select(terms, uniprots=None, return_uniprots=False)[source]§
Retrieves the UniProt IDs annotated with any Gene Ontology terms or their descendants, or evaluates string expression (see
select_by_expr
). Returns indices of the selected elements in theuniprots
list or the set of selected UniProt IDs.- Parameters:
terms (str,set) – A single GO term, a set of GO terms or an expression with GO terms.
return_uniprots (bool) – By default returns list of indices; if
True
returns a set of the selected UniProt IDs.
- select_by_all(terms, uniprots=None, return_uniprots=False)[source]§
Selects the nodes annotated by all GO terms in
terms
.Returns indices of the selected elements in the
uniprots
list or the set of selected UniProt IDs.- Parameters:
terms (list) – List, set or tuple of GO terms.
return_uniprots (bool) – By default returns list of indices; if
True
returns a set of the selected UniProt IDs.
- select_by_expr(expr, uniprots=None, return_uniprots=False)[source]§
Selects UniProts based on an expression of Gene Ontology terms. Operator precedence not considered, please use parentheses. Return indices of the selected elements in the
uniprots
list or the set of selected UniProt IDs.- Parameters:
expr (str) – An expression of Gene Ontology terms and names. E.g.
'(GO:0005576 and not GO:0070062) or GO:0005887'
. Parentheses and operatorsand
,or
andnot
can be used. Another example:hormone binding AND (cell surface OR GO:0009897)
.return_uniprots (bool) – By default returns list of indices; if
True
returns a set of the selected UniProt IDs.
- select_by_expr_terms(expr, uniprots=None, return_uniprots=False)[source]§
Selects UniProts based on an expression of Gene Ontology terms. Operator precedence not considered, please use parentheses. Return indices of the selected elements in the
uniprots
list or the set of selected UniProt IDs.- Parameters:
expr (str) – An expression of Gene Ontology terms. E.g.
'(GO:0005576 and not GO:0070062) or GO:0005887'
. Parentheses and operatorsand
,or
andnot
can be used.return_uniprots (bool) – By default returns list of indices; if
True
returns a set of the selected UniProt IDs.
- select_by_name(name, uniprots=None, return_uniprots=False)[source]§
Accepts a list of UniProt IDs and one or more gene ontology names and returns the UniProts which are annotated with any of the names. If no UniProts given all annotated UniProts returned.
- Parameters:
name (str,set) – A single GO term name or set of names.
return_uniprots (bool) – By default returns list of indices; if
True
returns a set of the selected UniProt IDs.