STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
184 stars 64 forks source link

hotspot.create_modules produces a unknown module: module -1 #197

Closed Sophia409 closed 6 months ago

Sophia409 commented 10 months ago

Dear author:

Thank you for your contribution. @tanliwei-coder

First , how to explain the heatmap created by plt.hotspot_local_correlations? What do the columns of the heat map represent? cells or genes? Second, what are the blank rows boxed by red rectangle? Do they represent highly variable genes that are not assigned to any identified modules? Third, data.tl.result['spatial_hotspot'].modules outputs a module named module -1. What's it? I couldn't find it on heatmap.

Thanks Sophia

data.plt.hotspot_local_correlations(res_key='spatial_hotspot') image

import pandas as pd

# 将 Series 对象转换为 DataFrame
df = pd.DataFrame(data.tl.result['spatial_hotspot'].modules, columns=['Module'])

# 根据 Module 列进行分类,并计算每个分类的计数
grouped = df.groupby('Module').size().reset_index(name='Count')

# 打印分类表格
print(grouped)

image

Zhenbin24 commented 6 months ago

Sorry for taking so long to reply. The first question: The columns in the heat map represent genes; Second question: refer to the issue; The third question: The output is a Series that maps gene to module number. Unassigned genes are indicated with a module number of -1