Files
openpipeline/target/executable/dimred/lsi/subset_vars.py
CI cd0af18851 Build branch fix-integration-tests with version dev (2dbe3b72)
Build pipeline: vsh-ci-dev-k8tz4

Source commit: 2dbe3b7231

Source message: Fix pointers to test resources
2024-10-17 17:56:12 +00:00

20 lines
629 B
Python

def subset_vars(adata, subset_col):
"""Subset AnnData object on highly variable genes
Parameters
----------
adata : AnnData
Annotated data object
subset_col : str
Name of the boolean column in `adata.var` that contains the information if features should be used or not
Returns
-------
AnnData
Copy of `adata` with subsetted features
"""
if not subset_col in adata.var.columns:
raise ValueError(f"Requested to use .var column '{subset_col}' as a selection of genes, but the column is not available.")
return adata[:, adata.var[subset_col]].copy()