Some useful tools for differential network inference with python.
Project description
difflearn
This is a python tool packages for differential network inference (DNI).
This package mainly contains:
-
Differential network inference models:
- Pinv;
- NetDiff;
- BDgraph;
- JGL;
- JGLCV;
-
Expression profiles simulation algorithms:
- distributions:
- Gaussian;
- Exponential;
- Mixed;
- network structures:
- random;
- hub;
- block;
- scale-free;
- distributions:
-
Visulization tools and some useful utilities.
Requirements:
Before installation, you should:
- install pytorch yourself according to your environment;
- install R language and R packages as follows:
- JGL
install.packages( "JGL" )
- BDgraph:
install.packages( "BDgraph" )
- NetDiff:
library(devtools) install_git("https://gitlab.com/tt104/NetDiff.git")
- JGL
Please note:
If you have several different versions of R, you should specify the version installed with above packages with:
import os
os.environ["R_HOME"] = "your path to R"
Installation
Easily run:
pip install difflearn
Quick Start
from difflearn.simulation import *
from difflearn.models import Random,Pinv,NetDiff,BDGraph,JointGraphicalLasso,JointGraphicalLassoCV
from difflearn.utils import *
from difflearn.visualization import show_matrix
import matplotlib.pyplot as plt
data_params = {
'p': 10,
'n': 1000,
'sample_n': 100,
'repeats': 1,
'sparsity': [0.1, 0.1],
'diff_ratio': [0.5, 0.5],
'parallel_loops': 1,
'net_rand_mode': 'BA',
'diff_mode': 'hub',
'target_type': 'float',
'distribution': 'Gaussian',
'usage': 'comparison',
}
data = ExpressionProfilesParallel(**data_params)
modelrandom = Random()
modelPinv = Pinv()
modelBDgraph = BDGraph()
modelNetDiff = NetDiff()
modelJGL = JointGraphicalLasso()
modelJGLCV = JointGraphicalLassoCV()
(sigma, delta, *X) = data[0]
modelrandom.fit(X)
modelPinv.fit(X)
modelBDgraph.fit(X)
modelNetDiff.fit(X)
modelJGL.fit(X)
modelJGLCV.fit(X)
fig, axs = plt.subplots(4, 2, figsize=(7,7))
show_matrix(vec2mat(delta)[0], ax=axs[0][0], title = 'Ground Truth')
axs[0][1].set_visible(False)
show_matrix(modelrandom.delta, ax=axs[1][0], title = 'Random')
show_matrix(modelPinv.delta, ax=axs[1][1], title = 'Pinv')
show_matrix(modelBDgraph.delta, ax=axs[2][0], title = 'BDgraph')
show_matrix(modelNetDiff.delta, ax=axs[2][1], title = 'NetDiff')
show_matrix(modelJGL.delta, ax=axs[3][0], title = 'JGL')
show_matrix(modelJGLCV.delta, ax=axs[3][1], title = 'JGLCV')
plt.tight_layout()
fig.set_dpi(300)
plt.show()
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file difflearn-1.0.4.tar.gz.
File metadata
- Download URL: difflearn-1.0.4.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/1.0.0 urllib3/1.26.3 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/22.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04fc30078c9c950b013a304752fbcd96b45a07e3c32f755456b8275d2d6f45ba
|
|
| MD5 |
e422b43310373169d4127ba56fbe37aa
|
|
| BLAKE2b-256 |
f6fa7d328af9d58df33f455890c78d8152d473e861f7fe6ce7f2f23e6c9a222e
|
File details
Details for the file difflearn-1.0.4-py3-none-any.whl.
File metadata
- Download URL: difflearn-1.0.4-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/1.0.0 urllib3/1.26.3 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/22.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d09daab8571e8f6b1e2fbf6bbe796caa09b16dc0788507090a6ab941cfe62617
|
|
| MD5 |
74ac1adf8ae99bd3165f716bda9a1a88
|
|
| BLAKE2b-256 |
6ad4a86e4d97dcab43bd4ec10244571ca39034f20c90e7dcbaf833a0d3d66574
|