Skip to content

Commit

Permalink
Plot bottom and top 5 genes. Still error on reorder table
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel-github committed May 24, 2024
1 parent 127f789 commit 9de5e69
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spatialpf2/figures/figure2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Spatial CC:
"""

from .common import getSetup
from ..imports import import_HTAN
from ..factorization import pf2
from .commonFuncs.plotFactors import (
bot_top_genes
)
import pandas as pd


def makeFigure():
ax, f = getSetup((10, 12), (4, 5))

rank = 20
X = import_HTAN()

X = pf2(X, rank, doEmbedding=False)

for i in range(rank):
genes = bot_top_genes(X, i+1)
df = pd.DataFrame(
data=X.varm["Pf2_C"][:, i], index=X.var_names, columns=["Component"]
)
ax[i].barh(genes, df.loc[genes, "Component"])

return f

0 comments on commit 9de5e69

Please sign in to comment.