from ontobio import OntologyFactory
ont = OntologyFactory().create('go')
relations=['subClassOf', 'BFO:0000050']
m = ont.create_slim_mapping(subset='goslim_generic', relations=relations)
m['GO:0016577']
['GO:0051276', 'GO:0006464']
# show the first 20 GO terms plus their mappings
for n in ont.nodes()[0:20]:
if n.startswith('GO:'):
print('{} {}'.format(n, ont.label(n)))
for x in m[n]:
print(' --> {} {}'.format(x, ont.label(x)))
GO:0052060 evasion or tolerance by symbiont of host-produced nitric oxide --> GO:0044403 symbiosis, encompassing mutualism through parasitism GO:0061698 protein deglutarylation --> GO:0006464 cellular protein modification process GO:0061092 positive regulation of phospholipid translocation --> GO:0061024 membrane organization GO:0048027 mRNA 5'-UTR binding --> GO:0003729 mRNA binding GO:0048325 negative regulation of axial mesodermal cell fate determination --> GO:0008150 biological_process GO:0061444 endocardial cushion cell development --> GO:0048856 anatomical structure development --> GO:0030154 cell differentiation GO:0000332 template for synthesis of G-rich strand of telomere DNA activity --> GO:0009058 biosynthetic process --> GO:0006259 DNA metabolic process --> GO:0003677 DNA binding --> GO:0016779 nucleotidyltransferase activity GO:0034367 macromolecular complex remodeling --> GO:0008150 biological_process GO:2001238 positive regulation of extrinsic apoptotic signaling pathway --> GO:0008150 biological_process GO:0003154 BMP signaling pathway involved in determination of left/right symmetry --> GO:0048856 anatomical structure development --> GO:0007165 signal transduction GO:0098839 postsynaptic density membrane --> GO:0043226 organelle --> GO:0005886 plasma membrane GO:2001116 methanopterin-containing compound biosynthetic process --> GO:0009058 biosynthetic process --> GO:0034641 cellular nitrogen compound metabolic process
from ontobio.assoc_factory import AssociationSetFactory
MOUSE = 'NCBITaxon:10090'
# Create association set
# Transparently uses remote Monarch service.
# (May take a few seconds to run first time, Jupyter will show '*'. BE PATIENT, do
# not re-execute cell)
afactory = AssociationSetFactory()
aset = afactory.create(ontology=ont,
subject_category='gene',
object_category='function', # this is ALL GO, not just MF
taxon=MOUSE)
sample = aset.subjects[0:20]
sample
['MGI:1349388', 'MGI:3645524', 'MGI:1916411', 'MGI:2444552', 'MGI:2444277', 'MGI:106321', 'MGI:2444891', 'MGI:1933174', 'MGI:2676815', 'MGI:2152450', 'MGI:1349400', 'MGI:88460', 'MGI:2142075', 'MGI:2654437', 'MGI:1342248', 'MGI:2179723', 'MGI:2686534', 'MGI:1918361', 'MGI:2449771', 'MGI:1202388']
for g in sample:
print('{} {}'.format(g,aset.label(g)))
for a in aset.annotations(g):
print(' {} {}'.format(a,ont.label(a)))
for mn in m[a]:
print(' --> {} {}'.format(mn,ont.label(mn)))
MGI:1349388 Cops7b GO:0000338 protein deneddylation --> GO:0006464 cellular protein modification process GO:0008180 COP9 signalosome --> GO:0043234 protein complex --> GO:0005634 nucleus GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0005634 nucleus --> GO:0005634 nucleus GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0005654 nucleoplasm --> GO:0005654 nucleoplasm MGI:3645524 Vmn1r224 GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0007606 sensory perception of chemical stimulus --> GO:0050877 neurological system process GO:0005575 cellular_component --> GO:0005575 cellular_component MGI:1916411 Manbal GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0016020 membrane --> GO:0005575 cellular_component GO:0016021 integral component of membrane --> GO:0005575 cellular_component GO:0005575 cellular_component --> GO:0005575 cellular_component GO:0008150 biological_process --> GO:0008150 biological_process MGI:2444552 Actbl2 GO:0070062 extracellular exosome --> GO:0043226 organelle --> GO:0005615 extracellular space GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0005856 cytoskeleton --> GO:0005856 cytoskeleton GO:0005615 extracellular space --> GO:0005615 extracellular space GO:0000166 nucleotide binding --> GO:0003674 molecular_function GO:0005524 ATP binding --> GO:0043167 ion binding GO:0008150 biological_process --> GO:0008150 biological_process MGI:2444277 Islr2 GO:0005515 protein binding --> GO:0003674 molecular_function GO:0016021 integral component of membrane --> GO:0005575 cellular_component GO:0005886 plasma membrane --> GO:0005886 plasma membrane GO:0045773 positive regulation of axon extension --> GO:0048856 anatomical structure development --> GO:0030154 cell differentiation GO:0007275 multicellular organism development --> GO:0048856 anatomical structure development GO:0016020 membrane --> GO:0005575 cellular_component GO:0007399 nervous system development --> GO:0048856 anatomical structure development GO:0009986 cell surface --> GO:0005623 cell MGI:106321 Dock9 GO:0045296 cadherin binding --> GO:0003674 molecular_function GO:0005085 guanyl-nucleotide exchange factor activity --> GO:0003674 molecular_function --> GO:0008150 biological_process GO:0017048 Rho GTPase binding --> GO:0019899 enzyme binding GO:0005089 Rho guanyl-nucleotide exchange factor activity --> GO:0003674 molecular_function --> GO:0008150 biological_process GO:0007264 small GTPase mediated signal transduction --> GO:0007165 signal transduction GO:0043547 positive regulation of GTPase activity --> GO:0008150 biological_process GO:0016020 membrane --> GO:0005575 cellular_component MGI:2444891 Abra GO:0015031 protein transport --> GO:0006810 transport GO:0030016 myofibril --> GO:0043226 organelle --> GO:0005737 cytoplasm GO:0015629 actin cytoskeleton --> GO:0005856 cytoskeleton GO:0035025 positive regulation of Rho protein signal transduction --> GO:0008150 biological_process GO:0006810 transport --> GO:0006810 transport GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0003779 actin binding --> GO:0008092 cytoskeletal protein binding GO:0000060 protein import into nucleus, translocation --> GO:0006913 nucleocytoplasmic transport GO:0030017 sarcomere --> GO:0043226 organelle --> GO:0005737 cytoplasm GO:0005856 cytoskeleton --> GO:0005856 cytoskeleton GO:0051091 positive regulation of sequence-specific DNA binding transcription factor activity --> GO:0008150 biological_process GO:0006355 regulation of transcription, DNA-templated --> GO:0008150 biological_process GO:0005886 plasma membrane --> GO:0005886 plasma membrane GO:0006351 transcription, DNA-templated --> GO:0009058 biosynthetic process --> GO:0034641 cellular nitrogen compound metabolic process GO:0045944 positive regulation of transcription from RNA polymerase II promoter --> GO:0008150 biological_process GO:0045893 positive regulation of transcription, DNA-templated --> GO:0008150 biological_process MGI:1933174 Bri3 GO:0016020 membrane --> GO:0005575 cellular_component GO:0016021 integral component of membrane --> GO:0005575 cellular_component GO:0042802 identical protein binding --> GO:0003674 molecular_function MGI:2676815 Mir129-1 GO:0045202 synapse --> GO:0005575 cellular_component GO:0060291 long-term synaptic potentiation --> GO:0008150 biological_process GO:0035195 gene silencing by miRNA --> GO:0008150 biological_process MGI:2152450 Usp3 GO:0006508 proteolysis --> GO:0008150 biological_process GO:0016578 histone deubiquitination --> GO:0051276 chromosome organization --> GO:0006464 cellular protein modification process GO:0006511 ubiquitin-dependent protein catabolic process --> GO:0009056 catabolic process GO:0000278 mitotic cell cycle --> GO:0000278 mitotic cell cycle GO:0007049 cell cycle --> GO:0007049 cell cycle GO:0031647 regulation of protein stability --> GO:0008150 biological_process GO:0008234 cysteine-type peptidase activity --> GO:0008233 peptidase activity GO:0008270 zinc ion binding --> GO:0043167 ion binding GO:0042393 histone binding --> GO:0042393 histone binding GO:0005634 nucleus --> GO:0005634 nucleus GO:0006281 DNA repair --> GO:0006259 DNA metabolic process --> GO:0006950 response to stress GO:0070938 contractile ring --> GO:0005623 cell GO:0016787 hydrolase activity --> GO:0003674 molecular_function GO:0016569 covalent chromatin modification --> GO:0051276 chromosome organization GO:0008233 peptidase activity --> GO:0008233 peptidase activity GO:0004843 thiol-dependent ubiquitin-specific protease activity --> GO:0008233 peptidase activity GO:0000790 nuclear chromatin --> GO:0000228 nuclear chromosome GO:0016579 protein deubiquitination --> GO:0006464 cellular protein modification process GO:0006974 cellular response to DNA damage stimulus --> GO:0006950 response to stress GO:0000122 negative regulation of transcription from RNA polymerase II promoter --> GO:0008150 biological_process GO:0001046 core promoter sequence-specific DNA binding --> GO:0003677 DNA binding GO:0006355 regulation of transcription, DNA-templated --> GO:0008150 biological_process GO:0005654 nucleoplasm --> GO:0005654 nucleoplasm GO:0046872 metal ion binding --> GO:0043167 ion binding GO:0003682 chromatin binding --> GO:0003674 molecular_function GO:0036459 thiol-dependent ubiquitinyl hydrolase activity --> GO:0008233 peptidase activity MGI:1349400 Cops7a GO:0000338 protein deneddylation --> GO:0006464 cellular protein modification process GO:0008180 COP9 signalosome --> GO:0043234 protein complex --> GO:0005634 nucleus GO:0005829 cytosol --> GO:0005829 cytosol GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0005634 nucleus --> GO:0005634 nucleus GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0005654 nucleoplasm --> GO:0005654 nucleoplasm MGI:88460 Col6a2 GO:0031012 extracellular matrix --> GO:0005576 extracellular region MGI:2142075 Nars2 GO:0004812 aminoacyl-tRNA ligase activity --> GO:0016874 ligase activity GO:0016874 ligase activity --> GO:0016874 ligase activity GO:0006418 tRNA aminoacylation for protein translation --> GO:0006412 translation --> GO:0006520 cellular amino acid metabolic process --> GO:0006399 tRNA metabolic process GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0005829 cytosol --> GO:0005829 cytosol GO:0006421 asparaginyl-tRNA aminoacylation --> GO:0006412 translation --> GO:0006520 cellular amino acid metabolic process --> GO:0006399 tRNA metabolic process GO:0006412 translation --> GO:0006412 translation GO:0000166 nucleotide binding --> GO:0003674 molecular_function GO:0005654 nucleoplasm --> GO:0005654 nucleoplasm GO:0004816 asparagine-tRNA ligase activity --> GO:0016874 ligase activity GO:0005524 ATP binding --> GO:0043167 ion binding GO:0003676 nucleic acid binding --> GO:0003674 molecular_function GO:0005739 mitochondrion --> GO:0005739 mitochondrion MGI:2654437 Asb16 GO:0000151 ubiquitin ligase complex --> GO:0005622 intracellular GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0005634 nucleus --> GO:0005634 nucleus GO:0004842 ubiquitin-protein transferase activity --> GO:0003674 molecular_function --> GO:0006464 cellular protein modification process GO:0031625 ubiquitin protein ligase binding --> GO:0019899 enzyme binding GO:0035556 intracellular signal transduction --> GO:0007165 signal transduction GO:0008150 biological_process --> GO:0008150 biological_process MGI:1342248 Slc25a17 GO:0015908 fatty acid transport --> GO:0006810 transport GO:0055085 transmembrane transport --> GO:0055085 transmembrane transport GO:0015230 FAD transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0005779 integral component of peroxisomal membrane --> GO:0005777 peroxisome GO:0016020 membrane --> GO:0005575 cellular_component GO:0006810 transport --> GO:0006810 transport GO:0006635 fatty acid beta-oxidation --> GO:0044281 small molecule metabolic process --> GO:0006629 lipid metabolic process --> GO:0009056 catabolic process GO:0098655 cation transmembrane transport --> GO:0055085 transmembrane transport GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0016021 integral component of membrane --> GO:0005575 cellular_component GO:0080121 AMP transport --> GO:0006810 transport GO:0005743 mitochondrial inner membrane --> GO:0005739 mitochondrion GO:0005739 mitochondrion --> GO:0005739 mitochondrion GO:0080122 AMP transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0015867 ATP transport --> GO:0006810 transport GO:0098656 anion transmembrane transport --> GO:0055085 transmembrane transport GO:0051087 chaperone binding --> GO:0003674 molecular_function GO:0015858 nucleoside transport --> GO:0006810 transport GO:0015228 coenzyme A transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0005778 peroxisomal membrane --> GO:0005777 peroxisome GO:0051724 NAD transporter activity --> GO:0003674 molecular_function --> GO:0006810 transport GO:0006839 mitochondrial transport --> GO:0006810 transport GO:0005347 ATP transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0015217 ADP transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0044610 FMN transmembrane transporter activity --> GO:0022857 transmembrane transporter activity GO:0005777 peroxisome --> GO:0005777 peroxisome GO:1901679 nucleotide transmembrane transport --> GO:0055085 transmembrane transport MGI:2179723 Casc3 GO:0051028 mRNA transport --> GO:0006810 transport GO:0031965 nuclear membrane --> GO:0005635 nuclear envelope GO:0030529 intracellular ribonucleoprotein complex --> GO:0005622 intracellular GO:0000184 nuclear-transcribed mRNA catabolic process, nonsense-mediated decay --> GO:0034655 nucleobase-containing compound catabolic process GO:0031625 ubiquitin protein ligase binding --> GO:0019899 enzyme binding GO:0006810 transport --> GO:0006810 transport GO:0019899 enzyme binding --> GO:0019899 enzyme binding GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0008298 intracellular mRNA localization --> GO:0008150 biological_process GO:0005634 nucleus --> GO:0005634 nucleus GO:0006417 regulation of translation --> GO:0008150 biological_process GO:0006397 mRNA processing --> GO:0006397 mRNA processing GO:0042802 identical protein binding --> GO:0003674 molecular_function GO:0035145 exon-exon junction complex --> GO:0043234 protein complex --> GO:0005634 nucleus GO:0003723 RNA binding --> GO:0003723 RNA binding GO:0008380 RNA splicing --> GO:0034641 cellular nitrogen compound metabolic process GO:0005515 protein binding --> GO:0003674 molecular_function MGI:2686534 A630073D07Rik GO:0003674 molecular_function --> GO:0003674 molecular_function GO:0005575 cellular_component --> GO:0005575 cellular_component GO:0008150 biological_process --> GO:0008150 biological_process MGI:1918361 Gpr39 GO:0030641 regulation of cellular pH --> GO:0042592 homeostatic process GO:0008343 adult feeding behavior --> GO:0008150 biological_process GO:0042632 cholesterol homeostasis --> GO:0042592 homeostatic process GO:0016020 membrane --> GO:0005575 cellular_component GO:0000187 activation of MAPK activity --> GO:0008150 biological_process GO:0051281 positive regulation of release of sequestered calcium ion into cytosol --> GO:0042592 homeostatic process GO:0005575 cellular_component --> GO:0005575 cellular_component GO:0007186 G-protein coupled receptor signaling pathway --> GO:0007165 signal transduction GO:0042391 regulation of membrane potential --> GO:0008150 biological_process GO:0016021 integral component of membrane --> GO:0005575 cellular_component GO:0019216 regulation of lipid metabolic process --> GO:0008150 biological_process GO:0004871 signal transducer activity --> GO:0004871 signal transducer activity GO:0007165 signal transduction --> GO:0007165 signal transduction GO:0004930 G-protein coupled receptor activity --> GO:0004871 signal transducer activity GO:0060455 negative regulation of gastric acid secretion --> GO:0008150 biological_process GO:0071294 cellular response to zinc ion --> GO:0008150 biological_process GO:0035774 positive regulation of insulin secretion involved in cellular response to glucose stimulus --> GO:0008150 biological_process GO:0035483 gastric emptying --> GO:0008150 biological_process GO:0042593 glucose homeostasis --> GO:0042592 homeostatic process GO:0005886 plasma membrane --> GO:0005886 plasma membrane GO:0032024 positive regulation of insulin secretion --> GO:0008150 biological_process GO:0002024 diet induced thermogenesis --> GO:0008150 biological_process GO:0046872 metal ion binding --> GO:0043167 ion binding MGI:2449771 Cyp2r1 GO:0004497 monooxygenase activity --> GO:0016491 oxidoreductase activity GO:0016705 oxidoreductase activity, acting on paired donors, with incorporation or reduction of molecular oxygen --> GO:0016491 oxidoreductase activity GO:0016491 oxidoreductase activity --> GO:0016491 oxidoreductase activity GO:0020037 heme binding --> GO:0003674 molecular_function GO:0043231 intracellular membrane-bounded organelle --> GO:0043226 organelle --> GO:0005622 intracellular GO:0005506 iron ion binding --> GO:0043167 ion binding GO:0030343 vitamin D3 25-hydroxylase activity --> GO:0044281 small molecule metabolic process --> GO:0009058 biosynthetic process --> GO:0016491 oxidoreductase activity --> GO:0006629 lipid metabolic process GO:0042359 vitamin D metabolic process --> GO:0044281 small molecule metabolic process --> GO:0006629 lipid metabolic process GO:0008395 steroid hydroxylase activity --> GO:0016491 oxidoreductase activity GO:0005783 endoplasmic reticulum --> GO:0005783 endoplasmic reticulum GO:0055114 oxidation-reduction process --> GO:0008150 biological_process GO:0016020 membrane --> GO:0005575 cellular_component GO:0046872 metal ion binding --> GO:0043167 ion binding MGI:1202388 Gas7 GO:0030182 neuron differentiation --> GO:0048856 anatomical structure development --> GO:0030154 cell differentiation GO:0008360 regulation of cell shape --> GO:0008150 biological_process GO:0030154 cell differentiation --> GO:0030154 cell differentiation GO:0005737 cytoplasm --> GO:0005737 cytoplasm GO:0051017 actin filament bundle assembly --> GO:0022607 cellular component assembly --> GO:0007010 cytoskeleton organization GO:0048812 neuron projection morphogenesis --> GO:0030154 cell differentiation --> GO:0000902 cell morphogenesis GO:0001726 ruffle --> GO:0005623 cell GO:0007275 multicellular organism development --> GO:0048856 anatomical structure development GO:0030041 actin filament polymerization --> GO:0006461 protein complex assembly --> GO:0007010 cytoskeleton organization GO:0005884 actin filament --> GO:0005856 cytoskeleton GO:0007399 nervous system development --> GO:0048856 anatomical structure development GO:0051015 actin filament binding --> GO:0008092 cytoskeletal protein binding
t='GO:0006681'
m[t]
['GO:0006629', 'GO:0034641']
subont=ont.subontology(relations=relations)
subont.ancestors('GO:0034641')
{'GO:0006807', 'GO:0008150', 'GO:0008152', 'GO:0009987', 'GO:0044237'}
subont.filter_redundant(m[t])
{'GO:0006629', 'GO:0034641'}