-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels