Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
const-ae committed May 27, 2024
1 parent 196d1a9 commit 93ca275
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
1 change: 0 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ To create the LEMUR object that provides functionality to fit, align, predict, a
tl.LEMUR
pp.shifted_log_transform
pp.get_top_hvgs
```
2 changes: 1 addition & 1 deletion src/pylemur/pp/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .basic import get_top_hvgs, shifted_log_transform
from .basic import shifted_log_transform
27 changes: 0 additions & 27 deletions src/pylemur/pp/basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import scanpy.preprocessing._simple
import scipy


Expand Down Expand Up @@ -50,29 +49,3 @@ def shifted_log_transform(counts, overdispersion=0.05, pseudo_count=None, minimu
if scipy.sparse.issparse(counts):
res = scipy.sparse.csr_matrix(res)
return res


def get_top_hvgs(adata, n=1000, layer=None):
"""
Get the indices of the most variable genes
Parameters
----------
adata
The `AnnData` object.
n
The number of highly variable genes
layer
The layer with the variance-stabilized values from `adata`. If
`layer=None`, the function uses `adata.X`.
Returns
-------
A list with the indices of the most highly variable genes from `adata`.
"""
if layer is None:
mat = adata.X
else:
mat = adata.layers[layer]
var = scanpy.preprocessing._simple._get_mean_var(mat)[1]
return var.argsort()[: -(n + 1) : -1]

0 comments on commit 93ca275

Please sign in to comment.