From 93ca2758e1bb2eeb0a1c1d46c4c922cc029d3015 Mon Sep 17 00:00:00 2001 From: const-ae Date: Mon, 27 May 2024 13:35:42 +0200 Subject: [PATCH] Fix --- docs/api.md | 1 - src/pylemur/pp/__init__.py | 2 +- src/pylemur/pp/basic.py | 27 --------------------------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/docs/api.md b/docs/api.md index 3bc5d98..4ce3700 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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 ``` diff --git a/src/pylemur/pp/__init__.py b/src/pylemur/pp/__init__.py index dea9400..ce6d507 100644 --- a/src/pylemur/pp/__init__.py +++ b/src/pylemur/pp/__init__.py @@ -1 +1 @@ -from .basic import get_top_hvgs, shifted_log_transform +from .basic import shifted_log_transform diff --git a/src/pylemur/pp/basic.py b/src/pylemur/pp/basic.py index 02bbae3..9b968cf 100644 --- a/src/pylemur/pp/basic.py +++ b/src/pylemur/pp/basic.py @@ -1,5 +1,4 @@ import numpy as np -import scanpy.preprocessing._simple import scipy @@ -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]