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.
Files changed (26) hide show
  1. {sure_tools-2.0.8 → sure_tools-2.0.10}/PKG-INFO +1 -1
  2. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/SURE.py +26 -2
  3. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/PKG-INFO +1 -1
  4. {sure_tools-2.0.8 → sure_tools-2.0.10}/setup.py +1 -1
  5. {sure_tools-2.0.8 → sure_tools-2.0.10}/LICENSE +0 -0
  6. {sure_tools-2.0.8 → sure_tools-2.0.10}/README.md +0 -0
  7. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/__init__.py +0 -0
  8. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/__init__.py +0 -0
  9. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/assembly.py +0 -0
  10. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/assembly/atlas.py +0 -0
  11. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/atac/__init__.py +0 -0
  12. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/atac/utils.py +0 -0
  13. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/codebook/__init__.py +0 -0
  14. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/codebook/codebook.py +0 -0
  15. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/flow/__init__.py +0 -0
  16. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/flow/plot_quiver.py +0 -0
  17. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/__init__.py +0 -0
  18. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/custom_mlp.py +0 -0
  19. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/queue.py +0 -0
  20. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE/utils/utils.py +0 -0
  21. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/SOURCES.txt +0 -0
  22. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/dependency_links.txt +0 -0
  23. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/entry_points.txt +0 -0
  24. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/requires.txt +0 -0
  25. {sure_tools-2.0.8 → sure_tools-2.0.10}/SURE_tools.egg-info/top_level.txt +0 -0
  26. {sure_tools-2.0.8 → sure_tools-2.0.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.0.8
3
+ Version: 2.0.10
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.0.8
3
+ Version: 2.0.10
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name='SURE-tools',
8
- version='2.0.8',
8
+ version='2.0.10',
9
9
  description='Succinct Representation of Single Cells',
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes