Skip to main content

Package to decipher LRI-mediated brain network communication

Project description

CLRIA

CLRIA: connectome-constrained ligand-receptor interaction analysis for understanding brain network communication

Fig1

Installation

  • Install from PyPI: pip install clria

  • install from source:

    git clone git@github.com:duzc-Repos/CLRIA.git
    cd CLRIA
    pip install .
    
  • [Optional] install pytorch for GPU acceleration, see pytorch.org for detail.

Usage

Quick example

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

import clria

## 0. simulation data
n_rank = 5
n_region = 100
n_lrpair = 20
eps = 1e-100
r, A, B, C, L, R, TL, TR, M, (M1, M2) = clria.otsim.simu_data(
            n_r=n_rank, n1=n_region, n_lr=n_lrpair,             ## r, A, B, C
            TL=10, TR=15,                                       ## L, R, TL, TR
            scale_factor=1e4, epsilon=1,                        ## M, 
            is_decomposition=True, n_d=10, solver="nmf",        ## (M1, M2)
            eps=eps)

## 1. solver
epsi, tau = 0, 1
r = 5
mmot_obj = clria.ottl.MMOTNTD(L, R, M, TL, TR, epsilon=epsi, tau1=tau, tau2=tau,)
mmot_obj.fit(r=r)
(Ae, Be, Ce) = mmot_obj.factors
tca_obj = clria.ottl.TCA(Ae, Be, Ce)

## 2. plotting
annot = pd.DataFrame({ i:[f"network_{i//20+1}"] for i in range(100) }).T ## random generate annotation
clria.otpl.plot_sankey(tca_obj, annot, figure_size=(600, 700))

Notebook

API

Here is a brief list of the functionalities provided by this repository. Additional information is provided in their docstring or by calling help(function_name).

preprocessing: otpp

  • otpp.LRdatabse(lrdb, ...):
    • .extract_lr_expression(self, expr, ...): extract ligand and receptor expression from gene expression matrix.
    • .generate_coupling_matrix(self, ...): generate two matrix $T_L, T_R$ recoding the correspondence between LR pairs and ligand or receptor.
  • otpp.BNCM():
    • .proximal_to_distance(self, SC): transfrom the fiber density measure to distance measures.
    • .calc_navigation(self, L, D): calculate navigation measure based on $L$ (strength-to-length remapping of the connection weight) and $D$ (distance matrix, e.g. Euclidean distance between nodes)

tools: ottl

  • ottl.MMOTNTD(L, R, M, TL, TR, ...)
    • .fit(self, r): solve LR-mediated communication patterns $A, B, C$.
  • ottl.gen_PermM(surf_files, info, ...): generate spatial-preserving permutation idx.
  • ottl.TCA(A, B, C):
    • .calc_T_statistics_matrix(self): infer region-wise asymmetrix signaling across all LR pairs.
    • .analyze_trans_hierarchical_signaling_cortex(self, hierarchy, ...): infer trans-hierarchical asymmetrix signaling between cortical regions by KS test.
    • .analyze_trans_hierarchical_signaling_cortex_spin(self, hierarchy, ...): infer trans-hierarchical asymmetrix signaling between cortical regions by spin test.
    • .analyze_trans_hierarchical_signaling_cortex_and_subcortex(self, hierarchy, ...): infer trans-hierarchical asymmetrix signaling between cortical and subcortex regions by KS test.
    • .graph_spectrum_analysis(self, hamonics, SC): energy density analysis of asymmetrix signal of each LR pair.
    • .get_pathway_network(self, pathway_name, ...): reconstruct pathway-specific communication network from communication pattters.
    • .get_lr_network(self, idx, ...): reconstruct LR-specific communication network from communication pattters.
    • .identify_dominant_LR_from_Ce(self, ...): identify domiant LR pairs for each tensor factor.
    • .prepare_ROI_from_Ae_Be(self, atlas_nii, ...): prepare ROI files of each tensor factor for Neurosynth analysis.
  • ottl.UOTRegression(pattern, ...)
    • .fit(src, dst, ...): solve UOT regression between source state and target state.
    • .get_opt_UOT_dist(self, beta, P): compute UOT distance value.
    • .get_opt_obj_val(self, beta, P, src, dst): compute objective function values.
  • ottl.OTRegression(pattern, ...): an balanced version of UOTRegression
    • .fit(src, dst, ...): solve OT regression between source state and target state.
    • .get_opt_OT_dist(self, beta, P): compute OT distance value.
    • .get_opt_obj_val(self, beta, P, src, dst): compute objective function values.

plotting: otpl

  • .otpl.plot_sankey(tca_obj, annot, ...): sankey plot of communication patterns, LR or pathway communication network.
  • .otpl.plot_circos(tca_obj, annot, name, ...): circos plot of communication patterns, LR or pathway communication network.

simmulation: otsim

  • otsim.simu_data(n_r, n1, n2, n_lr, ...): simulating data using inverse optimal transport (iOT).

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

clria-1.0.9.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clria-1.0.9-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file clria-1.0.9.tar.gz.

File metadata

  • Download URL: clria-1.0.9.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.0

File hashes

Hashes for clria-1.0.9.tar.gz
Algorithm Hash digest
SHA256 d0003785d2a8d0080bf5296f1211f68418d4aeaf0e88446725782ea5d1e88107
MD5 df5e89eeec21349b73ce77db7c209348
BLAKE2b-256 f5f778a0dda98fe686c7adb1bf167455228f76a7735c38785215014c9aad5a0f

See more details on using hashes here.

File details

Details for the file clria-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: clria-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 51.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.0

File hashes

Hashes for clria-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 02c6179a91eff5c0f2bb3937a5aa64d6400198c5075e735cc9eec885c6ce2dbb
MD5 faff7d4de303034278079d44b37d1a4e
BLAKE2b-256 591a9e3d65bcd498df808a4930803f6652af3a6ec17ca83e876289b6798e2bc9

See more details on using hashes here.

Supported by

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