GO::Model::Term(3pm)
NAME π
GO::Model::Term β it's a term, it's a concept, it lives in an ontology. That's the whole vibe. π§
(this is the GO::Model::Term(3pm) page, from the User Contributed Perl Documentation, bestie π«Ά)
SYNOPSIS β¨
okay so here's the tea, two whole ways to get yourself a Term π
# From a file
use GO::Parser;
my $parser = new GO::Parser({handler=>'obj'}); # create parser object
$parser->parse("gene_ontology.obo"); # parse file -> objects
my $graph = $parser->handler->graph; # get L<GO::Model::Graph> object
my $term = $graph->get_term("GO:0001303"); # fetch a term by ID
printf "Term %s %s\n", $term->name, $term->acc;
# From a GO Database (requires go-db-perl)
my apph = GO::AppHandle->connect(-dbname=>$dbname);
my $term = $apph->get_term({acc=>00003677});
printf "Term:%s (%s)\nDefinition:%s\nSynonyms:%s\n",
$term->name,
$term->public_acc,
$term->definition,
join(", ", @{$term->synonym_list});
lowkey iconic, honestly. like, file route or database route, pick your fighter π
DESCRIPTION π¦
So this class represents an Ontology term β and babes, the same class does process, compartment AND function. one class, three jobs, main character energy fr fr β¨
heads up tho: right now, a Term is not aware of its Relationships. nope. it doesn't know its own lore π. if you wanna find out how a term is related to other terms, you gotta go through a GO::Model::Graph object, and that will hand you the GO::Model::Relationship objects. for example:
$rels = $graph->get_parent_relationships($term->acc);
see? graph does the social networking, not the term. periodt π
SEE ALSO πΈ
GO::Model::RelationshipGO::Model::GraphGO::Model::XrefGO::Model::Association
go read those too bestie, they're all in the same friend group π«Ά
NOTES π
Okay so this is the important part, don't scroll past it π
Like all the GO::Model::* classes, this one uses accessor methods to get or set the attributes. the rules are simple:
- call the accessor with no arguments β you get the value
- pass in an argument β the attribute gets set to that argument
for single-valued attributes it looks like this:
# this sets the value of the attribute
$my_object->attribute_name("my value");
# this gets the value of the attribute
$my_value = $my_object->attribute_name();
and for lists, you pass a reference, bestie:
# this sets the values of the attribute
$my_object->attribute_name(\@my_values);
# this gets the values of the attribute
$my_values = $my_object->attribute_name();
β οΈ also, tiny thing: the original page spells it "attribuet" in that paragraph. we love a typo era π anyway, moving on.
acc π
- Usage β
print $term->acc() - Alias β
public_acc - Returns β
- Args β
accessor: gets/sets the GO ID/accession, as an integer
throws: an exception if you try to pass in a non-integer π¨ (do NOT do that)
if you wanna use IDs in the format GO:0000nnn, then you use the method public_acc() instead. that's the whole point of the alias, slay π
name π·οΈ
- Usage β
print $term->name; - Returns β
- Args β
accessor: gets/sets the "name" attribute
subset_list π
- Usage β
foreach (@{$term->subset_list || []}) { printf " $_\n" } - Returns β list of strings
- Args β list of strings [optional]
This is your List of subset Accs for a term β¨
fun fact: Subsets are also known as GO Slims. iykyk π
in_subset π
- Usage β
if ($term->in_subset('goslim_prok'); - Returns β bool
- Args β subset-name str
Tests if the term belongs to a subset. yes/no queen π
definition π
- Usage β
print $term->definition; - Returns β
- Args β
accessor: gets/sets the "definition" attribute
primary_xref π
- Title β
primary_xref - Usage β
- Function β
- Example β
- Returns β
GO::Model::Xref - Args β
The same as acc(), except the ID comes back as a GO::Model::Xref rather than a string. glow up edition β¨
comment π¬
- Title β
comment - Usage β
$obj->comment($newval) - Function β
- Example β
- Returns β value of comment (a scalar)
- Args β on set, new value (a scalar or undef, optional)
definition_dbxref_list ποΈ
- Title β
definition_dbxref_list - Usage β
$obj->definition_dbxref(\@xrefs) - Function β
- Example β
- Returns β definition_dbxref_list hashlist (of
GO::Model::Xref) - Args β on set, new values (
GO::Model::Xrefhashlist)
GO::Model::Xref π
add_definition_dbxref β
- Usage :
$term->add_definition_dbxref($xref); - Args :
GO::Term::Xref
GO::Model::Xref π
has_synonym π€
- Usage β
if ($term->has_synonym("autotrophy") {...} - Returns β bool
- Args β string
add_synonym π
- Usage β
$term->add_synonym("calcineurin"); - Usage β
$term->add_synonym(@synonym_strings); - Returns β
- Args β
Adds a synonym; loses type information (the synonym type ends up blank). so like, it forgets what kind of synonym it was π keep that in mind bestie.
synonym_list π
- Usage β
my $syn_l = $term->synonym_list; - Usage β
$term->synonym_list([$syn1, $syn2]); - Returns β arrayref
- Args β arrayref [optional]
accessor: gets/sets list of synonyms [array reference]
each synonym is represented as a string β so this method loses synonym typing information. If you use it as a setter, it will set the type for each synonym to null. π
add_synonym_by_type π·οΈβ¨
- Usage β
$term->add_synonym_by_type('exact', $syn); - Returns β
- Args β
synonyms_by_type π
- Usage β
$synstrs = $term->synonyms_by_type('exact'); - Usage β
$term->synonyms_by_type('exact', \@exact_syns); - Returns β arrayref of strings
- Args β type string, arrayref of strings [optional]
in getter mode, it gets you a list of synonyms of a particular type π
in setter mode, it sets a list of synonyms for a particular type π
alt_id_list π§¬
- Usage β
my $syn_l = $term->alt_id_list; - Usage β
$term->alt_id_list([$syn1, $syn2]); - Returns β arrayref
- Args β arrayref [optional]
accessor: gets/sets list of synonyms [array reference]
(yeah, the original says "synonyms" here even though it's the alt id list. we don't ask questions, we just report the facts π)
add_alt_id βπ§¬
- Usage β
$term->add_alt_id('GO:0000001'); - Returns β
- Args β id string, or list of id strings
namespace (INHERITED) π§
- Usage β
print $term->namespace(); # getting the type - Usage β
$term->namespace("molecular_function"); # setting the type - Alias β
type - Alias β
term_type - Alias β
category - Alias β
ontology - Returns β string representing type
- Args β string represnting type [optional]
The OBO namespace for the GO::Model::Term or GO::Model::Relationship β¨
This method is inherited from the superclass, so say thank you to your ancestors π«Ά
set_namespace_by_code π€
- Usage β
$term->set_namespace_by_code("P"); - Returns β
- Args β String:
M,PorC
Currently the mapping is hardcoded:
('F'=>'molecular_function',
'P'=>'biological_process',
'C'=>'cellular_component');
no cap, that's literally baked in π₯
get_code_from_namespace π‘
- Usage β
$code = $term->get_code_from_namespace; - Returns β String:
M,PorF - Args β String (if omitted will use current namespace)
Returns the code for the current namespace (or any given namespace if supplied) π
add_dbxref βπ
- Usage :
$term->add_dbxref($xref); - Args :
GO::Term::Xref
GO::Model::Xref π
dbxref_list ποΈ
- Usage :
$term->dbxref_list($xref); - Args : optional listref of
GO::Term::Xref - Returns : listref of
GO::Term::Xref
accessor: gets/sets list of dbxref [array reference]
is_obsolete π
accessor: gets/set obsolete flag [boolean
(yeah the bracket never closes in the original. iconic honestly. it stays.)
is_root π
accessor: gets/set is_root flag [boolean]
and that's part 1 bestie β hold on, there's more coming πβ¨
β¨ TERM ASSOCIATION METHODS β¨
okay bestie, this is the part where your term gets a whole social circle π every protein that ever said "yeah I'm associated with this" lives down here.
π association_list
Usage - $assoc_l = $term->association_list
Returns - arrayref of GO::Model::Association
Args - arrayref of GO::Model::Association [optional]
accessor energy: gets / sets the list of associations. it's an array reference, obviously π
and if this thing is undef, the datasource is gonna get queried for the associations. she goes and fetches. no shame in it.
π selected_association_list
Usage - $assoc_l = $term->selected_association_list
Returns - arrayref of GO::Model::Association
Args - arrayref of GO::Model::Association [optional]
accessor: gets the list of SELECTED associations, again as an array reference.
heads up: this method is only of use if you're rocking it alongside GO::AppHandle in the go-db-perl distro π«Ά
and no, this is not the total list of every association tied to the term. if the term got created via a query on products, then yeah, it'll include those associations. iykyk.
refs: GO::Model::Association β¨
π¦ add_association
Usage - $term->add_association($assoc);
Returns -
Args - GO::Model::Association
you hand her an association, she adds it. that's the whole vibe.
refs: GO::Model::Association
πΈ add_selected_association
Usage -
Returns -
Args -
the docs are giving mystery, but the name is not subtle bestie. it adds a selected association π
refs: GO::Model::Association
π§ association_hash
returns associations as a listref of unique GeneProduct objects. no dupes, she said periodt.
refs: GO::Model::Association
π get_all_associations
Usage - my $al = $term->get_all_associations
Returns - GO::Model::Association list
Args -
returns all associations for the term and the terms beneath it in the GO DAG. it's giving generational.
same as $apph->get_all_associations($term) β
refs: GO::Model::Association
π₯ n_associations
Usage - my $n = $term->n_associations
Returns -
Args -
it counts. that's it, that's the method π
π product_list
Usage - $prods = $term->product_list
Returns - L<GO::Model::GeneProduct> listref
Args -
Returns a reference to an array of gene products that are attached directly to this term. direct only, no plus-ones.
(fr fr: if the products have not been fetched, this method will call $term->association_list, cache the results, and use the associations to build the product list. so the next calls of product_list on this term will be faster β she learned, she remembered, she slays β¨)
See GO::Model::GeneProduct
π deep_product_list
Usage -
Returns - GO::Model::GeneProduct listref
Args -
finds all the products attached to this term and all terms below in the graph. the whole downline showed up to the party π
refs: GO::Model::GeneProduct
π
n_deep_products
Usage - my $count = $term->n_deep_products;
Returns - int
Args - filter (hashref) - or string "recount"
gets the count for the distinct number of GO::Model::GeneProduct entries annotated at OR BELOW this level. if you already set the filters in GO::AppHandle, then those filters get used when figuring out the count.
Remember bestie: if you did not explicitly set the filters, then the default filter will be used, which is [!IEA] (i.e. curated associations only, see www.geneontology.org for a whole discussion on evidence codes π).
Note: currently only thespeciesdbfilter is respected. turns out it's very expensive to do the set arithmetic for distinct recursive gene counts with different evidence combinations. but because each product belongs to onespeciesdbonly, the speciesdb counts are mutually exclusive, which makes this way easier. thank u for your service π
# get the number of gene products that have been annotated
# as transcription factors in worm and fly discounting
# uncurated automatic annotations
$apph->filters({evcodes=>["!IEA"], speciesdbs=>["SGD", "FB"]});
$term = $apph->get_term({name=>"transcription factor"});
print $term->n_deep_products;
The count will be cached, so if you alter the filter parameters be sure to get a recount like this:
my $count = $term->n_deep_products("recount");
TODO: make the recount automatic if the filter is changed (not me being patient about this, no ma'am π)
PERFORMANCE NOTE 1: When you ask the AppHandle to give you a list of GO::Model::Term objects, it may decide to populate this attribute while it's building the terms in a fast and efficient way. Therefore you should avoid setting the filters after you've created the objects, otherwise it'll have to refetch all these values and slow everything down. don't do that to yourself π«Ά
PERFORMANCE NOTE 2: If you're using the SQL GO::AppHandle implementation, then this call will probably involve a query to the gene_produc_count table. and if you populated the database you're using yourself, make sure this table is filled, otherwise this is gonna be one expensive query πΈ
refs: GO::Model::GeneProduct
π n_products
Usage - as n_deep_products
Returns -
Args -
see docs for n_deep_products ^^^
gets a count of products AT THIS LEVEL ONLY. no descendants invited, this one's intimate π
refs: GO::Model::GeneProduct
π loadtime
Title : loadtime
Usage :
Function:
Example :
Returns : time term was loaded into datasource
Args : none
Returns the time the term was loaded into the datasource. no args, she just tells you when she arrived πΈ
and that's a wrap on the whole page, bestie!! go forth and associate π this iconic piece of documentation came from the perl v5.36.0 release, dated 2023-12-18, and it's filed under GO::Model::Term(3pm) β give her a lil kiss on the forehead, she earned it πβ¨
π¦ where this page comes from
- debian trixie: libgo-perl 0.15-10 Β· Perl
- ubuntu noble: libgo-perl 0.15-10 Β· Perl
- ubuntu resolute: libgo-perl 0.15-10 Β· Perl
- ubuntu stonking: libgo-perl 0.15-10 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms