rots-py


Namerots-py JSON
Version 1.4.0 PyPI version JSON
download
home_page
SummaryROTS gene ranking implementation in Python
upload_time2023-10-22 15:46:27
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2023 EDISS-intake2-team4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords rots gene ranking
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # rots-py

[![PyPI](https://img.shields.io/pypi/v/rots-py)](https://pypi.org/project/rots-py/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/rots-py)


Python implementation of the __Reproducibility-Optimized Test Statistic (ROTS)__ for gene ranking from the [Bioconductor ROTS](https://www.bioconductor.org/packages/release/bioc/html/ROTS.html) package.

ROTS belongs to a familly of gene ranking statistics that aim to rank genes based on evidence for differential expression in two-group comparisons. ROTS is a non-parametric method that uses a permutation test to assess the significance of the observed differential expression. ROTS is designed to be robust to outliers and to be reproducible across different studies.

__NOTE__: Data should have at least two non-null values per row for both groups.

# Installation 
```
pip install rots-py
```

# Usage
```python  
from rotspy import rots, plot_rots, get_summary

# Load data
data = ...
group = ...

# Run ROTS
result = rots(data, group, B=500, log=True, verbose=True, progress=True)

# Get the ranking
ranking_statistic = result["d"]
fdr = result["fdr"]
logFC = result["logfc"]
pvalue = result["p"]

# Get the summary of result with FDR threshold of 0.05
summary = get_summary(result, fdr_c=0.05)

# Plot volcano plot from the results
plot_rots(result, fdr=0.05, type="volcano")
```

# Methods

## rots(...)
Runs the ROTS analysis on the given data. Returns a Python dictionary.

## Parameters
- `data`: A pandas dataframe with genes/proteins as rows and samples as columns. (required)
- `group`: A pandas series with the group labels for each sample. (required)
- `B`: Number of permutations to perform. Default is 500. (optional)
- `K`: Top-list size. (optional)
- `paried`: Whether the samples are paired. Default is False. (optional)
- `seed`: Seed for the random number generator. Default is None. (optional)
- `a1`: Parameter for the ROTS statistic. If both a1 and a2 are specified optimization step is skipped. (optional)
- `a2`: Parameter for the ROTS statistic. If both a1 and a2 are specified optimization step is skipped. (optional)
- `log`: Whether data is log-transformed. Default is False. (optional)
- `progress`: Whether to show a progress bar. Default is False. (optional)
- `verbose`: Whether to print the progress of the analysis. Default is False. (optional)

## Returns
Python `dict` object with the following keys:
- `data`: The original dataframe used for the input
- `B`: Number of permutations
- `d`: ROTS test statistic for each gene/protein
- `logfc`: Log2 fold change
- `p`: P-value
- `FDR`: False Detection Rate
- `a1`: Optimized parameter a1
- `a2`: Optimized parameter a2
- `k`: Top list size (*`None` if optimization skipped*)
- `R`: Reproducibility score (*`None` if optimization skipped*)
- `Z`: Z-score (*`None` if optimization skipped*)
- `ztable`: Z-score table
- `cl`: Group labels for each sample

## get_summary(...)
Returns a summary of the ROTS results.

## Parameters
- `rots_res`: The result of the `rots` function. (required)
- `fdr_c`: The FDR threshold for the summary. Default is `None` (required if `n_features` is not specified)
- `n_features`: The number of top rows to show in the summary. Default is `None` (required if `fdr` is not specified)
- `verbose`: Whether to print the summary. Default is `True` (optional)

## Returns
A pandas dataframe with the following columns:
- `Row`: The row names of the input dataframe
- `ROTS Statistic`: The ROTS statistic for each row
- `pvalue`: The p-value for each row
- `FDR`: The FDR for each row

## plot(...)
Plots the ROTS results. 

## Parameters
- `rots_res`: The result of the `rots` function. (required)
- `fdr`: The FDR threshold for the plot. Default is `0.05` (required)
- `type`: The type of plot to generate. (required)
    - "volcano"
    - "heatmap"
    - "ma"
    - "reproducibility"
    - "pvalue"
    - "pca"



# Acknowledgements
This package was developed as part of the [EDISS](https://www.master-ediss.eu/) program in collaboration with Coffey Lab at the [Turku Bioscience](https://bioscience.fi/) center.

# Changelog

## 1.4.0
- Added support for Python 3.9 on Linux

## 1.3.0
- Added support for Python 3.8 on Linux

## 1.2.0
- Added `get_summary` function
- Added `plot_rots` function
- Modified the import statement to `from rotspy import ...`
- More optimizations
- Bug fixes

## 1.1.0
- Ported parts of code to Cython for better performance
- Fixed bugs

## 1.0.3
- Bug fixes

## 1.0.2
- Bug fixes 
- Added numba for better performance

## 1.0.0
- Initial release


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "rots-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "rots,gene,ranking",
    "author": "",
    "author_email": "\"F.Mamadbekov, M.Shakya, A.Montoya, I.Ul-Haq\" <fmamadbe@abo.fi>",
    "download_url": "https://files.pythonhosted.org/packages/63/dc/4884ee308d49ab573f235bae32820c0e7d7a4e9d647618352da25705a9d3/rots-py-1.4.0.tar.gz",
    "platform": null,
    "description": "# rots-py\r\n\r\n[![PyPI](https://img.shields.io/pypi/v/rots-py)](https://pypi.org/project/rots-py/)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dm/rots-py)\r\n\r\n\r\nPython implementation of the __Reproducibility-Optimized Test Statistic (ROTS)__ for gene ranking from the [Bioconductor ROTS](https://www.bioconductor.org/packages/release/bioc/html/ROTS.html) package.\r\n\r\nROTS belongs to a familly of gene ranking statistics that aim to rank genes based on evidence for differential expression in two-group comparisons. ROTS is a non-parametric method that uses a permutation test to assess the significance of the observed differential expression. ROTS is designed to be robust to outliers and to be reproducible across different studies.\r\n\r\n__NOTE__: Data should have at least two non-null values per row for both groups.\r\n\r\n# Installation \r\n```\r\npip install rots-py\r\n```\r\n\r\n# Usage\r\n```python  \r\nfrom rotspy import rots, plot_rots, get_summary\r\n\r\n# Load data\r\ndata = ...\r\ngroup = ...\r\n\r\n# Run ROTS\r\nresult = rots(data, group, B=500, log=True, verbose=True, progress=True)\r\n\r\n# Get the ranking\r\nranking_statistic = result[\"d\"]\r\nfdr = result[\"fdr\"]\r\nlogFC = result[\"logfc\"]\r\npvalue = result[\"p\"]\r\n\r\n# Get the summary of result with FDR threshold of 0.05\r\nsummary = get_summary(result, fdr_c=0.05)\r\n\r\n# Plot volcano plot from the results\r\nplot_rots(result, fdr=0.05, type=\"volcano\")\r\n```\r\n\r\n# Methods\r\n\r\n## rots(...)\r\nRuns the ROTS analysis on the given data. Returns a Python dictionary.\r\n\r\n## Parameters\r\n- `data`: A pandas dataframe with genes/proteins as rows and samples as columns. (required)\r\n- `group`: A pandas series with the group labels for each sample. (required)\r\n- `B`: Number of permutations to perform. Default is 500. (optional)\r\n- `K`: Top-list size. (optional)\r\n- `paried`: Whether the samples are paired. Default is False. (optional)\r\n- `seed`: Seed for the random number generator. Default is None. (optional)\r\n- `a1`: Parameter for the ROTS statistic. If both a1 and a2 are specified optimization step is skipped. (optional)\r\n- `a2`: Parameter for the ROTS statistic. If both a1 and a2 are specified optimization step is skipped. (optional)\r\n- `log`: Whether data is log-transformed. Default is False. (optional)\r\n- `progress`: Whether to show a progress bar. Default is False. (optional)\r\n- `verbose`: Whether to print the progress of the analysis. Default is False. (optional)\r\n\r\n## Returns\r\nPython `dict` object with the following keys:\r\n- `data`: The original dataframe used for the input\r\n- `B`: Number of permutations\r\n- `d`: ROTS test statistic for each gene/protein\r\n- `logfc`: Log2 fold change\r\n- `p`: P-value\r\n- `FDR`: False Detection Rate\r\n- `a1`: Optimized parameter a1\r\n- `a2`: Optimized parameter a2\r\n- `k`: Top list size (*`None` if optimization skipped*)\r\n- `R`: Reproducibility score (*`None` if optimization skipped*)\r\n- `Z`: Z-score (*`None` if optimization skipped*)\r\n- `ztable`: Z-score table\r\n- `cl`: Group labels for each sample\r\n\r\n## get_summary(...)\r\nReturns a summary of the ROTS results.\r\n\r\n## Parameters\r\n- `rots_res`: The result of the `rots` function. (required)\r\n- `fdr_c`: The FDR threshold for the summary. Default is `None` (required if `n_features` is not specified)\r\n- `n_features`: The number of top rows to show in the summary. Default is `None` (required if `fdr` is not specified)\r\n- `verbose`: Whether to print the summary. Default is `True` (optional)\r\n\r\n## Returns\r\nA pandas dataframe with the following columns:\r\n- `Row`: The row names of the input dataframe\r\n- `ROTS Statistic`: The ROTS statistic for each row\r\n- `pvalue`: The p-value for each row\r\n- `FDR`: The FDR for each row\r\n\r\n## plot(...)\r\nPlots the ROTS results. \r\n\r\n## Parameters\r\n- `rots_res`: The result of the `rots` function. (required)\r\n- `fdr`: The FDR threshold for the plot. Default is `0.05` (required)\r\n- `type`: The type of plot to generate. (required)\r\n    - \"volcano\"\r\n    - \"heatmap\"\r\n    - \"ma\"\r\n    - \"reproducibility\"\r\n    - \"pvalue\"\r\n    - \"pca\"\r\n\r\n\r\n\r\n# Acknowledgements\r\nThis package was developed as part of the [EDISS](https://www.master-ediss.eu/) program in collaboration with Coffey Lab at the [Turku Bioscience](https://bioscience.fi/) center.\r\n\r\n# Changelog\r\n\r\n## 1.4.0\r\n- Added support for Python 3.9 on Linux\r\n\r\n## 1.3.0\r\n- Added support for Python 3.8 on Linux\r\n\r\n## 1.2.0\r\n- Added `get_summary` function\r\n- Added `plot_rots` function\r\n- Modified the import statement to `from rotspy import ...`\r\n- More optimizations\r\n- Bug fixes\r\n\r\n## 1.1.0\r\n- Ported parts of code to Cython for better performance\r\n- Fixed bugs\r\n\r\n## 1.0.3\r\n- Bug fixes\r\n\r\n## 1.0.2\r\n- Bug fixes \r\n- Added numba for better performance\r\n\r\n## 1.0.0\r\n- Initial release\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 EDISS-intake2-team4  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "ROTS gene ranking implementation in Python",
    "version": "1.4.0",
    "project_urls": {
        "Homepage": "https://github.com/EDISS-intake2-team4/rots-py"
    },
    "split_keywords": [
        "rots",
        "gene",
        "ranking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "657982498057f2e80a2a3f2bae6ec85cde8523fc4cec13c26a39b60a7aeeed24",
                "md5": "f103a55b381d79d91b899402241209ef",
                "sha256": "1fac51b2c775415ac15142626f498ab95c85e298d88a96d52c2f6d47abbe973c"
            },
            "downloads": -1,
            "filename": "rots_py-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f103a55b381d79d91b899402241209ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1427597,
            "upload_time": "2023-10-22T15:46:24",
            "upload_time_iso_8601": "2023-10-22T15:46:24.922845Z",
            "url": "https://files.pythonhosted.org/packages/65/79/82498057f2e80a2a3f2bae6ec85cde8523fc4cec13c26a39b60a7aeeed24/rots_py-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63dc4884ee308d49ab573f235bae32820c0e7d7a4e9d647618352da25705a9d3",
                "md5": "e56d77634528e13a98e6717a02ada52c",
                "sha256": "3b5a0d31737e07cafe7a8bb195c09354789af263816a69cb5c3669d772aeb61f"
            },
            "downloads": -1,
            "filename": "rots-py-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e56d77634528e13a98e6717a02ada52c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1418865,
            "upload_time": "2023-10-22T15:46:27",
            "upload_time_iso_8601": "2023-10-22T15:46:27.299990Z",
            "url": "https://files.pythonhosted.org/packages/63/dc/4884ee308d49ab573f235bae32820c0e7d7a4e9d647618352da25705a9d3/rots-py-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-22 15:46:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EDISS-intake2-team4",
    "github_project": "rots-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "rots-py"
}
        
Elapsed time: 0.12991s