Skip to main content

granger causality analysis

Project description

gnr

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

Developer Guide

Setup

# 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

pip install -e .

# install from pypi
pip install gnr

nbdev

# 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:

%load_ext autoreload
%autoreload 2

Publishing

# publish to pypi
$ nbdev_pypi

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

Usage

Installation

Install latest from the GitHub repository:

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

or from conda

$ conda install -c dsm-72 gnr

or from pypi

$ pip install gnr
df_trj = make_mock_genes_x_tbins()
df_trj.head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .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

5 rows × 100 columns

gc_op = GrangerCausality(n_jobs=2)
df_res = gc_op.fit_transform(df_trj, fit_params={'standard_scaler':True, 'signed_correlation': True})
df_res.head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .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
gc_op.plot_df_org(figsize=(4,4))

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

Documentation

Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnr-0.0.4.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

gnr-0.0.4-py3-none-any.whl (16.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page