MAP2SLIM(1p)

πŸ“¦
version 0.15 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

map2slim β€” bestie, it maps gene associations to a 'slim' ontology πŸ’… no cap

(also hi, this is the map2slim(1p) page from the User Contributed Perl Documentation, section 1p, and it's iconic, let's go πŸ¦‹)


🌸 SYNOPSIS 🌸

cd go
map2slim GO_slims/goslim_generic.obo ontology/gene_ontology.obo gene-associations/gene_association.fb

πŸ’– DESCRIPTION πŸ’–

okay so here's the vibe: you hand it a GO slim file, plus a current ontology (in one or more files), and this script will map a gene association file β€” the kind stuffed with annotations to the full GO β€” onto the terms in the GO slim. slay.

You can use the script in two moods:

  • to create a whole new gene association file, packed with the most pertinent GO slim accessions, or
  • in count-mode, where it hits you with distinct gene product counts for each slim term πŸ”’

The association file format is described over here:

<http://www.geneontology.org/GO.annotation.shtml#file>


πŸŽ€ ARGUMENTS πŸŽ€

  • -b bucket slim file β€” this one adds bucket terms to the slim ontology; peep the documentation below for what that even means. The new slim ontology file, bucket terms included, gets written to bucket slim file.
  • -outmap slim mapping file β€” this generates a mapping file for every term in the full ontology, showing both the most pertinent slim term and all slim terms that are ancestors. If you use this option, do NOT supply a gene-associations file. fr fr.
  • shownames β€” (only works with -outmap) shows the names of the term in the slim mapping file πŸ‘‘
  • -c β€” this forces map2slim to give you counts of the assoc file, rather than mapping it.
  • -t β€” when you use this alongside -c, it tabs the output so the indentation reflects the tree hierarchy in the slim file 🌳
  • -o out file β€” writes the mapped assocs (or the counts) to the file you specified, instead of dumping it to the screen.

🌈 DOWNLOAD 🌈

This script is part of the go-perl package, available from CPAN:

<http://search.cpan.org/~cmungall/go-perl/>

This script will not work without installing go-perl. like, at all. it's giving bricked πŸ’€

🧚 MAPPING ALGORITHM 🧚

GO is a DAG, not a tree. Which means there is often more than one path from a GO term up to the root Gene_Ontology node; the path may intersect multiple terms in the slim ontology β€” WHICH MEANS one annotation can map to multiple slim terms! plot twist 😭

