SURE-tools 2.2.12__tar.gz → 2.2.15__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.2.12 → sure_tools-2.2.15}/PKG-INFO +1 -1
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/DensityFlow.py +15 -20
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/PKG-INFO +1 -1
- {sure_tools-2.2.12 → sure_tools-2.2.15}/setup.py +1 -1
- {sure_tools-2.2.12 → sure_tools-2.2.15}/LICENSE +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/README.md +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/SURE.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/assembly/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/assembly/assembly.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/assembly/atlas.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/atac/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/atac/utils.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/codebook/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/codebook/codebook.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/flow/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/flow/flow_stats.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/flow/plot_quiver.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/perturb/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/perturb/perturb.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/utils/__init__.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/utils/custom_mlp.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/utils/queue.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE/utils/utils.py +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/SOURCES.txt +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/dependency_links.txt +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/entry_points.txt +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/requires.txt +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/SURE_tools.egg-info/top_level.txt +0 -0
- {sure_tools-2.2.12 → sure_tools-2.2.15}/setup.cfg +0 -0
|
@@ -696,7 +696,7 @@ class DensityFlow(nn.Module):
|
|
|
696
696
|
"""
|
|
697
697
|
Return the mean part of metacell codebook
|
|
698
698
|
"""
|
|
699
|
-
cb = self.
|
|
699
|
+
cb = self._get_codebook()
|
|
700
700
|
cb = tensor_to_numpy(cb)
|
|
701
701
|
return cb
|
|
702
702
|
|
|
@@ -842,47 +842,42 @@ class DensityFlow(nn.Module):
|
|
|
842
842
|
|
|
843
843
|
return counts, zs
|
|
844
844
|
|
|
845
|
-
def _cell_response(self,
|
|
845
|
+
def _cell_response(self, zs, perturb_idx, perturb):
|
|
846
846
|
#zns,_ = self.encoder_zn(xs)
|
|
847
|
-
zns,_ = self._get_basal_embedding(xs)
|
|
847
|
+
#zns,_ = self._get_basal_embedding(xs)
|
|
848
|
+
zns = zs
|
|
848
849
|
if perturb.ndim==2:
|
|
849
|
-
ms = self.cell_factor_effect[
|
|
850
|
+
ms = self.cell_factor_effect[perturb_idx]([zns, perturb])
|
|
850
851
|
else:
|
|
851
|
-
ms = self.cell_factor_effect[
|
|
852
|
+
ms = self.cell_factor_effect[perturb_idx]([zns, perturb.reshape(-1,1)])
|
|
852
853
|
|
|
853
854
|
return ms
|
|
854
855
|
|
|
855
856
|
def get_cell_response(self,
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
857
|
+
zs,
|
|
858
|
+
perturb_idx,
|
|
859
|
+
perturb_us,
|
|
859
860
|
batch_size: int = 1024):
|
|
860
861
|
"""
|
|
861
862
|
Return cells' changes in the latent space induced by specific perturbation of a factor
|
|
862
863
|
|
|
863
864
|
"""
|
|
864
|
-
xs = self.preprocess(xs)
|
|
865
|
-
|
|
866
|
-
ps = convert_to_tensor(
|
|
867
|
-
dataset = CustomDataset2(
|
|
865
|
+
#xs = self.preprocess(xs)
|
|
866
|
+
zs = convert_to_tensor(zs, device=self.get_device())
|
|
867
|
+
ps = convert_to_tensor(perturb_us, device=self.get_device())
|
|
868
|
+
dataset = CustomDataset2(zs,ps)
|
|
868
869
|
dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False)
|
|
869
870
|
|
|
870
871
|
Z = []
|
|
871
872
|
with tqdm(total=len(dataloader), desc='', unit='batch') as pbar:
|
|
872
|
-
for
|
|
873
|
-
zns = self._cell_response(
|
|
873
|
+
for Z_batch, P_batch, _ in dataloader:
|
|
874
|
+
zns = self._cell_response(Z_batch, perturb_idx, P_batch)
|
|
874
875
|
Z.append(tensor_to_numpy(zns))
|
|
875
876
|
pbar.update(1)
|
|
876
877
|
|
|
877
878
|
Z = np.concatenate(Z)
|
|
878
879
|
return Z
|
|
879
880
|
|
|
880
|
-
def get_metacell_response(self, factor_idx, perturb):
|
|
881
|
-
zs = self._get_codebook()
|
|
882
|
-
ps = convert_to_tensor(perturb, device=self.get_device())
|
|
883
|
-
ms = self.cell_factor_effect[factor_idx]([zs,ps])
|
|
884
|
-
return tensor_to_numpy(ms)
|
|
885
|
-
|
|
886
881
|
def _get_expression_response(self, delta_zs):
|
|
887
882
|
return self.decoder_concentrate(delta_zs)
|
|
888
883
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|