SURE-tools 2.0.9__py3-none-any.whl → 2.1.0__py3-none-any.whl
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/PerturbFlow.py +1324 -0
- SURE/SURE.py +0 -47
- SURE/__init__.py +3 -2
- {sure_tools-2.0.9.dist-info → sure_tools-2.1.0.dist-info}/METADATA +1 -1
- {sure_tools-2.0.9.dist-info → sure_tools-2.1.0.dist-info}/RECORD +9 -8
- sure_tools-2.1.0.dist-info/entry_points.txt +3 -0
- sure_tools-2.0.9.dist-info/entry_points.txt +0 -2
- {sure_tools-2.0.9.dist-info → sure_tools-2.1.0.dist-info}/WHEEL +0 -0
- {sure_tools-2.0.9.dist-info → sure_tools-2.1.0.dist-info}/licenses/LICENSE +0 -0
- {sure_tools-2.0.9.dist-info → sure_tools-2.1.0.dist-info}/top_level.txt +0 -0
SURE/SURE.py
CHANGED
|
@@ -813,53 +813,6 @@ class SURE(nn.Module):
|
|
|
813
813
|
A = np.concatenate(A)
|
|
814
814
|
return A
|
|
815
815
|
|
|
816
|
-
def _cell_move(self, xs, factor_idx, perturb):
|
|
817
|
-
zns,_ = self.encoder_zn(xs)
|
|
818
|
-
if type(factor_idx) == str:
|
|
819
|
-
factor_idx = int(np.where(self.cell_factor_names==factor_idx)[0])
|
|
820
|
-
|
|
821
|
-
if perturb.ndim==2:
|
|
822
|
-
ms = self.cell_factor_effect[factor_idx]([zns, perturb])
|
|
823
|
-
else:
|
|
824
|
-
ms = self.cell_factor_effect[factor_idx]([zns, perturb.reshape(-1,1)])
|
|
825
|
-
|
|
826
|
-
return ms
|
|
827
|
-
|
|
828
|
-
def get_cell_move(self,
|
|
829
|
-
xs,
|
|
830
|
-
factor_idx,
|
|
831
|
-
perturb,
|
|
832
|
-
batch_size: int = 1024):
|
|
833
|
-
"""
|
|
834
|
-
Return cells' changes in the latent space induced by specific perturbation of a factor
|
|
835
|
-
|
|
836
|
-
"""
|
|
837
|
-
xs = self.preprocess(xs)
|
|
838
|
-
xs = convert_to_tensor(xs, device=self.get_device())
|
|
839
|
-
ps = convert_to_tensor(perturb, device=self.get_device())
|
|
840
|
-
dataset = CustomDataset2(xs,ps)
|
|
841
|
-
dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False)
|
|
842
|
-
|
|
843
|
-
Z = []
|
|
844
|
-
with tqdm(total=len(dataloader), desc='', unit='batch') as pbar:
|
|
845
|
-
for X_batch, P_batch, _ in dataloader:
|
|
846
|
-
zns = self._cell_move(X_batch, factor_idx, P_batch)
|
|
847
|
-
Z.append(tensor_to_numpy(zns))
|
|
848
|
-
pbar.update(1)
|
|
849
|
-
|
|
850
|
-
Z = np.concatenate(Z)
|
|
851
|
-
return Z
|
|
852
|
-
|
|
853
|
-
def get_metacell_move(self, factor_idx, perturb):
|
|
854
|
-
zs = self._get_codebook()
|
|
855
|
-
ps = convert_to_tensor(perturb, device=self.get_device())
|
|
856
|
-
|
|
857
|
-
if type(factor_idx) == str:
|
|
858
|
-
factor_idx = int(np.where(self.cell_factor_names==factor_idx)[0])
|
|
859
|
-
|
|
860
|
-
ms = self.cell_factor_effect[factor_idx]([zs,ps])
|
|
861
|
-
return tensor_to_numpy(ms)
|
|
862
|
-
|
|
863
816
|
def preprocess(self, xs, threshold=0):
|
|
864
817
|
if self.loss_func == 'bernoulli':
|
|
865
818
|
ad = sc.AnnData(xs)
|
SURE/__init__.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from .SURE import SURE
|
|
2
|
-
from .
|
|
2
|
+
from .PerturbFlow import PerturbFlow
|
|
3
3
|
|
|
4
4
|
from . import utils
|
|
5
5
|
from . import codebook
|
|
6
6
|
from . import SURE
|
|
7
|
+
from . import PerturbFlow
|
|
7
8
|
from . import atac
|
|
8
9
|
from . import flow
|
|
9
10
|
|
|
10
|
-
__all__ = ['SURE', 'flow', 'atac', 'utils', 'codebook']
|
|
11
|
+
__all__ = ['SURE', 'PerturbFlow', 'flow', 'atac', 'utils', 'codebook']
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
SURE/
|
|
1
|
+
SURE/PerturbFlow.py,sha256=ko6DcOoO-IUEm736n689jmtJSHM_s2hafG-yUmflNSU,52019
|
|
2
|
+
SURE/SURE.py,sha256=OmwmA8RnhwrirXgnzqJMxv1BCr1jmjfHitvlmBKhHNA,49245
|
|
2
3
|
SURE/SURE2.py,sha256=8wlnMwb1xuf9QUksNkWdWx5ZWq-xIy9NLx8RdUnE82o,48501
|
|
3
|
-
SURE/__init__.py,sha256=
|
|
4
|
+
SURE/__init__.py,sha256=xV10iBbh69g4mjBMb1cQxjuHe8e3Aq7pDzkZmx5G754,260
|
|
4
5
|
SURE/assembly/__init__.py,sha256=jxZLURXKPzXe21LhrZ09LgZr33iqdjlQy4oSEj5gR2Q,172
|
|
5
6
|
SURE/assembly/assembly.py,sha256=6IMdelPOiRO4mUb4dC7gVCoF1Uvfw86-Map8P_jnUag,21477
|
|
6
7
|
SURE/assembly/atlas.py,sha256=ALjmVWutm_tOHTcT1aqOxmuCEQw-XzrtDoMCV_8oXLk,21794
|
|
@@ -15,9 +16,9 @@ SURE/utils/__init__.py,sha256=Htqv4KqVKcRiaaTBsR-6yZ4LSlbhbzutjNKXGD9-uds,660
|
|
|
15
16
|
SURE/utils/custom_mlp.py,sha256=07TYX1HgxfEjb_3i5MpiZfNhOhx3dKntuwGkrpteWiM,7036
|
|
16
17
|
SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
|
|
17
18
|
SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
|
|
18
|
-
sure_tools-2.0.
|
|
19
|
-
sure_tools-2.0.
|
|
20
|
-
sure_tools-2.0.
|
|
21
|
-
sure_tools-2.0.
|
|
22
|
-
sure_tools-2.0.
|
|
23
|
-
sure_tools-2.0.
|
|
19
|
+
sure_tools-2.1.0.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
|
|
20
|
+
sure_tools-2.1.0.dist-info/METADATA,sha256=bH8ARqqdk2bnLC5rk8MvPgBVAb8kaEKnzuHwyyDXpvE,2650
|
|
21
|
+
sure_tools-2.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
sure_tools-2.1.0.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
|
|
23
|
+
sure_tools-2.1.0.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
|
|
24
|
+
sure_tools-2.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|