gnr


Namegnr JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/dsm-72/gnr
Summarygranger causality analysis
upload_time2023-11-09 17:16:26
maintainer
docs_urlNone
authordsm-72
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gnr

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

This file will become your README and also the index of your
documentation.

## Developer Guide

### Setup

``` sh
# create conda environment
$ mamba env create -f env.yml

# update conda environment
$ mamba env update -n gnr --file env.yml
# $ mamba env update -n gnr --file env.mac.yml
```

### Install

``` sh
pip install -e .

# install from pypi
pip install gnr
```

### nbdev

``` sh
# activate conda environment
$ conda activate gnr

# make sure the gnr package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to the gnr package
$ nbdev_prepare
```

Note: it might be useful to use the following snippet to enable hot
reloading:

``` python
%load_ext autoreload
%autoreload 2
```

### Publishing

``` sh
# publish to pypi
$ nbdev_pypi

# publish to conda
$ nbdev_conda --build_args '-c conda-forge'
```

# Usage

## Installation

Install latest from the GitHub
[repository](https://github.com/dsm-72/gnr):

``` sh
$ pip install git+https://github.com/dsm-72/gnr.git
```

or from [conda](https://anaconda.org/dsm-72/gnr)

``` sh
$ conda install -c dsm-72 gnr
```

or from [pypi](https://pypi.org/project/gnr/)

``` sh
$ pip install gnr
```

``` python
df_trj = make_mock_genes_x_tbins()
df_trj.head()
```

<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
&#10;    .dataframe tbody tr th {
        vertical-align: top;
    }
&#10;    .dataframe thead th {
        text-align: right;
    }
</style>

|       | 0   | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | ... | 90  | 91  | 92  | 93  | 94  | 95  | 96  | 97  | 98  | 99  |
|-------|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
| wasf  | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | ... | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |
| colq  | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | ... | 1   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   |
| gpr1  | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | ... | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |
| chrm3 | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | ... | 1   | 1   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   |
| lmod2 | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 1   | 1   | 1   | ... | 8   | 8   | 8   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |

<p>5 rows × 100 columns</p>
</div>

``` python
gc_op = GrangerCausality(n_jobs=2)
```

``` python
df_res = gc_op.fit_transform(df_trj, fit_params={'standard_scaler':True, 'signed_correlation': True})
```

``` python
df_res.head()
```

<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
&#10;    .dataframe tbody tr th {
        vertical-align: top;
    }
&#10;    .dataframe thead th {
        text-align: right;
    }
</style>

|         | wasf_y   | colq_y   | gpr1_y   | chrm3_y  | lmod2_y  | tek_y    | kank3_y  | oca2_y   | taz_y    | map4k1_y |
|---------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| wasf_x  | 1.000000 | 0.683091 | 0.314458 | 0.144127 | 0.000818 | 1.000000 | 1.000000 | 0.000066 | 0.102470 | 0.006449 |
| colq_x  | 1.000000 | 1.000000 | 0.779284 | 1.000000 | 1.000000 | 0.001091 | 0.192685 | 0.675090 | 1.000000 | 0.806543 |
| gpr1_x  | 0.805541 | 0.042286 | 1.000000 | 0.892251 | 0.795418 | 0.823063 | 1.000000 | 0.542452 | 0.001091 | 0.852052 |
| chrm3_x | 0.001091 | 0.073638 | 0.168425 | 1.000000 | 0.632585 | 1.000000 | 0.102470 | 0.542452 | 1.000000 | 0.367649 |
| lmod2_x | 0.683091 | 0.000104 | 0.031086 | 0.220671 | 1.000000 | 0.683091 | 0.000818 | 0.367649 | 1.000000 | 0.017608 |

</div>

``` python
gc_op.plot_df_org(figsize=(4,4))
```

![](index_files/figure-commonmark/cell-6-output-1.png)

``` python
gc_op.plot_df_res(figsize=(4,4))
```

![](index_files/figure-commonmark/cell-7-output-1.png)

## Documentation

