Skip to main content

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;
  • Visulization tools and some useful utilities.

Requirements:

Before installation, you should:

  1. install pytorch yourself according to your environment;
  2. 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")
      

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()

Results

Release files for difflearn 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for difflearn 1.0.4
File Size Uploaded
difflearn-1.0.4.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for difflearn 1.0.4
File Interpreter ABI Platform
difflearn-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / difflearn-1.0.4.tar.gz

Download URL difflearn-1.0.4.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
04fc30078c9c950b013a304752fbcd96b45a07e3c32f755456b8275d2d6f45ba
BLAKE2b-256 checksum
How to use checksums
f6fa7d328af9d58df33f455890c78d8152d473e861f7fe6ce7f2f23e6c9a222e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / difflearn-1.0.4-py3-none-any.whl

Download URL difflearn-1.0.4-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d09daab8571e8f6b1e2fbf6bbe796caa09b16dc0788507090a6ab941cfe62617
BLAKE2b-256 checksum
How to use checksums
6ad4a86e4d97dcab43bd4ec10244571ca39034f20c90e7dcbaf833a0d3d66574
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page