From 78b14e80983262e052196a8e5ad5f026c8f774a7 Mon Sep 17 00:00:00 2001 From: tanliwei Date: Wed, 4 Dec 2024 16:14:57 +0800 Subject: [PATCH] bug fixes --- .../spt/single_time/gene_regulation.py | 3 ++- stereo/core/cell.py | 21 ++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/stereo/algorithm/spt/single_time/gene_regulation.py b/stereo/algorithm/spt/single_time/gene_regulation.py index 9afa7f7c..5bf198cd 100644 --- a/stereo/algorithm/spt/single_time/gene_regulation.py +++ b/stereo/algorithm/spt/single_time/gene_regulation.py @@ -169,7 +169,8 @@ def __init__( filter_genes(self.data2, min_cells=min_cells[1], inplace=True) # get same genes - same_genes = list(self.data1.genes.var.index & self.data2.genes.var.index) + # same_genes = list(self.data1.genes.var.index & self.data2.genes.var.index) + same_genes = list(self.data1.genes.var.index.intersection(self.data2.genes.var.index)) self.data1 = self.data1.sub_by_name(cell_name=self.cell_mapping['slice1'], gene_name=same_genes, copy=False) self.data2 = self.data2.sub_by_name(cell_name=self.cell_mapping['slice2'], gene_name=same_genes, copy=False) self.genes = self.data1.genes.var.index diff --git a/stereo/core/cell.py b/stereo/core/cell.py index 06f51cd9..79f99cb8 100644 --- a/stereo/core/cell.py +++ b/stereo/core/cell.py @@ -43,9 +43,6 @@ def __init__( self.batch = self._set_batch(batch) self.cell_border = cell_border self.cell_point = None - - def __getattr__(self, key): - return getattr(self._obs, key) def __contains__(self, item): return item in self._obs.columns @@ -94,17 +91,17 @@ def size(self): def shape(self): return self._obs.shape - # @property - # def loc(self): - # return self._obs.loc + @property + def loc(self): + return self._obs.loc - # @property - # def iloc(self): - # return self._obs.iloc + @property + def iloc(self): + return self._obs.iloc - # @property - # def to_csv(self): - # return self._obs.to_csv + @property + def to_csv(self): + return self._obs.to_csv @property def obs(self):