{"id":15662414,"url":"https://github.com/mojaie/pygosemsim","last_synced_at":"2025-05-05T23:28:00.456Z","repository":{"id":90696411,"uuid":"149289861","full_name":"mojaie/pygosemsim","owner":"mojaie","description":"Gene ontology (GO) semantic similarity library for Python","archived":false,"fork":false,"pushed_at":"2018-09-28T14:43:51.000Z","size":31,"stargazers_count":22,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T00:41:24.398Z","etag":null,"topics":["bioinformatics","gene-ontology","semantic-similarity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mojaie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-18T13:07:39.000Z","updated_at":"2025-03-27T03:58:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f68d52b-01c7-445d-af44-f94e54f3bb32","html_url":"https://github.com/mojaie/pygosemsim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojaie%2Fpygosemsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojaie%2Fpygosemsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojaie%2Fpygosemsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojaie%2Fpygosemsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojaie","download_url":"https://codeload.github.com/mojaie/pygosemsim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252592290,"owners_count":21773238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","gene-ontology","semantic-similarity"],"created_at":"2024-10-03T13:32:30.527Z","updated_at":"2025-05-05T23:28:00.450Z","avatar_url":"https://github.com/mojaie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\npygosemsim\n===================================================\n\n**pygosemsim** is a GO (Gene Ontology) semantic similarity calculation library for Python.\n\n\n\nGetting started\n------------------\n\n\n### Install\n\n\n### Download GO datasets and build GO graph\n\n```pycon\n\u003e\u003e\u003e from pygosemsim import download\n\n\u003e\u003e\u003e # Download from http://purl.obolibrary.org/\n\u003e\u003e\u003e download.obo(\"go-basic\")\nDownload started: http://purl.obolibrary.org/obo/go/go-basic.obo\nDownloaded 32.2MB of 32.2MB (100.0 %)\nDownload finished: go-basic.obo (32.2) MB\n\n\u003e\u003e\u003e # Or manually\n\u003e\u003e\u003e download.download(\"goslim_chembl.obo\",\n\u003e\u003e\u003e     \"http://www.geneontology.org/ontology/subsets/goslim_chembl.obo\")\nDownload started: http://www.geneontology.org/ontology/subsets/goslim_chembl.obo\nDownloaded 0.5MB of 0.5MB (100.0 %)\nDownload finished: goslim_chembl.obo (0.5) MB\n\n\u003e\u003e\u003e from pygosemsim import graph\n\u003e\u003e\u003e import networkx as nx\n\u003e\u003e\u003e G = graph.from_resource(\"go-basic\")\nformat-version: 1.2\n\n\u003e\u003e\u003e G_chembl = graph.from_resource(\"goslim_chembl\")\nformat-version: 1.2\n\n\u003e\u003e\u003e nx.ancestors(G, \"GO:0004396\")\n{'GO:0003674', 'GO:0003824', 'GO:0016301', 'GO:0016740', 'GO:0016772', 'GO:0016773', 'GO:0019200'}\n\n\u003e\u003e\u003e nx.descendants(G, \"GO:0004396\")\n{'GO:0004340', 'GO:0008865', 'GO:0019158'}\n```\n\n\n### GO term semantic similarity\n\n```pycon\n\u003e\u003e\u003e from pygosemsim import similarity\n\u003e\u003e\u003e graph.precalc_lower_bounds(G)\n\n\u003e\u003e\u003e similarity.resnik(G, \"GO:0004340\", \"GO:0019158\")\n13.459\n\n\u003e\u003e\u003e similarity.wang(G, \"GO:0004340\", \"GO:0019158\")\n0.804\n```\n\n\n### Download and parse gene annotation file\n\n```pycon\n\u003e\u003e\u003e download.gaf(\"goa_human\")\nDownload started: http://geneontology.org/gene-associations/goa_human.gaf.gz\nDownloaded 7.9MB of 7.9MB (100.0 %)\nDownload finished: goa_human.gaf.gz (7.9) MB\n\n\u003e\u003e\u003e from pygosemsim import annotation\n\u003e\u003e\u003e annot = annotation.from_resource(\"goa_human\")\ngaf-version: 2.1\n\n\u003e\u003e\u003e len(annot)  # Number of genes annotated\n19712\n\n\u003e\u003e\u003e annot[\"Q8NER1\"]\n{\n  'db_object_id': 'Q8NER1',\n  'db_object_name': 'Transient receptor potential cation channel subfamily V member 1',\n  'db_object_symbol': 'TRPV1',\n  'db_object_type': 'protein'\n  'annotation': {\n    'GO:0000122': {\n      'evidence_code': 'IEA',\n      'go_id': 'GO:0000122',\n      'qualifier': ['']\n    },\n    'GO:0001660': {\n      'evidence_code': 'IEA',\n      'go_id': 'GO:0001660',\n      'qualifier': ['']\n    },\n    ...\n  }\n}\n```\n\n\n### Gene similarity\n\n```pycon\n\u003e\u003e\u003e import functools\n\u003e\u003e\u003e from pygosemsim import term_set\n\u003e\u003e\u003e trpv1 = annot[\"Q8NER1\"][\"annotation\"].keys()\n\u003e\u003e\u003e trpa1 = annot[\"O75762\"][\"annotation\"].keys()\n\u003e\u003e\u003e sf = functools.partial(term_set.sim_func, self.G, similarity.lin)\n\u003e\u003e\u003e term_set.sim_bma(trpv1, trpa1, sf)\n0.667\n```\n\n\nFeatures\n----------\n\n- File parsers (.obo, .gaf)\n- Semantic similarity\n  - node-based\n    - Resnik et al.\n    - Lin et al.\n  - edge-based\n    - Pekar et al.\n  - Wang et al.\n- Semantic similarity between two term sets\n  - max\n  - avg\n  - Best-Match Average (BMA)\n\n\nAPI Documentation\n------------------------\n\nhttps://pygosemsim.readthedocs.io/\n\n\n\nLicense\n-------------\n\n[MIT license](http://opensource.org/licenses/MIT)\n\n\n\nCopyright\n--------------\n\n(C) 2018 Seiji Matsuoka\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojaie%2Fpygosemsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojaie%2Fpygosemsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojaie%2Fpygosemsim/lists"}