Skip to main content

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

Metadata

Release files for clria 1.0.9

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

Source distribution (sdist)

Source distribution for clria 1.0.9
File Size Uploaded Provenance Actions
clria-1.0.9.tar.gz 51.8 kB Without provenance Details for clria-1.0.9.tar.gz

Built distribution (wheel)

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

Total release size: 103.0 kB

Release files / clria-1.0.9.tar.gz

Download URL clria-1.0.9.tar.gz
Size 51.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d0003785d2a8d0080bf5296f1211f68418d4aeaf0e88446725782ea5d1e88107
BLAKE2b-256 checksum
How to use checksums
f5f778a0dda98fe686c7adb1bf167455228f76a7735c38785215014c9aad5a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.0

Release files / clria-1.0.9-py3-none-any.whl

Download URL clria-1.0.9-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02c6179a91eff5c0f2bb3937a5aa64d6400198c5075e735cc9eec885c6ce2dbb
BLAKE2b-256 checksum
How to use checksums
591a9e3d65bcd498df808a4930803f6652af3a6ec17ca83e876289b6798e2bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.0

Security for clria 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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