Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hs.module_scores return nothing #42

Open
lvmt opened this issue Nov 28, 2024 · 0 comments
Open

hs.module_scores return nothing #42

lvmt opened this issue Nov 28, 2024 · 0 comments

Comments

@lvmt
Copy link

lvmt commented Nov 28, 2024

hi

i run hotspot like this

import scanpy as sc  
import anndata as ad  
import pandas as pd  

import hotspot

import numpy as np
import mplscience
import matplotlib 

import sys  

infile = sys.argv[1]
adata = sc.read_h5ad(infile)

adata.obs_names_make_unique()
adata.var_names_make_unique()

sc.pp.filter_genes(adata, min_cells=3)
adata.obs["total_counts"] = np.asarray(adata.X.sum(1)).ravel()
adata.layers["csc_counts"] = adata.X.tocsc()

sc.pp.normalize_total(adata)
sc.pp.log1p(adata)

# step1 Create the Hotspot object and the neighborhood graph
hs = hotspot.Hotspot(
    adata,
    layer_key="csc_counts",
    model='bernoulli',
    latent_obsm_key="spatial",
    umi_counts_obs_key="total_counts",
)

hs.create_knn_graph(
    weighted_graph=False, n_neighbors=300,
)

# step2
hs_results = hs.compute_autocorrelations()

## step3:  
hs_genes = hs_results.index[hs_results.FDR < 0.05]
lcz = hs.compute_local_correlations(hs_genes)


modules = hs.create_modules(
    min_gene_threshold=20, core_only=False, fdr_threshold=0.05
)

## step4:  
import pickle
with open('test.pkl', 'wb') as f:
    pickle.dump(hs, f)

##   read hotspot pkl  
with open('hotspot.C1.pkl', 'rb') as f:
    hss = pickle.load(f) 

hss.plot_local_correlations()   # get output   
hss.results  # get output   
hss.modules  # get output    
hss.local_correlation_z  # get output   
hss.module_scores # return nothing   

can you help me resolve the problem.
thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant