Skip to content

Commit

Permalink
revert changes of latent_to_gene.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganten-Hornby committed Oct 28, 2024
1 parent 9220c00 commit 7f7f54e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/gsMap/latent_to_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def find_neighbors_regional(cell_pos, spatial_net_dict, coor_latent, config, cel


def compute_regional_mkscore(cell_pos, spatial_net_dict, coor_latent, config, cell_annotations,
ranks, frac_whole, adata_X_bool, eps=1e-10):
ranks, frac_whole, adata_X_bool):
"""
Compute gmean ranks of a region.
"""
Expand All @@ -110,13 +110,10 @@ def compute_regional_mkscore(cell_pos, spatial_net_dict, coor_latent, config, ce
ranks_tg = ranks[cell_select_pos, :]
gene_ranks_region = gmean(ranks_tg, axis=0)
gene_ranks_region[gene_ranks_region <= 1] = 0
mask = (frac_whole < eps)
frac_whole[mask] = 1

if not config.no_expression_fraction:
# Ratio of expression fractions
frac_focal = adata_X_bool[cell_select_pos, :].sum(axis=0).A1 / len(cell_select_pos)
# print(f"frac_focal: {frac_focal} | type: {type(frac_focal)}")
frac_region = frac_focal / frac_whole
frac_region[frac_region <= 1] = 0
frac_region[frac_region > 1] = 1
Expand Down

0 comments on commit 7f7f54e

Please sign in to comment.