{ "info": { "author": "Deng Hongyong", "author_email": "dephew@126.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Medical Science Apps." ], "description": "PythonMeta\n---\nInfo\n---\nName = PythonMeta\n\nVersion = 1.11 \n\nAuthor = Deng Hongyong (dhy)\n\nEmail = dephew@126.com\n\nURL = www.pymeta.com\n\nDate = 2019.7.23 (First developed in 2017)\n\nAbout\n---\nThis is a Meta-Analysis package. \n\nThis module was designed to perform some Evidence-based medicine (EBM) tasks, such as:\n\n* Combining effect measures (OR, RR, RD for count data and MD, SMD for continuous data);\n* Heterogeneity test(Q/Chi-square test);\n* Subgroup analysis;\n* Plots drawing: forest plot, funnel plot, etc.\n\nStatistical algorithms in this software cited from:\n**Jonathan J Deeks and Julian PT Higgins, on behalf of the Statistical Methods Group of The Cochrane Collaboration. Statistical algorithms in Review Manager 5, August 2010.**\n\nPlease cite me in any publictions like:\n**Deng Hongyong. PyMeta, Python module of Meta-analysis, cited 20xx-xx-xx (or your time); 1 screen(s). Available from URL: http://www.pymeta.com**\n\nThis is an ongoing project, so, any questions and suggestions from you are very welcome.\n\nInstalling\n---\nInstall and update using `pip`:\n```\npip install PythonMeta\n```\n\nImport\n---\nImport the PythonMeta module in your code:\n```\nimport PythonMeta\n```\n\nFunctions and Classes\n---\nThere are four functions/classes in PythonMeta package:\n\n**Help()**(function): Show help information of PythonMeta.\n\n**Data()**(class): Set and Load data to analysis.\n* datatype (attribute, string): set the data type:'CATE' for CATEgorical/count/binary/dichotomous data, or 'CONT' for continuous data.\n* studies (attribute, array): Array to store the study data.\n* subgroup (attribute, array): Array to store the subgroup.\n* nototal (attribute, binary): Flag of do NOT calculate the total effect.\n* readfile(filename) (method): Read data file. Input: filename(string) (e.g. \"c:\\\\1.txt\"); Output: lines array (always as input of method getdata()). (See Sample code and data files)\n* getdata(lines) (method): Load data into attribute array of 'studies'. Input: lines array (always from method readfile()); Output: attribute 'studies'. (See Sample code and data files)\n\n**Meta()**(class): Set and perform the Meta-Analysis.\n* datatype (attribute, string): set the data type:'CATE' for CATEgorical/count/binary/dichotomous data, or 'CONT' for continuous data. Attention: this attribute should same to Data().datatype.\n* studies (attribute, array): Array of study data to meta-analysis.\n* subgroup (attribute, array): Array to store the subgroup. Attention: this attribute should same to Data().subgroup.\n* nototal (attribute, binary): Flag of do NOT calculate the total effect. Attention: this attribute should same to Data().nototal.\n* models (attribute, string): set effect models as 'Fixed' or 'Random'.\n* effect (attribute, string): set effect size as 'OR':odds ratio; 'RR': risk ratio; 'RD':risk difference; 'MD':weighted mean diff; 'SMD':standard mean diff.\n* algorithm (attribute, string): set the algorithms of meta-analysis: 'MH':Mantel-Haenszel;'Peto';'IV':Inverse variance;'IV-Heg'(DEFAULT),'IV-Cnd','IV-Gls':for SMD algorithms\n* meta(studies, nosubgrp=False) (method): perform the meta-analysis. Input: 1, studies array (always from Data().getdata); 2, nosubgrp flag, False as default. Output: result array [[Total...],[study1...],[subgroup1,...],[studyn,...]...[subgroupk,...]]. (See Sample code for more information)\n\n**Fig()**(class): Set and draw the result figures.\n* size (attribute, integer): set the canvas size in inchs, default [6,6].\n* dpi (attribute, integer): set the resolution of figure (dot per inch), default 80pts.\n* title (attribute, string): set the title of figure.\n* nototal (attribute, binary): Flag of do NOT show the total effect, default False.\n* forest(results) (method): drawing the forest plot. Input: results array, always from Meta().meta (See Sample code for more information).\n* funnel(results) (method): drawing the funnel plot. Input: results array, always from Meta().meta (See Sample code for more information).\n\nExample\n---\n\nSample code: **sample.py**\n```Python\n\nimport PythonMeta as PMA\n\ndef showstudies(studies,dtype): \n #show continuous data\n if dtype.upper()==\"CONT\":\n text = \"%-10s %-30s %-30s \\n\"%(\"Study ID\",\"Experiment Group\",\"Control Group\")\n text += \"%-10s %-10s %-10s %-10s %-10s %-10s %-10s \\n\"%(\" \",\"m1\",\"sd1\",\"n1\",\"m2\",\"sd2\",\"n2\")\n for i in range(len(studies)):\n text += \"%-10s %-10s %-10s %-10s %-10s %-10s %-10s \\n\"%(\n studies[i][6], #study ID\n str(studies[i][0]), #mean of group1\n str(studies[i][1]), #SD of group1\n str(studies[i][2]), #total num of group1\n str(studies[i][3]), #mean of group2\n str(studies[i][4]), #SD of group2\n str(studies[i][5]) #total num of group2\n )\n return text\n\n #show dichotomous data\n text = \"%-10s %-20s %-20s \\n\"%(\"Study ID\",\"Experiment Group\",\"Control Group\")\n text += \"%-10s %-10s %-10s %-10s %-10s \\n\"%(\" \",\"e1\",\"n1\",\"e2\",\"n2\")\n for i in range(len(studies)):\n text += \"%-10s %-10s %-10s %-10s %-10s \\n\"%(\n studies[i][4], #study ID\n str(studies[i][0]), #event num of group1\n str(studies[i][1]), #total num of group1\n str(studies[i][2]), #event num of group2\n str(studies[i][3]) #total num of group2\n )\n return text\n\ndef showresults(rults):\n text = \"%-10s %-6s %-18s %-10s\"%(\"Study ID\",\"n\",\"ES[95% CI]\",\"Weight(%)\\n\") \n for i in range(1,len(rults)):\n text += \"%-10s %-6d %-4.2f[%.2f %.2f] %6.2f\\n\"%( # for each study\n rults[i][0], #study ID\n rults[i][5], #total num\n rults[i][1], #effect size\n rults[i][3], #lower of CI\n rults[i][4], #higher of CI\n 100*(rults[i][2]/rults[0][2]) #weight\n )\n text += \"%-10s %-6d %-4.2f[%.2f %.2f] %6d\\n\"%( # for total effect\n rults[0][0], #total effect size name\n rults[0][5], #total N (all studies)\n rults[0][1], #total effect size\n rults[0][3], #total lower CI\n rults[0][4], #total higher CI\n 100\n ) \n text += \"%d studies included (N=%d)\\n\"%(len(rults)-1,rults[0][5])\n text += \"Heterogeneity: Tau\\u00b2=%.3f \"%(rults[0][12]) if not rults[0][12]==None else \"Heterogeneity: \"\n text += \"Q(Chisquare)=%.2f(p=%s); I\\u00b2=%s\\n\"%(\n rults[0][7], #Q test value\n rults[0][8], #p value for Q test\n str(round(rults[0][9],2))+\"%\") #I-square value\n text += \"Overall effect test: z=%.2f, p=%s\\n\"%(rults[0][10],rults[0][11]) #z-test value and p-value\n\n return text\n\ndef main(stys,settings):\n d = PMA.Data() #Load Data class\n m = PMA.Meta() #Load Meta class\n f = PMA.Fig() #Load Fig class\n\n #You should always tell the datatype first!!!\n d.datatype = settings[\"datatype\"] #set data type, 'CATE' for binary data or 'CONT' for continuous data\n studies = d.getdata(stys) #load data\n #studies = d.getdata(d.readfile(\"studies.txt\")) #get data from a data file, see examples of data files\n print(showstudies(studies,d.datatype)) #show studies\n\n m.datatype=d.datatype #set data type for meta-analysis calculating\n m.models = settings[\"models\"] #set effect models: 'Fixed' or 'Random'\n m.algorithm = settings[\"algorithm\"] #set algorithm, based on datatype and effect size\n m.effect = settings[\"effect\"] #set effect size:RR/OR/RD for binary data; SMD/MD for continuous data\n results = m.meta(studies) #performing the analysis\n print(m.models + \" \" + m.algorithm + \" \" + m.effect)\n print (showresults(results)) #show results table\n f.forest(results).show() #show forest plot\n f.funnel(results).show() #show funnel plot\n\nif __name__ == '__main__':\n samp_cate=[ #this array can be stored into a data file by lines, and loaded with d.readfile(\"filename\")\n \"Fang 2015,15,40,24,37\",\n \"Gong 2012,10,40,18,35\",\n \"Liu 2015,30,50,40,50\",\n \"Long 2012,19,40,26,40\",\n \"Wang 2003,7,86,15,86\",\n \"name=short term\",\n \"Chen 2008,20,60,28,60\",\n \"Guo 2014,31,51,41,51\",\n \"Li 2015,29,61,31,60\",\n \"Yang 2006,21,40,31,40\",\n \"Zhao 2012,27,40,30,40\",\n \"name=medium term\",\n \"#\",\n \" \",\n \"#This is a sample of binary data with subgroup.\",\n \"#Syntax: study name, e1, n1, e2, n2\",\n \"#e1,n1: events and number of experiment group;\",\n \"#e2,n2: events and number of control group.\",\n \"#And you can add a line of to hide the Overall result.\"]\n\n samp_cont=[ #this array can be stored into a data file by lines, and loaded with d.readfile(\"filename\")\n \"Atmaca 2005, 20.9, 6.0, 15, 27.4, 8.5, 14\",\n \"Guo 2014, 12.8, 5.2, 51, 11.9, 5.3, 51\",\n \"Liu 2010, 23.38, 5.86, 35, 24.32, 5.43, 35\",\n \"Wang 2012, 15.67, 8.78, 43, 18.67, 9.87, 43\",\n \"Xu 2002, 15.49, 7.16, 50, 21.72, 8.07, 50\",\n \"Zhao 2012, 12.8, 5.7, 40, 13.0, 5.2, 40\",\n \" \",\n \"#This is a sample of continuous data.\",\n \"#Input one study in a line;\",\n \"#Syntax: study name, m1, sd1, n1, m2, sd2, n2\",\n \"#m1, sd1, n1: mean, SD and number of experiment group;\",\n \"#m2, sd2, n2: mean, SD and number of control group.\"]\n\n #sample 1: dichotomous data\n settings={\"datatype\":\"CATE\", #for CATEgorical/count/binary/dichotomous data\n \"models\":\"Fixed\", #models: Fixed or Random\n \"algorithm\":\"MH\", #algorithm: MH, Peto or IV\n \"effect\":\"RR\"} #effect size: RR, OR, RD\n main(samp_cate,settings)\n\n #sample 2: continuous data\n settings={\"datatype\":\"CONT\", #for CONTinuous data\n \"models\":\"Fixed\", #models: Fixed or Random\n \"algorithm\":\"IV\", #algorithm: IV\n \"effect\":\"MD\"} #effect size: MD, SMD\n main(samp_cont,settings)\n```\n\nOr you can load data from a file, like:\n```\nstudies = d.getdata(d.readfile(\"studies.txt\")\n```\n\nHere are some examples of data file:\n(Please remember all lines start with # are comment lines, which will be ignored while loading.)\n\n**Sample of continuous data**\n```\nAtmaca 2005, 20.9, 6.0, 15, 27.4, 8.5, 14\nGuo 2014, 12.8, 5.2, 51, 11.9, 5.3, 51\nLiu 2010, 23.38, 5.86, 35, 24.32, 5.43, 35\nWang 2012, 15.67, 8.78, 43, 18.67, 9.87, 43\nXu 2002, 15.49, 7.16, 50, 21.72, 8.07, 50\nZhao 2012, 12.8, 5.7, 40, 13.0, 5.2, 40\n\n#This is a sample of continuous data.\n#Input one study in a line;\n#Syntax: study name, m1, sd1, n1, m2, sd2, n2\n#m1, sd1, n1: mean, SD and number of experiment group;\n#m2, sd2, n2: mean, SD and number of control group.\n```\n\n**Sample of dichotomous data**\n```\nFang 2015, 15, 40, 24, 37 \nGong 2012, 10, 40, 18, 35 \nLiu 2015, 30, 50, 40, 50 \nLong 2012, 19, 40, 26, 40 \nPan 2015a, 57, 100, 68, 100 \nWang 2001, 13, 18, 17, 18 \nWang 2003, 7, 86, 15, 86\n\n#This is a sample of binary data.\n#Input one study in a line;\n#Syntax: study name, e1, n1, e2, n2\n#e1,n1: events and number of experiment group;\n#e2,n2: events and number of control group.\n```\n\n**Sample of data with subgroup**\n```\nFang 2015,15,40,24,37\nGong 2012,10,40,18,35\nLiu 2015,30,50,40,50\nLong 2012,19,40,26,40\nWang 2003,7,86,15,86\nname=short term\nChen 2008,20,60,28,60\nGuo 2014,31,51,41,51\nLi 2015,29,61,31,60\nYang 2006,21,40,31,40\nZhao 2012,27,40,30,40\nname=medium term\n#\n\n#This is a sample of subgroup.\n#Cumulative meta-analysis and Senstivity analysis will blind to all tags.\n#And you can add a line of to hide the Overall result.\n```\n\nContact\n---\n\nDeng Hongyong Ph.D\n\nShanghai University of Traditional Chinese Medicine\n\nShanghai, China 201203\n\nEmail: dephew@126.com\n\nWeb: www.PyMeta.com\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.pymeta.com", "keywords": "meta analysis,meta-analysis,meta_analysis,systematic review,EBM,Evidence-based Medicine", "license": "", "maintainer": "", "maintainer_email": "", "name": "PythonMeta", "package_url": "https://pypi.org/project/PythonMeta/", "platform": "", "project_url": "https://pypi.org/project/PythonMeta/", "project_urls": { "Homepage": "http://www.pymeta.com" }, "release_url": "https://pypi.org/project/PythonMeta/1.11/", "requires_dist": [ "matplotlib" ], "requires_python": ">=3.5", "summary": "A Python module of Meta-Analysis, usually applied in systemtic reviews of Evidence-based Medicine.", "version": "1.11" }, "last_serial": 5571619, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "192e0a018adb9e4083080f2d42e4080e", "sha256": "bc5173c64b61d25874021aac0920b7eda2854e660b1ca180920d1c564f220403" }, "downloads": -1, "filename": "PythonMeta-0.9.tar.gz", "has_sig": false, "md5_digest": "192e0a018adb9e4083080f2d42e4080e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 90653, "upload_time": "2019-06-28T06:55:41", "url": "https://files.pythonhosted.org/packages/55/ce/1db2db5b9203af0ceabcf8e3bfb0b3ab45e564ed19e590f961edb8e9bbcf/PythonMeta-0.9.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "32e644b3ceba69def2eb97fd87223ca2", "sha256": "5c9567b1a9f514cec6253bd07407a1dbe3858a4df232d96d0b56f95f88fb49f1" }, "downloads": -1, "filename": "PythonMeta-1.0.tar.gz", "has_sig": false, "md5_digest": "32e644b3ceba69def2eb97fd87223ca2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 89194, "upload_time": "2019-07-14T10:01:41", "url": "https://files.pythonhosted.org/packages/3a/1a/935af51469faa895457661a0866b82865fe2b98a89c30e8406c348c26ef5/PythonMeta-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "f24dfa2f8c474c62cfec6e3e56905d60", "sha256": "14469fb67a9aff86428d692133a568d16ac818c253b736bae15b66cb01361d22" }, "downloads": -1, "filename": "PythonMeta-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f24dfa2f8c474c62cfec6e3e56905d60", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 86993, "upload_time": "2019-07-21T14:00:47", "url": "https://files.pythonhosted.org/packages/84/0b/54bd55b6654428ca9a166538536813a18449afc00c3cf388a7fb2aec4cce/PythonMeta-1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9dab09564747f27a2b420c75dccdadaa", "sha256": "082f7d34fd803a129cd86f70f3ef9a7ac0d142459c67b4238c01995d27845f7a" }, "downloads": -1, "filename": "PythonMeta-1.1.tar.gz", "has_sig": false, "md5_digest": "9dab09564747f27a2b420c75dccdadaa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 89046, "upload_time": "2019-07-21T14:00:48", "url": "https://files.pythonhosted.org/packages/61/17/0cadb8ccee5f302530b68d87408b6bb9e66c7b0a5ce32c8de12cb36aabd1/PythonMeta-1.1.tar.gz" } ], "1.11": [ { "comment_text": "", "digests": { "md5": "c87ec86e0bacc61b85e95f7cf5b869a6", "sha256": "85c035b67082193a24b5e97ed1be6c8bc9c18d811feee73e5dcdbaf67b721cde" }, "downloads": -1, "filename": "PythonMeta-1.11-py3-none-any.whl", "has_sig": false, "md5_digest": "c87ec86e0bacc61b85e95f7cf5b869a6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 88885, "upload_time": "2019-07-23T10:03:50", "url": "https://files.pythonhosted.org/packages/77/c4/fc86e4e586a9e60b904e4f5be6d9342f44fa05a3ec0e14cc6d8a097ec1d6/PythonMeta-1.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8f08a0c96a65de56f4c98ccfbcbd349f", "sha256": "2f7203508a9e2e1959c631151dca0ba5429438b76d507b8df5403d7ba134457b" }, "downloads": -1, "filename": "PythonMeta-1.11.tar.gz", "has_sig": false, "md5_digest": "8f08a0c96a65de56f4c98ccfbcbd349f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 93444, "upload_time": "2019-07-23T10:03:52", "url": "https://files.pythonhosted.org/packages/3f/68/3bfb0dbeb539416d8abfc94d4142e651e9702ba86f032e540e75acddbdbf/PythonMeta-1.11.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c87ec86e0bacc61b85e95f7cf5b869a6", "sha256": "85c035b67082193a24b5e97ed1be6c8bc9c18d811feee73e5dcdbaf67b721cde" }, "downloads": -1, "filename": "PythonMeta-1.11-py3-none-any.whl", "has_sig": false, "md5_digest": "c87ec86e0bacc61b85e95f7cf5b869a6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 88885, "upload_time": "2019-07-23T10:03:50", "url": "https://files.pythonhosted.org/packages/77/c4/fc86e4e586a9e60b904e4f5be6d9342f44fa05a3ec0e14cc6d8a097ec1d6/PythonMeta-1.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8f08a0c96a65de56f4c98ccfbcbd349f", "sha256": "2f7203508a9e2e1959c631151dca0ba5429438b76d507b8df5403d7ba134457b" }, "downloads": -1, "filename": "PythonMeta-1.11.tar.gz", "has_sig": false, "md5_digest": "8f08a0c96a65de56f4c98ccfbcbd349f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 93444, "upload_time": "2019-07-23T10:03:52", "url": "https://files.pythonhosted.org/packages/3f/68/3bfb0dbeb539416d8abfc94d4142e651e9702ba86f032e540e75acddbdbf/PythonMeta-1.11.tar.gz" } ] }