SURE-tools 2.4.35__tar.gz → 2.4.39__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 (37) hide show
  1. {sure_tools-2.4.35 → sure_tools-2.4.39}/PKG-INFO +1 -1
  2. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/DensityFlow.py +33 -4
  3. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/PKG-INFO +1 -1
  4. {sure_tools-2.4.35 → sure_tools-2.4.39}/setup.py +1 -1
  5. {sure_tools-2.4.35 → sure_tools-2.4.39}/LICENSE +0 -0
  6. {sure_tools-2.4.35 → sure_tools-2.4.39}/README.md +0 -0
  7. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/DensityFlowLinear.py +0 -0
  8. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/EfficientTranscriptomeDecoder.py +0 -0
  9. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/PerturbE.py +0 -0
  10. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/PerturbationAwareDecoder.py +0 -0
  11. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/SURE.py +0 -0
  12. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/SimpleTranscriptomeDecoder.py +0 -0
  13. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/TranscriptomeDecoder.py +0 -0
  14. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/VirtualCellDecoder.py +0 -0
  15. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/__init__.py +0 -0
  16. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/assembly/__init__.py +0 -0
  17. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/assembly/assembly.py +0 -0
  18. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/assembly/atlas.py +0 -0
  19. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/atac/__init__.py +0 -0
  20. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/atac/utils.py +0 -0
  21. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/codebook/__init__.py +0 -0
  22. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/codebook/codebook.py +0 -0
  23. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/flow/__init__.py +0 -0
  24. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/flow/flow_stats.py +0 -0
  25. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/flow/plot_quiver.py +0 -0
  26. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/perturb/__init__.py +0 -0
  27. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/perturb/perturb.py +0 -0
  28. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/utils/__init__.py +0 -0
  29. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/utils/custom_mlp.py +0 -0
  30. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/utils/queue.py +0 -0
  31. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE/utils/utils.py +0 -0
  32. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/SOURCES.txt +0 -0
  33. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/dependency_links.txt +0 -0
  34. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/entry_points.txt +0 -0
  35. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/requires.txt +0 -0
  36. {sure_tools-2.4.35 → sure_tools-2.4.39}/SURE_tools.egg-info/top_level.txt +0 -0
  37. {sure_tools-2.4.35 → sure_tools-2.4.39}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.4.35
3
+ Version: 2.4.39
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -758,6 +758,28 @@ class DensityFlow(nn.Module):
758
758
  cb = self._get_codebook()
759
759
  cb = tensor_to_numpy(cb)
760
760
  return cb
761
+
762
+ def _get_complete_embedding(self, xs, us):
763
+ basal,_ = self._get_basal_embedding(xs)
764
+ dzs = self._total_effects(basal, us)
765
+ return basal + dzs
766
+
767
+ def get_complete_embedding(self, xs, us, batch_size:int=1024):
768
+ xs = self.preprocess(xs)
769
+ xs = convert_to_tensor(xs, device=self.get_device())
770
+ us = convert_to_tensor(us, device=self.get_device())
771
+ dataset = CustomDataset2(xs, us)
772
+ dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False)
773
+
774
+ Z = []
775
+ with tqdm(total=len(dataloader), desc='', unit='batch') as pbar:
776
+ for X_batch, U_batch, _ in dataloader:
777
+ zns = self._get_complete_embedding(X_batch, U_batch)
778
+ Z.append(tensor_to_numpy(zns))
779
+ pbar.update(1)
780
+
781
+ Z = np.concatenate(Z)
782
+ return Z
761
783
 
762
784
  def _get_basal_embedding(self, xs):
763
785
  loc, scale = self.encoder_zn(xs)
@@ -1142,7 +1164,7 @@ class DensityFlow(nn.Module):
1142
1164
  pbar.set_postfix({'loss': str_loss})
1143
1165
  pbar.update(1)
1144
1166
 
1145
- '''@classmethod
1167
+ @classmethod
1146
1168
  def save_model(cls, model, file_path, compression=False):
1147
1169
  """Save the model to the specified file path."""
1148
1170
  file_path = os.path.abspath(file_path)
@@ -1169,10 +1191,17 @@ class DensityFlow(nn.Module):
1169
1191
  else:
1170
1192
  with open(file_path, 'rb') as pickle_file:
1171
1193
  model = pickle.load(pickle_file)
1194
+
1195
+ print(f"🧬 DensityFlow Initialized:")
1196
+ print(f" - Latent Dimension: {model.latent_dim}")
1197
+ print(f" - Gene Dimension: {model.input_size}")
1198
+ print(f" - Hidden Dimensions: {model.hidden_layers}")
1199
+ print(f" - Device: {model.get_device()}")
1200
+ print(f" - Parameters: {sum(p.numel() for p in model.parameters()):,}")
1172
1201
 
1173
- return model'''
1202
+ return model
1174
1203
 
1175
- def save(self, path):
1204
+ ''' def save(self, path):
1176
1205
  """Save model checkpoint"""
1177
1206
  torch.save({
1178
1207
  'model_state_dict': self.state_dict(),
@@ -1209,7 +1238,7 @@ class DensityFlow(nn.Module):
1209
1238
  checkpoint = torch.load(model_path, map_location=model.get_device())
1210
1239
  model.load_state_dict(checkpoint['model_state_dict'])
1211
1240
 
1212
- return model
1241
+ return model'''
1213
1242
 
1214
1243
 
1215
1244
  EXAMPLE_RUN = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.4.35
3
+ Version: 2.4.39
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.4.35',
8
+ version='2.4.39',
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