Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@

* Change inconsistent peaks metrics to consistent peaks (PR #119).

* Removed cLisi metric as it is not informative (PR #145).

## MINOR CHANGES

* Enabled unit tests (PR #2).
Expand Down
42 changes: 42 additions & 0 deletions src/metrics/lisi/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,48 @@ info:
# Whether a higher value represents a 'better' solution (required)
maximize: true


- name: cLisi
label: cLisi
summary: "Cell type Lisi score."
description: |
Compute the cell type local inverse simpson index (cLISI) for each cell, then return the median
as the final score.
references:
doi:
- 10.1038/s41592-019-0619-0
bibtex:
- |
@article{korsunsky2019fast,
title={Fast, sensitive and accurate integration of single-cell data with Harmony},
author={Korsunsky, Ilya and Millard, Nghia and Fan, Jean and Slowikowski, Kamil and Zhang, Fan and Wei, Kevin and Baglaenko, Yuriy and Brenner, Michael and Loh, Po-ru and Raychaudhuri, Soumya},
journal={Nature methods},
volume={16},
number={12},
pages={1289--1296},
year={2019},
publisher={Nature Publishing Group US New York}
}
links:
# URL to the documentation for this metric (required).
documentation: https://scib-metrics.readthedocs.io/en/latest/api.html
# URL to the code repository for this metric (required).
repository: https://github.com/YosefLab/scib-metrics
# The minimum possible value for this metric (required)
min: -0.0001
# The maximum possible value for this metric (required)
max: 1.0001
# Whether a higher value represents a 'better' solution (required)
maximize: true


# Component-specific parameters (optional)
# arguments:
# - name: "--n_neighbors"
# type: "integer"
# default: 5
# description: Number of neighbors to use.

# Resources required to run the component
resources:
# The script of your component (required)
Expand Down
3 changes: 0 additions & 3 deletions src/metrics/lisi/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ def compute_ilisi(adata: ad.AnnData, n_batches: int):

def compute_clisi(integrated: ad.AnnData):
"""
No longer used in the current version of the script, but kept in case
it is needed in the future.

Compute cLISI for an integrated AnnData object.

Args:
Expand Down
27 changes: 25 additions & 2 deletions src/metrics/lisi/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,20 @@

ilisi = np.mean([ilisi_s1, ilisi_s2])

print("Compute cLisi for split 1", flush=True)
clisi_s1, clisi_s1_per_cell = lisi_helper.compute_clisi(integrated_s1)

print("Compute cLisi for split 2", flush=True)
clisi_s2, clisi_s2_per_cell = lisi_helper.compute_clisi(integrated_s2)

clisi = np.mean([clisi_s1, clisi_s2])

print(f"iLisi split 1: {ilisi_s1}", flush=True)
print(f"iLisi split 2: {ilisi_s2}", flush=True)
print(f"Mean iLisi: {ilisi}", flush=True)
print(f"cLisi split 1: {clisi_s1}", flush=True)
print(f"cLisi split 2: {clisi_s2}", flush=True)
print(f"Mean cLisi: {clisi}", flush=True)

print("Write output AnnData to file", flush=True)
# uns layout:
Expand All @@ -74,8 +85,8 @@
uns = {
"dataset_id": integrated_s1.uns["dataset_id"],
"method_id": integrated_s1.uns["method_id"],
"metric_ids": ["iLisi"],
"metric_values": [ilisi],
"metric_ids": ["iLisi", "cLisi"],
"metric_values": [ilisi, clisi],
"ilisi_per_split": {
"split_1": {
"score": ilisi_s1,
Expand All @@ -88,6 +99,18 @@
"cell_ids": np.array(integrated_s2.obs_names),
},
},
"clisi_per_split": {
"split_1": {
"score": clisi_s1,
"per_cell": clisi_s1_per_cell,
"cell_ids": np.array(integrated_s1.obs_names),
},
"split_2": {
"score": clisi_s2,
"per_cell": clisi_s2_per_cell,
"cell_ids": np.array(integrated_s2.obs_names),
},
},
}

output = ad.AnnData(uns=uns)
Expand Down
Loading