SURE-tools 2.1.79__py3-none-any.whl → 2.1.80__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.
Potentially problematic release.
This version of SURE-tools might be problematic. Click here for more details.
- SURE/PerturbFlow.py +30 -0
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/METADATA +1 -1
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/RECORD +7 -7
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/WHEEL +0 -0
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/entry_points.txt +0 -0
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/licenses/LICENSE +0 -0
- {sure_tools-2.1.79.dist-info → sure_tools-2.1.80.dist-info}/top_level.txt +0 -0
SURE/PerturbFlow.py
CHANGED
|
@@ -807,6 +807,36 @@ class PerturbFlow(nn.Module):
|
|
|
807
807
|
A = np.concatenate(A)
|
|
808
808
|
return A
|
|
809
809
|
|
|
810
|
+
def predict(self, xs, us, perturbs_predict:list, perturbs_reference:list, library_sizes=None):
|
|
811
|
+
perturbs_reference = np.array(perturbs_reference)
|
|
812
|
+
|
|
813
|
+
# basal embedding
|
|
814
|
+
zs = self.get_basal_embedding(xs)
|
|
815
|
+
for pert in perturbs_predict:
|
|
816
|
+
pert_idx = np.where(perturbs_reference==pert)[0]
|
|
817
|
+
us_i = us[:,pert_idx].reshape(-1,1)
|
|
818
|
+
|
|
819
|
+
# factor effect of xs
|
|
820
|
+
dzs0 = self.get_cell_response(xs, factor_idx=pert_idx, perturb=us_i)
|
|
821
|
+
|
|
822
|
+
# perturbation effect
|
|
823
|
+
ps = np.ones_like(us_i)
|
|
824
|
+
dzs = self.get_cell_response(xs, factor_idx=pert_idx, perturb=ps)
|
|
825
|
+
|
|
826
|
+
zs = zs + dzs0 + dzs
|
|
827
|
+
|
|
828
|
+
if library_sizes is None:
|
|
829
|
+
library_sizes = np.sum(xs, axis=1, keepdims=True)
|
|
830
|
+
elif type(library_sizes) == list:
|
|
831
|
+
library_sizes = np.array(library_sizes)
|
|
832
|
+
library_sizes = library_sizes.reshape(-1,1)
|
|
833
|
+
elif len(library_sizes.shape)==1:
|
|
834
|
+
library_sizes = library_sizes.reshape(-1,1)
|
|
835
|
+
|
|
836
|
+
counts = self.get_counts(zs, library_sizes=library_sizes)
|
|
837
|
+
|
|
838
|
+
return counts, zs
|
|
839
|
+
|
|
810
840
|
def _cell_response(self, xs, factor_idx, perturb):
|
|
811
841
|
#zns,_ = self.encoder_zn(xs)
|
|
812
842
|
zns,_ = self._get_basal_embedding(xs)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
SURE/PerturbFlow.py,sha256=
|
|
1
|
+
SURE/PerturbFlow.py,sha256=BGhwVTFWhMpEe54-U0tf7-V9k2aqdKRd4NO48LOZPSA,54572
|
|
2
2
|
SURE/SURE.py,sha256=g8EhovBxjfpbVJA0AkmVkQ_ZW_JFc8TtkTCg8FCybV4,47750
|
|
3
3
|
SURE/__init__.py,sha256=NOJI_K-eCqPgStXXvgl3wIEMp6d8saMTDYLJ7Ga9MqE,293
|
|
4
4
|
SURE/assembly/__init__.py,sha256=jxZLURXKPzXe21LhrZ09LgZr33iqdjlQy4oSEj5gR2Q,172
|
|
@@ -17,9 +17,9 @@ SURE/utils/__init__.py,sha256=YF5jB-PAHJQ40OlcZ7BCZbsN2q1JKuPT6EppilRXQqM,680
|
|
|
17
17
|
SURE/utils/custom_mlp.py,sha256=C0EXLGYsWkUQpEL49AyBFPSzKmasb2hdvtnJfxbF-YU,9282
|
|
18
18
|
SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
|
|
19
19
|
SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
|
|
20
|
-
sure_tools-2.1.
|
|
21
|
-
sure_tools-2.1.
|
|
22
|
-
sure_tools-2.1.
|
|
23
|
-
sure_tools-2.1.
|
|
24
|
-
sure_tools-2.1.
|
|
25
|
-
sure_tools-2.1.
|
|
20
|
+
sure_tools-2.1.80.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
|
|
21
|
+
sure_tools-2.1.80.dist-info/METADATA,sha256=kwL5xVX41xll6f89ewJ9T1qtVgFQFF8SP_Hb9sxGZPg,2678
|
|
22
|
+
sure_tools-2.1.80.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
sure_tools-2.1.80.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
|
|
24
|
+
sure_tools-2.1.80.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
|
|
25
|
+
sure_tools-2.1.80.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|