Documentation can be found hosted on GitHub
[repository](https://github.com/dsm-72/gnr)
[pages](https://dsm-72.github.io/gnr/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/dsm-72/gnr) and
[pypi](https://pypi.org/project/gnr/) respectively.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dsm-72/gnr",
    "name": "gnr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nbdev jupyter notebook python",
    "author": "dsm-72",
    "author_email": "sumner.magruder@yale.edu",
    "download_url": "https://files.pythonhosted.org/packages/7b/f6/4d62dba254665d3fa33b116f41f6919cbf8deaf2ef80a8fa994e5791096a/gnr-0.0.4.tar.gz",
    "platform": null,
    "description": "# gnr\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\nThis file will become your README and also the index of your\ndocumentation.\n\n## Developer Guide\n\n### Setup\n\n``` sh\n# create conda environment\n$ mamba env create -f env.yml\n\n# update conda environment\n$ mamba env update -n gnr --file env.yml\n# $ mamba env update -n gnr --file env.mac.yml\n```\n\n### Install\n\n``` sh\npip install -e .\n\n# install from pypi\npip install gnr\n```\n\n### nbdev\n\n``` sh\n# activate conda environment\n$ conda activate gnr\n\n# make sure the gnr package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to the gnr package\n$ nbdev_prepare\n```\n\nNote: it might be useful to use the following snippet to enable hot\nreloading:\n\n``` python\n%load_ext autoreload\n%autoreload 2\n```\n\n### Publishing\n\n``` sh\n# publish to pypi\n$ nbdev_pypi\n\n# publish to conda\n$ nbdev_conda --build_args '-c conda-forge'\n```\n\n# Usage\n\n## Installation\n\nInstall latest from the GitHub\n[repository](https://github.com/dsm-72/gnr):\n\n``` sh\n$ pip install git+https://github.com/dsm-72/gnr.git\n```\n\nor from [conda](https://anaconda.org/dsm-72/gnr)\n\n``` sh\n$ conda install -c dsm-72 gnr\n```\n\nor from [pypi](https://pypi.org/project/gnr/)\n\n``` sh\n$ pip install gnr\n```\n\n``` python\ndf_trj = make_mock_genes_x_tbins()\ndf_trj.head()\n```\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n&#10;    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n&#10;    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n\n|       | 0   | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | ... | 90  | 91  | 92  | 93  | 94  | 95  | 96  | 97  | 98  | 99  |\n|-------|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|\n| wasf  | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | ... | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |\n| colq  | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | ... | 1   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   |\n| gpr1  | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | ... | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |\n| chrm3 | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | 9   | ... | 1   | 1   | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 0   |\n| lmod2 | 0   | 0   | 0   | 0   | 0   | 0   | 0   | 1   | 1   | 1   | ... | 8   | 8   | 8   | 9   | 9   | 9   | 9   | 9   | 9   | 9   |\n\n<p>5 rows \u00d7 100 columns</p>\n</div>\n\n``` python\ngc_op = GrangerCausality(n_jobs=2)\n```\n\n``` python\ndf_res = gc_op.fit_transform(df_trj, fit_params={'standard_scaler':True, 'signed_correlation': True})\n```\n\n``` python\ndf_res.head()\n```\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n&#10;    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n&#10;    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n\n|         | wasf_y   | colq_y   | gpr1_y   | chrm3_y  | lmod2_y  | tek_y    | kank3_y  | oca2_y   | taz_y    | map4k1_y |\n|---------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|\n| wasf_x  | 1.000000 | 0.683091 | 0.314458 | 0.144127 | 0.000818 | 1.000000 | 1.000000 | 0.000066 | 0.102470 | 0.006449 |\n| colq_x  | 1.000000 | 1.000000 | 0.779284 | 1.000000 | 1.000000 | 0.001091 | 0.192685 | 0.675090 | 1.000000 | 0.806543 |\n| gpr1_x  | 0.805541 | 0.042286 | 1.000000 | 0.892251 | 0.795418 | 0.823063 | 1.000000 | 0.542452 | 0.001091 | 0.852052 |\n| chrm3_x | 0.001091 | 0.073638 | 0.168425 | 1.000000 | 0.632585 | 1.000000 | 0.102470 | 0.542452 | 1.000000 | 0.367649 |\n| lmod2_x | 0.683091 | 0.000104 | 0.031086 | 0.220671 | 1.000000 | 0.683091 | 0.000818 | 0.367649 | 1.000000 | 0.017608 |\n\n</div>\n\n``` python\ngc_op.plot_df_org(figsize=(4,4))\n```\n\n![](index_files/figure-commonmark/cell-6-output-1.png)\n\n``` python\ngc_op.plot_df_res(figsize=(4,4))\n```\n\n![](index_files/figure-commonmark/cell-7-output-1.png)\n\n## Documentation\n\nDocumentation can be found hosted on GitHub\n[repository](https://github.com/dsm-72/gnr)\n[pages](https://dsm-72.github.io/gnr/). Additionally you can find\npackage manager specific guidelines on\n[conda](https://anaconda.org/dsm-72/gnr) and\n[pypi](https://pypi.org/project/gnr/) respectively.\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "granger causality analysis",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/dsm-72/gnr"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "615d42ab5ef75fcf7260839bef67086b8e1124fec8fa5b7c751f7c76b44440db",
                "md5": "0055c9bde1e00955e7b1d21cc469284e",
                "sha256": "21ebfeed74e05dd28962dd100e5a76f5736f931984d4f4d7742413d0233da451"
            },
            "downloads": -1,
            "filename": "gnr-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0055c9bde1e00955e7b1d21cc469284e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16277,
            "upload_time": "2023-11-09T17:16:23",
            "upload_time_iso_8601": "2023-11-09T17:16:23.775251Z",
            "url": "https://files.pythonhosted.org/packages/61/5d/42ab5ef75fcf7260839bef67086b8e1124fec8fa5b7c751f7c76b44440db/gnr-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bf64d62dba254665d3fa33b116f41f6919cbf8deaf2ef80a8fa994e5791096a",
                "md5": "2f14f38b25ba8a59a6e5932d24f28b44",
                "sha256": "086b6a42722c0afa4c65ec0c39a3dde17ae1a1a032f38e4dd0681e71880dadf7"
            },
            "downloads": -1,
            "filename": "gnr-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2f14f38b25ba8a59a6e5932d24f28b44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15994,
            "upload_time": "2023-11-09T17:16:26",
            "upload_time_iso_8601": "2023-11-09T17:16:26.449990Z",
            "url": "https://files.pythonhosted.org/packages/7b/f6/4d62dba254665d3fa33b116f41f6919cbf8deaf2ef80a8fa994e5791096a/gnr-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-09 17:16:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dsm-72",
    "github_project": "gnr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gnr"
}
        
Elapsed time: 0.13776s