plot_gene_trend_clusters
Your plantir is very useful, but I wonder why there is no API for gene clustering heatmap. Maybe I am too lazy.
Try seaborns clustermap, e.g., for the Monocyte branch of the tutorial notebook:
import seaborn as sns
mask = ad.varm["gene_trends_Mono"].var(axis=1) > 0.05
g = sns.clustermap(
ad.varm["gene_trends_Mono"].loc[mask],
cmap="Spectral_r",
z_score=0,
row_cluster=True, # Cluster genes
col_cluster=False, # Don't cluster pseudotime
figsize=(10, 8),
cbar_kws={"label": "Expression"},
xticklabels=False, # Hide labels (too many)
yticklabels=False,
)
g.ax_heatmap.set_xlabel("Pseudotime")
g.ax_heatmap.set_ylabel("Genes")
g.ax_heatmap.set_title("Monocyte Branch")
plt.show()
Thank you very much for your answer.At the same time, I have a confusion about gene trends when running the software.I have two ways of preprocessing input data.
sc.pp.normalize_total(adata, target_sum=1e4) sc.pp.log1p(adata) sc.pp.scale(adata, max_value=10)
sc.pp.normalize_total(adata, target_sum=1e4) sc.pp.log1p(adata)
I want to know which result or process is accurate, or how to interpret these two results
When plotting gene trends, only cells of specific branch are used. This is explained, e.g., in the tutorial notebook. The scaling you do in your first example, however, scales the gene expression to a specific variance across the whole dataset. This may have unexpected effects. E.g., if most of the gene's variability happens outside of the branch you are looking at, then it will appear flat within the branch.
I cannot give you an interpretation based on the information provided, and what is more accurate may depend on the question you want to answer. I would recommend visualizing stabilized/imputed expression across the whole dataset, and making sure the correct cells are selected for branch you are investigating.