-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add harmony * fix formatting * update exception * add test for harmony * install harmony Co-authored-by: Michaela Mueller <[email protected]> Co-authored-by: Michaela Mueller <[email protected]>
- Loading branch information
1 parent
77ab015
commit e028e04
Showing
4 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import scib | ||
from tests.common import LOGGER, assert_near_exact | ||
|
||
|
||
def test_harmony(adata_paul15_template): | ||
adata = scib.ig.harmony(adata_paul15_template, batch="batch") | ||
|
||
scib.pp.reduce_data( | ||
adata, n_top_genes=200, neighbors=True, use_rep="X_emb", pca=True, umap=False | ||
) | ||
|
||
# check NMI after clustering | ||
res_max, score_max, _ = scib.cl.opt_louvain( | ||
adata, | ||
label_key="celltype", | ||
cluster_key="cluster", | ||
plot=False, | ||
inplace=True, | ||
) | ||
LOGGER.info(f"max resolution: {res_max}, max score: {score_max}") | ||
|
||
assert_near_exact(score_max, 0.4954028837739288, 1e-2) |