Skip to content

Commit

Permalink
added binary_motif_mtx fn
Browse files Browse the repository at this point in the history
  • Loading branch information
HAL9032 committed Jan 29, 2024
1 parent a940ea5 commit 939f93e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions episcanpy/tools/_motif_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,13 @@ def run(self) -> None:
self.q.put(results)

self.sem.release()


def binary_motif_mtx(adata):

motif_presence_mtx = np.zeros((len(adata.uns["motif_search"]["tf_motifs"]), adata.n_vars))

for tfbs in adata.uns["motif_search"]["results"]:
motif_presence_mtx[tfbs["motif_idx"], tfbs["feature_idx"]] = 1

adata.uns["motif_search"]["motif_presence_mtx"] = motif_presence_mtx

0 comments on commit 939f93e

Please sign in to comment.