{"id":15628992,"url":"https://github.com/pwwang/enrichr","last_synced_at":"2025-04-29T09:57:06.744Z","repository":{"id":76855174,"uuid":"132231525","full_name":"pwwang/enrichr","owner":"pwwang","description":"A python wrapper for Enrichr APIs","archived":false,"fork":false,"pushed_at":"2020-03-18T21:31:17.000Z","size":480,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T09:57:02.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pwwang.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}},"created_at":"2018-05-05T09:01:54.000Z","updated_at":"2021-09-09T22:12:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"69ac0c21-ecca-49d5-a738-d7bc5ff27551","html_url":"https://github.com/pwwang/enrichr","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/pwwang%2Fenrichr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fenrichr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fenrichr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fenrichr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwwang","download_url":"https://codeload.github.com/pwwang/enrichr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251480070,"owners_count":21596016,"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":[],"created_at":"2024-10-03T10:25:15.532Z","updated_at":"2025-04-29T09:57:06.724Z","avatar_url":"https://github.com/pwwang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# enrichr: A python wrapper for Enrichr APIs\n[Enrichr][1] is a web tool for gene set enrichment analysis.\n\n## Features\n- Compatible with both python2 and python3\n- Able to export part of the enrichment results\n- Able to plot the enrichment results\n\n## Installation\n```shell\n\u003e pip install git+https://github.com/pwwang/enrichr.git\n\u003e # will install requests, matplotlib\n\u003e # to run tests, you have to install testly\n\u003e # pip install git+https://github.com/pwwang/testly.git\n\u003e python test.py\n```\n\n## Usage\n### Initiate an `enrichr` instance\n```python\n\u003e\u003e\u003e from enrichr import Enrichr\n\u003e\u003e\u003e en = Enrichr(library = 'KEGG_2016')\n\u003e\u003e\u003e # use a different library:\n\u003e\u003e\u003e # en = Enrichr('ChEA_2016')\n\u003e\u003e\u003e # Add different cutoff\n\u003e\u003e\u003e en = Enrichr(cutoff = 0.01, top = 10)\n\u003e\u003e\u003e # Use adjusted p-value 0.01 \n\u003e\u003e\u003e # whichever comes first, records with adjusted p-value or top\n```\n\n### Add a gene list\n```python\n\u003e\u003e\u003e en.addList(['PHF14', 'RBM3', 'MSL1', ...])\n\u003e\u003e\u003e # set a description and show the userListId:\n\u003e\u003e\u003e # r = en.addList([...], description = 'Some description')\n\u003e\u003e\u003e # print r.userListId\n\u003e\u003e\u003e # 7260214\n```\n\n### Add a gene list from a file\n```shell\n\u003e head genes.txt\n#ID,Gene\n1,PHF14\n2,RBM3\n3,MSL1\n```\n```python\n\u003e\u003e\u003e en.addListFromFile('genes.txt', col = 1, delimit = ',', skip = 1)\n```\n\n### View added gene list\n```python\n\u003e\u003e\u003e v = en.view()\n\u003e\u003e\u003e # if you have a different listid:\n\u003e\u003e\u003e # v = en.view(listid = 1234567)\n\u003e\u003e\u003e print v # namedtuple\nEnrichr_Genelist(genes=[u'PHF14', u'RBM3', u'MSL1', ...], description=u'Enrichr gene list.')\n\u003e\u003e\u003e print v.genes, v.description\n[u'PHF14', u'RBM3', u'MSL1', ...], 'Enrichr gene list.'\n```\n\n### Do the enrichment\n```python\n\u003e\u003e\u003e results = en.enrich(cutoff = .25)\n\u003e\u003e\u003e # perform enrichment on a different library and a different gene list:\n\u003e\u003e\u003e # results = en.enrich(library = 'ChEA_2016', listid = 123456)\n\u003e\u003e\u003e print results # a list of namedtuple\n[Enrichr_Term(\n\tTerm          = 'Longevity regulating pathway - multiple species_hsa04213',\n\tOverlap       = '2/64',\n\tPval          = 0.00560341272708137,\n\tAdjPval       = 0.2241365090832548,\n\tOldPval       = 0.0023516996733944644,\n\tOldAdjPval    = 0.09406798693577857,\n\tZ             = -2.017962732978835,\n\tCombinedScore = 10.461884526362898,\n\tGenes         = 'HSPA1L;INSR'), Enrichr_Term(...), ...]\n```\n\n### Export the results\n```python\n\u003e\u003e\u003e en.enrich()\n\u003e\u003e\u003e en.export('results.txt')\n\u003e\u003e\u003e # only export top 3 terms:\n\u003e\u003e\u003e # en.export('results.txt', top = 3)\n```\n```shell\n\u003e cat results.txt\nTerm\tOverlap\tPval\tAdjPval\tOldPval\tOldAdjPval\tZ\tCombinedScore\tGenes\nLongevity regulating pathway - multiple species_hsa04213\t2/64\t5.60E-03\t2.24E-01\t2.35E-03\t9.41E-02\t-2.018\t10.462\tHSPA1L;INSR\nHIF-1 signaling pathway_hsa04066\t2/103\t1.40E-02\t2.80E-01\t5.85E-03\t1.17E-01\t-1.816\t7.755\tINSR;CUL2\nPhospholipase D signaling pathway_hsa04072\t2/144\t2.62E-02\t3.39E-01\t1.11E-02\t1.48E-01\t-1.846\t6.720\tCYTH2;INSR\nMAPK signaling pathway_hsa04010\t2/255\t7.32E-02\t3.39E-01\t3.23E-02\t2.34E-01\t-1.896\t4.957\tPPM1B;HSPA1L\n...\n```\n\n### Plot the results\n```python\n\u003e\u003e\u003e en.enrich()\n\u003e\u003e\u003e en.plot('results.png')\n\u003e\u003e\u003e # set a different title and different number of terms to plot:\n\u003e\u003e\u003e # en.plot('results.png', title = 'Gene enrichment: {library}', top = 20)\n```\n![results.png][2]\n\n### Find terms that contain a given gene\n```python\n\u003e\u003e\u003e libs = en.genemap('AKT1') # it's a generator\n\u003e\u003e\u003e print libs\n\u003cgenerator object genemap at 0x2b127b472730\u003e\n\u003e\u003e\u003e lib = next(libs)\n\u003e\u003e\u003e print lib # namedtuple\nEnrichr_Library(name='ChEA_2016', category='Transcription', hasGrid=True, isFuzzy=True, format='{1} binds to the promoter region of {0}.', description='', terms=['EGR1_19374776_ChIP-ChIP_THP-1_Human', 'CLOCK_20551151_ChIP-Seq_293T_Human', ...])\n```\n\n[1]: http://amp.pharm.mssm.edu/Enrichr/\n[2]: ./results.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwwang%2Fenrichr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwwang%2Fenrichr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwwang%2Fenrichr/lists"}