Skip to content

Commit

Permalink
Merge pull request #50 from saezlab/dev
Browse files Browse the repository at this point in the history
Biorxiv version
  • Loading branch information
dbdimitrov committed Aug 22, 2023
2 parents db3a848 + db7c80d commit 0fad24a
Show file tree
Hide file tree
Showing 21 changed files with 527 additions and 606 deletions.
27 changes: 11 additions & 16 deletions README.md
@@ -1,4 +1,4 @@
# LIANA+: a one-stop-shop framework for cell-cell communication <img src="https://raw.githubusercontent.com/saezlab/liana-py/dev/docs/source/_static/logo.png?raw=true" align="right" height="125">
# LIANA+: an all-in-one framework for cell-cell communication <img src="https://raw.githubusercontent.com/saezlab/liana-py/dev/docs/source/_static/logo.png?raw=true" align="right" height="125">

<!-- badges: start -->
[![main](https://github.com/saezlab/liana-py/actions/workflows/main.yml/badge.svg)](https://github.com/saezlab/liana-py/actions)
Expand All @@ -8,19 +8,16 @@
[![Downloads](https://pepy.tech/badge/liana)](https://pepy.tech/project/liana)
<!-- badges: end -->

LIANA+ is an efficient framework that integrates and extends existing methods and knowledge to study cell-cell communication in single-cell, spatially-resolved, and multi-modal omics data.
LIANA+ is an efficient framework that integrates and extends existing methods and knowledge to study cell-cell communication in single-cell, spatially-resolved, and multi-modal omics data. It works in conjunction with the [scverse ecosystem](https://github.com/scverse), and it relies on [AnnData](https://github.com/scverse/anndata) & [MuData](https://github.com/scverse/mudata) objects as input.

<img src="https://raw.githubusercontent.com/saezlab/liana-py/main/docs/source/_static/abstract.png" width="700" align="center">


## Contributions & Development
## Development & Contributions

LIANA+ is currently at it's alpha stage - i.e. we are actively working on improving it.

The API visible to the user should be stable, specifically `liana.method.sc`, but some differences in terms of secondary parameters, or default settings are possible.

More importantly, we welcome suggestions, ideas, and contributions! Please use do not hesitate to contact us, or use the issues or the [LIANA+ Development project](https://github.com/orgs/saezlab/projects/16) to make suggestions.
LIANA+ is still under development. Nevertheless, the API visible to the user should be stable, specifically `liana.method.sc`.

We welcome suggestions, ideas, and contributions! Please use do not hesitate to contact us, or use the issues or the [LIANA+ Development project](https://github.com/orgs/saezlab/projects/16) to make suggestions.

## Tutorials

Expand All @@ -30,18 +27,17 @@ More importantly, we welcome suggestions, ideas, and contributions! Please use d

### Spatial Data

- [Learn spatially-informed relationships with MISTy](https://liana-py.readthedocs.io/en/latest/notebooks/misty.html) across (multi-)views
- [Learn spatially-informed relationships with MISTy](https://liana-py.readthedocs.io/en/latest/notebooks/misty.html) across (multi-) views.

- Estimate local spatially-informed bivariate metrics with [LIANA's bivariate scores](https://liana-py.readthedocs.io/en/latest/notebooks/bivariate.html)
- [Estimate local spatially-informed bivariate metrics](https://liana-py.readthedocs.io/en/latest/notebooks/bivariate.html). This tutorial shows how to estimate local spatially-informed bivariate metrics, such as the spatially-informed Pearson correlation coefficient or Cosine similarity.

### Multi-condition

- [Hypothesis-testing for CCC with PyDeSeq2](https://liana-py.readthedocs.io/en/latest/notebooks/targeted.html) that also shows the inference of causal **intracellular** signalling networks
- [Hypothesis-testing for CCC with PyDeSeq2](https://liana-py.readthedocs.io/en/latest/notebooks/targeted.html) that also shows the inference of causal **intracellular** signalling networks, downstream of CCC events.

- [Multicellular programmes with MOFA](https://liana-py.readthedocs.io/en/latest/notebooks/mofacellular.html). Using MOFA to obtain coordinates
gene expression programmes across samples and conditions, as done in [Ramirez et al., 2023](https://europepmc.org/article/ppr/ppr620471)
- [Multicellular programmes with MOFA](https://liana-py.readthedocs.io/en/latest/notebooks/mofacellular.html). Using MOFA to obtain coordinates gene expression programmes across samples and conditions, as done in [Ramirez et al., 2023](https://europepmc.org/article/ppr/ppr620471).

- [LIANA with MOFA](https://liana-py.readthedocs.io/en/latest/notebooks/mofatalk.html). Using MOFA to infer intercellular communication programmes across samples and conditions, as initially proposed by cell2cell-Tensor
- [LIANA with MOFA](https://liana-py.readthedocs.io/en/latest/notebooks/mofatalk.html). Using MOFA to infer intercellular communication programmes across samples and conditions, as initially proposed by cell2cell-Tensor.

- [LIANA with cell2cell-Tensor](https://liana-py.readthedocs.io/en/latest/notebooks/liana_c2c.html) to extract intercellular communication programmes across samples and conditions. Extensive tutorials combining LIANA & [cell2cell-Tensor](https://www.nature.com/articles/s41467-022-31369-2) are available [here](https://ccc-protocols.readthedocs.io/en/latest/index.html).

Expand All @@ -55,10 +51,9 @@ gene expression programmes across samples and conditions, as done in [Ramirez et
For further information please check LIANA's [API documentation](https://liana-py.readthedocs.io/en/latest/api.html).



## Cite LIANA+:

Dimitrov, D. ... Saez-Rodriguez, J.
Dimitrov D., Schäfer P.S.L, Farr E., Rodriguez Mier P., Lobentanzer S., Dugourd A., Tanevski J., Ramirez Flores R.O. and Saez-Rodriguez J. 2023 LIANA+: an all-in-one cell-cell communication framework. BioRxiv. https://www.biorxiv.org/content/10.1101/2023.08.19.553863v1

Dimitrov, D., Türei, D., Garrido-Rodriguez M., Burmedi P.L., Nagai, J.S., Boys, C., Flores, R.O.R., Kim, H., Szalai, B., Costa, I.G., Valdeolivas, A., Dugourd, A. and Saez-Rodriguez, J. Comparison of methods and resources for cell-cell communication inference from single-cell RNA-Seq data. Nat Commun 13, 3224 (2022). https://doi.org/10.1038/s41467-022-30755-0

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
@@ -1,4 +1,4 @@
LIANA: a one-stop-shop framework for cell-cell communication
LIANA: an all-in-one framework for cell-cell communication
===========================================

|MainBuild| |Issues| |Docs| |Codecov|
Expand Down
72 changes: 32 additions & 40 deletions docs/source/notebooks/bivariate.ipynb

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/source/notebooks/liana_c2c.ipynb

Large diffs are not rendered by default.

700 changes: 304 additions & 396 deletions docs/source/notebooks/misty.ipynb

Large diffs are not rendered by default.

144 changes: 69 additions & 75 deletions docs/source/notebooks/mofatalk.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/reference.rst
@@ -1,7 +1,7 @@
Reference
----------

Dimitrov, D. ... Saez-Rodriguez, J. In prep...
Dimitrov D., Schäfer P.S.L, Farr E., Rodriguez Mier P., Lobentanzer S., Dugourd A., Tanevski J., Ramirez Flores R.O. and Saez-Rodriguez J. 2023 LIANA+: an all-in-one cell-cell communication framework. BioRxiv. https://www.biorxiv.org/content/10.1101/2023.08.19.553863v1

Dimitrov, D., Türei, D., Garrido-Rodriguez M., Burmedi P.L., Nagai, J.S., Boys, C., Flores, R.O.R., Kim, H., Szalai, B., Costa, I.G., Valdeolivas, A., Dugourd, A. and Saez-Rodriguez, J. Comparison of methods and resources for cell-cell communication inference from single-cell RNA-Seq data. Nat Commun 13, 3224 (2022). https://doi.org/10.1038/s41467-022-30755-0

Expand Down
14 changes: 14 additions & 0 deletions docs/source/release_notes.rst
@@ -1,6 +1,20 @@
Release notes
=============

1.0.0a1 (30.07.2023)
---------------------------------------------------------

- `positive_only` in bivariate metrics was renamed to `mask_negatives` will now mask only negative-negative/low-low interactions, and not negative-positive interactions.

- Replaced MSigDB with transcription factor activities in MISTy's tutorial

- Enable sorting according to ascending order in misty-related plots

- Enable `cmap` to be passed to tileplot & dotplots

- Minor Readme & tutorial improvements.


1.0.0a0 (27.07.2023) LIANA+ Release
---------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions liana/method/_pipe_utils/_pre.py
Expand Up @@ -122,7 +122,8 @@ def prep_check_adata(adata: AnnData,
msk_samples = adata.X.sum(axis=1).A1 == 0
n_empty_samples = np.sum(msk_samples)
if n_empty_samples > 0:
raise ValueError(f"{n_empty_samples} samples of mat are empty, please remove them.")
if verbose:
print(f"{n_empty_samples} samples of mat are empty, please remove them.")

# Check if log-norm
_sum = np.sum(adata.X.data[0:100])
Expand All @@ -133,8 +134,7 @@ def prep_check_adata(adata: AnnData,
# Check for non-finite values
if np.any(~np.isfinite(adata.X.data)):
raise ValueError(
"""mat contains non finite values (nan or inf), please set them
to 0 or remove them.""")
"mat contains non finite values (nan or inf), please set them to 0 or remove them.")

# Define idents col name
if groupby is not None:
Expand Down
20 changes: 10 additions & 10 deletions liana/method/sp/_SpatialBivariate.py
Expand Up @@ -35,7 +35,7 @@ def __call__(self,
connectivity_key = 'spatial_connectivities',
mod_added = "local_scores",
key_added = 'global_res',
positive_only=False,
mask_negatives=False,
add_categories = False,
n_perms: int = None,
seed = 1337,
Expand Down Expand Up @@ -82,8 +82,8 @@ def __call__(self,
Key in `mdata.mod` where the local scores are stored.
key_added: str
Key in `mdata.uns` where the global scores are stored.
positive_only: bool
Whether to mask non-positive interactions.
mask_negatives: bool
Whether to mask negative-negative (low-low) or uncategorized interactions.
add_categories: bool
Whether to add categories about the local scores
n_perms: int
Expand Down Expand Up @@ -223,17 +223,17 @@ def __call__(self,
# reorder columns, NOTE: why?
xy_stats = xy_stats.reindex(columns=sorted(xy_stats.columns))

if add_categories or positive_only:
if add_categories or mask_negatives:
local_cats = _categorize(x_mat=x_mat,
y_mat=y_mat,
weight=weight,
idx=mdata.obs.index,
columns=xy_stats['interaction'],
)
pos_msk = local_cats > 0
local_msk = local_cats != 0
else:
local_cats = None
pos_msk = None
local_msk = None

# get local scores
xy_stats, local_scores, local_pvals = \
Expand All @@ -245,15 +245,15 @@ def __call__(self,
weight=weight,
seed=seed,
n_perms=n_perms,
positive_only=positive_only,
pos_msk=pos_msk,
mask_negatives=mask_negatives,
local_msk=local_msk,
verbose=verbose,
)
local_scores = obsm_to_adata(adata=mdata, df=local_scores, obsm_key=None, _uns=mdata.uns)
local_scores.uns[key_added] = xy_stats

if positive_only:
local_scores.X = local_scores.X * pos_msk.T
if mask_negatives:
local_scores.X = local_scores.X * local_msk.T
if local_cats is not None:
local_scores.layers['cats'] = csr_matrix(local_cats.T)
if local_pvals is not None:
Expand Down
4 changes: 2 additions & 2 deletions liana/method/sp/_lr_bivar.py
Expand Up @@ -20,7 +20,7 @@ def __call__(self,
interactions=None,
expr_prop: float = 0.05,
n_perms: int = None,
positive_only: bool = False,
mask_negatives: bool = False,
seed: int = 1337,
add_categories: bool = False,
use_raw: Optional[bool] = True,
Expand Down Expand Up @@ -92,7 +92,7 @@ def __call__(self,
interactions=interactions,
nz_threshold=expr_prop,
n_perms=n_perms,
positive_only=positive_only,
mask_negatives=mask_negatives,
add_categories=add_categories,
x_mod=True,
y_mod=True,
Expand Down

0 comments on commit 0fad24a

Please sign in to comment.