{
"info": {
"author": "Mark Teese",
"author_email": "mark.teese@SeeImageBelowOrMyTUMwebsite.de",
"bugtrack_url": null,
"classifiers": [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Bio-Informatics"
],
"description": "# Weighslide \n\nWeighslide is a python program to calculate sliding windows across of a list of numerical values. \nThe user sets the window size, and the exact weighting of each value in the window. \n\n## What is it used for?\nWeighslide was developed for use in bioinformatics. Alpha-helices are common protein secondary structure, and have\na periodicity of 3.6 residues per turn. Weighslide allows numerical values to be weighted according to alpha-helical peridicity.\n\nNote that weighslide is not currently optimised for large datasets.\n\n## Citation: \nA publication will be added at a later date. For now, please cite as follows: \n\"A sliding window analysis was performed using the weighslide package in python (Mark Teese, Technical University of Munich).\"
\n\n## Keywords: \nsliding window, rolling window, weighted window, data normalisation, data normalization, 1D array, numerical list
\n\n\n# How it works \nWeighslide takes as an input a 1D array (list) of numerical data, and applies a user-defined weighting and algorithm in a sliding-window fashion across the data. \n\n``` \nFor example: \nwindow = [ 2 5 2 ] \nstatistic = \"mean\" \ndataset = [ 0 0 0 1 1 2 3 5 8 13 21] \nThe window length is 3. The array will therefore be sliced as follows: \n........[ NaN 0 0 ] \n.............[ 0 0 1 ] \n................[ 0 1 1 ] \n...................[ 1 1 2 ] and so on until the final slice [ 13 21 NaN ] \nEach array slice will be \"weighted\" by multiplication with the window, array-style, resulting in: \n........[ NaN 0 0 ] \n.............[ 0 0 2 ] \n................[ 0 5 2 ] \n...................[ 2 5 4 ] and so on. \nIf the \"statistic\" variable is given as \"mean\", a mean will be calculated for each array slice. \n..........[ 0 ] \n.............[ 0.66 ] \n................[ 2.33 ] \n...................[ 3.66 ] and so on. \nThe \"statistic\" can be mean, std, or sum. \nThe value (in this case the mean) will replace the central position in the output 1D array. \noutput = [ 0.00 0.00 0.66 2.33 3.66 6.00 9.66 15.6 25.3 41.0 65.5 ] \n``` \n\nThe first and last array slices always contain flanking \"not a number\" (Nan) values, which are ignored in all calculations. \nThe first and last output values therefore do not represent results from true, full-length windows. \n\n# Installation\n\n`pip install weighslide` \n\nWeighslide depends on the following: \n* python (tested for version 3.5) \n* numpy \n* pandas \n* matplotlib \n\nFor Windows users, we recommend Anaconda python 3.x. The Anaconda package should contain all required python packages. \n\nTo install as a python package from GitHub, download and unzip the latest release and run `python setup.py install` in the relevant package folder.\n\n# Test \nTo test the package, open the command console and navigate to the folder \ncontaining weighslide.py. Run the following: \n\n`python weighslide.py [1,1,\"x\",1,1] mean -r [1,1,2,3,5,8,13,21,34]` \n\nIf successful, an output list will be printed on the screen. \n\n# Usage \nHere is an example of how to run weighslide within python, using an excel input file. \n``` \nimport weighslide \ninfile = r\"D:\\Path\\To\\Your\\File\\infile_name.xlsx\" \n# for excel files, you will need to input the sheet name containing the data \nexcel_kwargs = {\"sheet_name\":\"Sheet1\"} \n# if it's an excel file with multiple columns, define which column contains the data \ncolumn = \"your data column header\" \n# define the window and statistic. The following parameters are used \n# if you want to calculate mean of the four surrounding values in the sequence \nwindow = [1,1,\"x\",1,1] \nstatistic = \"mean\" \nname = \"your short sample name\" \nweighslide.run_weighslide(infile, window, statistic, name=name, column=column, excel_kwargs=excel_kwargs) \n``` \n\nHere is an example of how to run weighslide from the command line, using a csv input file. \n``` \npython weighslide.py [1,1,'x',1,1] mean -i \"D:\\Path\\To\\Your\\File\\infile_name.xlsx\" -c \"your data column header\" \n``` \nIn both cases the output files will be created in a subfolder within the same location as the input file. \n\nFor more help regarding the command-line options: \n`python weighslide.py -h` \n\nHere is an example designed for jupyter notebook, showing the power of weighslide \nto smoothen a repeated element in a noisy dataset. \n``` \n# create a noisy wave that repeats every 6th position. Save to csv. \nimport weighslide \nimport numpy as np \nimport pandas as pd \nimport matplotlib.pyplot as plt \n% matplotlib inline \nplt.rcParams[\"savefig.dpi\"] = 120 \ndf = pd.DataFrame() \ndf['wave'] = [1,1,1,3,3,3]*8 \ndf[\"random\"] = np.random.random_sample(df.shape[0]) \ndf[\"noisy wave\"] = df.wave + df.random*5 \ndf.plot(title=\"input data: noisy wave\") \ndf.to_csv(\"wave.csv\") \n``` \n[Image of input](https://raw.githubusercontent.com/teese/weighslide/master/examples/input.png) \n``` \n# run weighslide with a window that averages every 6th position \nwindow = \"9xxxxx9xxxxx9xxxxx9xxxxx9xxxxx9xxxxx9\" \nweighslide.run_weighslide(\"wave.csv\", window, \"mean\", name=\"wavetest\", column=\"noisy wave\", overwrite=True) \n``` \n[Image of output](https://raw.githubusercontent.com/teese/weighslide/master/examples/output.png) \n\n\n**Examples of windows:** \n\n[1,1,1] \n* if \"statistic\" is set to \"mean\", this window returns the average of the central position, and the two neighbouring positions \n* the window size is 3 \n\n\n[1,1,\"x\",1,1] \n* the central position \"x\" has no weighting at all \n* the window size is 5, it consists of the central position, two upstream, and two downstream positions \n* the positions upstream (-1, -2) and downstream (1, 2) of the central position are all equally weighted \n* if the statistic is set to \"mean\", the result for each position will simply be the average of the surrounding 4 positions \n\n[0.5, 1, 0.5, 2, 0.5, 1, 0.5] \n* the central position \"2\" is highly weighted (2*orig value) \n* the window size is 7, it consists of the central position, three upstream, and three downstream positions \n* the positions upstream (-1, -2, -3) and downstream (1, 2, 3) of the central position are unequally weighted \n* if the statistic is set to \"mean\", the result for each position will simply be the average of the surrounding 4 positions \n\n# Contribute \nIf you encounter a bug or weighslide doesn't work for any reason, please send me an email (available in an image below, or at my TUM website) or initiate an issue in Github. \nPull requests are welcome. \n\n# License \nWeighslide is free software distributed under the GNU General Public License version 3.\n\n# Contact\n\n\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "https://github.com/teese/weighslide/archive/0.1.7.tar.gz",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/teese/weighslide",
"keywords": "sliding data normalisation normalization array",
"license": "LGPLv3",
"maintainer": "",
"maintainer_email": "",
"name": "weighslide",
"package_url": "https://pypi.org/project/weighslide/",
"platform": "",
"project_url": "https://pypi.org/project/weighslide/",
"project_urls": {
"Download": "https://github.com/teese/weighslide/archive/0.1.7.tar.gz",
"Homepage": "https://github.com/teese/weighslide",
"LangoschLab": "http://cbp.wzw.tum.de/index.php?id=9",
"TU_Muenchen": "https://www.tum.de"
},
"release_url": "https://pypi.org/project/weighslide/0.1.7/",
"requires_dist": [
"pandas",
"numpy",
"matplotlib"
],
"requires_python": "",
"summary": "Flexible sliding window analysis",
"version": "0.1.7"
},
"last_serial": 3887557,
"releases": {
"0.1.7": [
{
"comment_text": "",
"digests": {
"md5": "fd31663235a51e63cd9a33fc09d2d4f6",
"sha256": "65d83ea81267ac55ff49546a23b43f4aba284ccf4b1f09e08cc9386c7351ab7e"
},
"downloads": -1,
"filename": "weighslide-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd31663235a51e63cd9a33fc09d2d4f6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24126,
"upload_time": "2018-05-22T12:56:41",
"url": "https://files.pythonhosted.org/packages/d7/8e/9487e02337a1cc03ec5f05d25edc257f014bc760c45866a2689b67d50943/weighslide-0.1.7-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "0e4dc54d66bbab064ad6ec55c9374007",
"sha256": "c5e1105659ba2623e9e1e394497e3fcc63434be6ef7a78cfdea18ccd8785361f"
},
"downloads": -1,
"filename": "weighslide-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "0e4dc54d66bbab064ad6ec55c9374007",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25274,
"upload_time": "2018-05-22T12:56:42",
"url": "https://files.pythonhosted.org/packages/12/81/49427268bc4f4e8c998578e0b9c79a7e56b92b7c4234d24e9d8d744e4489/weighslide-0.1.7.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "fd31663235a51e63cd9a33fc09d2d4f6",
"sha256": "65d83ea81267ac55ff49546a23b43f4aba284ccf4b1f09e08cc9386c7351ab7e"
},
"downloads": -1,
"filename": "weighslide-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd31663235a51e63cd9a33fc09d2d4f6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24126,
"upload_time": "2018-05-22T12:56:41",
"url": "https://files.pythonhosted.org/packages/d7/8e/9487e02337a1cc03ec5f05d25edc257f014bc760c45866a2689b67d50943/weighslide-0.1.7-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "0e4dc54d66bbab064ad6ec55c9374007",
"sha256": "c5e1105659ba2623e9e1e394497e3fcc63434be6ef7a78cfdea18ccd8785361f"
},
"downloads": -1,
"filename": "weighslide-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "0e4dc54d66bbab064ad6ec55c9374007",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25274,
"upload_time": "2018-05-22T12:56:42",
"url": "https://files.pythonhosted.org/packages/12/81/49427268bc4f4e8c998578e0b9c79a7e56b92b7c4234d24e9d8d744e4489/weighslide-0.1.7.tar.gz"
}
]
}