(note you need to view this online to see the image below - if you are not viewing this on the http://www.geneontology.org site, you can look at the following URL: <http://geneontology.cvs.sourceforge.net/*checkout*/geneontology/go-dev/go-perl/doc/map2slim.gif> )

A hypothetical example πŸ’­ blue circles show terms in the GO slim, and yellow circles show terms in the full ontology. The full ontology subsumes the slim, so the blue terms are also in the ontology.

 GO ID  MAPS TO SLIM ID        ALL SLIM ANCESTORS
 =====  ===============        ==================
 5      2+3                    2,3,1
 6      3 only                 3,1
 7      4 only                 4,3,1
 8      3 only                 3,1
 9      4 only                 4,3,1
 10     2+3                    2,3,1

The 2nd column shows the most pertinent ID(s) in the slim β€” that's the direct mapping. The 3rd column shows all ancestors in the slim.

Note β€” in particular β€” the mapping of ID 9: although this has two paths to the root through the slim via 3 and 4, 3 is discarded because it is subsumed by 4. bye 3 πŸ‘‹

On the other hand, 10 maps to both 2 and 3, because these are both the first slim ID in the two valid paths to the root, and neither subsumes the other. iconic behaviour honestly.

The algorithm used is:

  1. to map any one term in the full ontology: find all valid paths through to the root node in the full ontology
  2. for each path, take the first slim term encountered in the path
  3. discard any redundant slim terms in this set β€” ie slim terms subsumed by other slim terms in the set

πŸ“ BUCKET TERMS πŸ“

If you run the script with the -b option, bucket terms will be added. For any term P in the slim, if P has at least one child C, a bucket term P' will be created under P. This is a catch-all term for mapping any term in the full ontology that is a descendant of P, but NOT a descendant of any child of P in the slim ontology.

For example, the slim generic.0208 has the following terms and structure:

    %DNA binding ; GO:0003677
     %chromatin binding ; GO:0003682
     %transcription factor activity ; GO:0003700, GO:0000130

After adding bucket terms, it will look like this:

   %DNA binding ; GO:0003677
    %chromatin binding ; GO:0003682
    %transcription factor activity ; GO:0003700 ; synonym:GO:0000130
    @bucket:Z-OTHER-DNA binding ; slim_temp_id:12

Terms from the full ontology that are other children of DNA binding, such as single-stranded DNA binding and its descendents, will map to the bucket term.

The bucket term has a slim ID which is transient and is there only to facilitate the mapping. It should not be used externally. owners only 🚫

The bucket term has the prefix Z-OTHER; the Z is a hack to make sure that the term is always listed last in the alphabetic ordering. sneaky but it works πŸ’…

The algorithm is slightly modified if bucket terms are used. The bucket term has an implicit relationship to all OTHER siblings not in the slim.

Do I need bucket terms?

Nowadays most slim files are entirely or nearly 'complete', that is there are no gaps. This means the -b option will not produce noticeable different results. For example, you may see a bucket term OTHER-binding created, with nothing annotated to it: because all the children of binding in the GO are represented in the slim file. empty bucket, no notes πŸͺ£

The bucket option is really only necessary for some of the older archived slim files, which are static and were generated in a fairly ad-hoc way; they tend to accumulate 'gaps' over time (eg GO will add a new child of binding, but the static slim file won't be up to date, so any gene products annotated to this new term will map to OTHER-binding in the slim).


πŸ’… GRAPH MISMATCHES πŸ’…

Note that the slim ontology file(s) may be out of date with respect to the current ontology. not aging well bestie πŸ™ˆ

Currently map2slim does not flag graph mismatches between the slim graph and the graph in the full ontology file; it takes the full ontology as being the real graph. However, the slim ontology will be used to format the results if you select -t -c as options.


πŸ‘‘ OUTPUT πŸ‘‘

In normal mode, a standard format gene-association file will be written. The GO ID column (5) will contain GO slim IDs. The mapping corresponds to the 2nd column in the table above. Note that the output file may contain more lines than the input file. This is because some full GO IDs have more than one pertinent slim ID. growth mindset πŸ“ˆ

πŸ”’ COUNT MODE πŸ”’

map2slim can be run with the -c option, which will gives the counts of distinct gene products mapped to each slim term. The columns are as follows:

  • GO Term β€” the first column is the GO ID followed by the term name (the term name is provided as it is found in both the full GO and slim ontologies - these will usually be the same but occasionally the slim file will lag behind changes in the GO file).
  • Count of gene products for which this is the most relevant slim term β€” the number of distinct gene products for which this is the most pertinent/direct slim ID. By most direct we mean that either the association is made directly to this term, OR the association is made to a child of this slim term AND there is no child slim term which the association maps to. For most slims, this count will be equivalent to the number of associations directly mapped to this slim term. However, some older slim files are "spotty" in that they admit "gaps". For example, if the slim has all children of "biological process" with the exception of "behavior" then all annotations to "behavior" or its children will be counted here. see example below ⬇️
  • Count of gene products inferred to be associated with slim term β€” and the number of distinct gene products which are annotated to any descendant of this slim ID (or annotated directly to the slim ID).
  • obsoletion flag
  • GO ontology

To take an example; if we use -t and -c like this:

map2slim -t -c GO_slims/goslim_generic.obo ontology/gene_ontology.obo gene-associations/gene_association.fb

Then part of the results may look like this:

 GO:0008150 biological_process (biological_process)     34      10025           biological_process
  GO:0007610 behavior (behavior)        632     632             biological_process
  GO:0000004 biological process unknown (biological process unknown)    832     832             biological_process
  GO:0007154 cell communication (cell communication)    333     1701            biological_process
   GO:0008037 cell recognition (cell recognition)       19      19              biological_process
19 products were mapped to GO:0008037 or one of its children. (GO:0008037 is a leaf node in the slim, so the two counts are identical).

On the other hand, GO:0008150 only gets 34 products for which this is the most relevant term. This is because most annotations would map to some child of GO:0008150 in the slim, such as GO:0007610 (behavior). These 34 gene products are either annotated directly to GO:0008150, or to some child of this term which is not in the slim. This can point to 'gaps' in the slim. Note that running map2slim with the -b option will 'plug' these gaps with artificial filler terms. 🩹


🫢 AUTHOR 🫢

Chris Mungall BDGP


⭐ SEE ALSO ⭐

http://www.godatabase.org/dev

GO::Parser

GO::Model::Graph


and that's the whole page, bestie πŸŽ€ this gem was running on perl v5.36.0, dated 2023-12-18, and yeah it lives at MAP2SLIM(1p) β€” go forth and map those associations πŸ’œβœ¨

πŸ“¦ where this page comes from