SURE-tools 2.0.8__tar.gz → 2.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sure_tools-2.0.8 → sure_tools-2.0.10}/PKG-INFO +1 -1
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/SURE.py +26 -2
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/PKG-INFO +1 -1
- {sure_tools-2.0.8 → sure_tools-2.0.10}/setup.py +1 -1
- {sure_tools-2.0.8 → sure_tools-2.0.10}/LICENSE +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/README.md +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/assembly.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/atlas.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/atac/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/atac/utils.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/codebook/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/codebook/codebook.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/flow/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/flow/plot_quiver.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/__init__.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/custom_mlp.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/queue.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/utils.py +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/SOURCES.txt +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/dependency_links.txt +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/entry_points.txt +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/requires.txt +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/top_level.txt +0 -0
- {sure_tools-2.0.8 → sure_tools-2.0.10}/setup.cfg +0 -0
|
@@ -816,7 +816,7 @@ class SURE(nn.Module):
|
|
|
816
816
|
def _cell_move(self, xs, factor_idx, perturb):
|
|
817
817
|
zns,_ = self.encoder_zn(xs)
|
|
818
818
|
if type(factor_idx) == str:
|
|
819
|
-
factor_idx = np.where(self.cell_factor_names==factor_idx)
|
|
819
|
+
factor_idx = int(np.where(self.cell_factor_names==factor_idx)[0])
|
|
820
820
|
|
|
821
821
|
if perturb.ndim==2:
|
|
822
822
|
ms = self.cell_factor_effect[factor_idx]([zns, perturb])
|
|
@@ -855,11 +855,35 @@ class SURE(nn.Module):
|
|
|
855
855
|
ps = convert_to_tensor(perturb, device=self.get_device())
|
|
856
856
|
|
|
857
857
|
if type(factor_idx) == str:
|
|
858
|
-
factor_idx = np.where(self.cell_factor_names==factor_idx)
|
|
858
|
+
factor_idx = int(np.where(self.cell_factor_names==factor_idx)[0])
|
|
859
859
|
|
|
860
860
|
ms = self.cell_factor_effect[factor_idx]([zs,ps])
|
|
861
861
|
return tensor_to_numpy(ms)
|
|
862
862
|
|
|
863
|
+
def _get_expression_responses(self, delta_zs):
|
|
864
|
+
return self.decoder_concentrate(delta_zs)
|
|
865
|
+
|
|
866
|
+
def get_expression_responses(self,
|
|
867
|
+
delta_zs,
|
|
868
|
+
batch_size: int = 1024):
|
|
869
|
+
"""
|
|
870
|
+
Return cells' changes in the latent space induced by specific perturbation of a factor
|
|
871
|
+
|
|
872
|
+
"""
|
|
873
|
+
delta_zs = convert_to_tensor(delta_zs, device=self.get_device())
|
|
874
|
+
dataset = CustomDataset(delta_zs)
|
|
875
|
+
dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False)
|
|
876
|
+
|
|
877
|
+
R = []
|
|
878
|
+
with tqdm(total=len(dataloader), desc='', unit='batch') as pbar:
|
|
879
|
+
for delta_Z_batch, _ in dataloader:
|
|
880
|
+
r = self._cell_move(delta_Z_batch)
|
|
881
|
+
R.append(tensor_to_numpy(r))
|
|
882
|
+
pbar.update(1)
|
|
883
|
+
|
|
884
|
+
R = np.concatenate(R)
|
|
885
|
+
return R
|
|
886
|
+
|
|
863
887
|
def preprocess(self, xs, threshold=0):
|
|
864
888
|
if self.loss_func == 'bernoulli':
|
|
865
889
|
ad = sc.AnnData(xs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|