Skip to content

Commit

Permalink
Merge pull request #2 from meyer-lab/FixNanGeneFactors
Browse files Browse the repository at this point in the history
Change trim weight
andrewram4287 authored May 20, 2024
2 parents 23755aa + ce7111e commit 127f789
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions spatialpf2/figures/commonFuncs/plotFactors.py
Original file line number Diff line number Diff line change
@@ -24,14 +24,9 @@ def plot_condition_factors(
X = np.array(data.uns["Pf2_A"])

X = np.log10(X)
if ThomsonNorm is True:
controls = yt.str.contains("CTRL")
XX = X[controls]
else:
XX = X

X -= np.median(XX, axis=0)
X /= np.std(XX, axis=0)
X -= np.median(X, axis=0)
X /= np.std(X, axis=0)

ind = reorder_table(X)
X = X[ind]
@@ -113,7 +108,7 @@ def plot_gene_factors(data: AnnData, ax: Axes, trim=True):

if trim is True:
max_weight = np.max(np.abs(X), axis=1)
kept_idxs = max_weight > 0.08
kept_idxs = max_weight > 0.04
X = X[kept_idxs]
yt = yt[kept_idxs]

4 changes: 2 additions & 2 deletions spatialpf2/figures/figure1.py
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ def makeFigure():
ax, f = getSetup((10, 12), (2, 2))

rank = 20
data = import_HTAN()
X = import_HTAN()

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

plot_condition_factors(X, ax[0])
plot_eigenstate_factors(X, ax[1])

0 comments on commit 127f789

Please sign in to comment.