SURE-tools 2.4.38__tar.gz → 2.4.42__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.
Potentially problematic release.
This version of SURE-tools might be problematic. Click here for more details.
- {sure_tools-2.4.38 → sure_tools-2.4.42}/PKG-INFO +1 -1
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/DensityFlow.py +9 -7
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/PKG-INFO +1 -1
- {sure_tools-2.4.38 → sure_tools-2.4.42}/setup.py +1 -1
- {sure_tools-2.4.38 → sure_tools-2.4.42}/LICENSE +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/README.md +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/DensityFlowLinear.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/EfficientTranscriptomeDecoder.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/PerturbE.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/PerturbationAwareDecoder.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/SURE.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/SimpleTranscriptomeDecoder.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/TranscriptomeDecoder.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/VirtualCellDecoder.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/assembly/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/assembly/assembly.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/assembly/atlas.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/atac/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/atac/utils.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/codebook/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/codebook/codebook.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/flow/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/flow/flow_stats.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/flow/plot_quiver.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/perturb/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/perturb/perturb.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/utils/__init__.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/utils/custom_mlp.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/utils/queue.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE/utils/utils.py +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/SOURCES.txt +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/dependency_links.txt +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/entry_points.txt +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/requires.txt +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/SURE_tools.egg-info/top_level.txt +0 -0
- {sure_tools-2.4.38 → sure_tools-2.4.42}/setup.cfg +0 -0
|
@@ -57,7 +57,7 @@ def set_random_seed(seed):
|
|
|
57
57
|
class DensityFlow(nn.Module):
|
|
58
58
|
def __init__(self,
|
|
59
59
|
input_size: int,
|
|
60
|
-
codebook_size: int =
|
|
60
|
+
codebook_size: int = 30,
|
|
61
61
|
cell_factor_size: int = 0,
|
|
62
62
|
turn_off_cell_specific: bool = False,
|
|
63
63
|
supervised_mode: bool = False,
|
|
@@ -113,6 +113,7 @@ class DensityFlow(nn.Module):
|
|
|
113
113
|
self.setup_networks()
|
|
114
114
|
|
|
115
115
|
print(f"🧬 DensityFlow Initialized:")
|
|
116
|
+
print(f" - Codebook size: {self.code_size}")
|
|
116
117
|
print(f" - Latent Dimension: {self.latent_dim}")
|
|
117
118
|
print(f" - Gene Dimension: {self.input_size}")
|
|
118
119
|
print(f" - Hidden Dimensions: {self.hidden_layers}")
|
|
@@ -397,7 +398,7 @@ class DensityFlow(nn.Module):
|
|
|
397
398
|
rate = theta * torch.sum(xs, dim=1, keepdim=True)
|
|
398
399
|
|
|
399
400
|
if self.loss_func == 'negbinomial':
|
|
400
|
-
logits = (mu.log()-dispersion.log()).clamp(min=-
|
|
401
|
+
logits = (mu.log()-dispersion.log()).clamp(min=-10, max=10)
|
|
401
402
|
if self.use_zeroinflate:
|
|
402
403
|
pyro.sample('x', dist.ZeroInflatedDistribution(dist.NegativeBinomial(total_count=dispersion,
|
|
403
404
|
logits=logits),gate_logits=gate_logits).to_event(1), obs=xs)
|
|
@@ -486,7 +487,7 @@ class DensityFlow(nn.Module):
|
|
|
486
487
|
rate = theta * torch.sum(xs, dim=1, keepdim=True)
|
|
487
488
|
|
|
488
489
|
if self.loss_func == 'negbinomial':
|
|
489
|
-
logits = (mu.log()-dispersion.log()).clamp(min=-
|
|
490
|
+
logits = (mu.log()-dispersion.log()).clamp(min=-10, max=10)
|
|
490
491
|
if self.use_zeroinflate:
|
|
491
492
|
pyro.sample('x', dist.ZeroInflatedDistribution(dist.NegativeBinomial(total_count=dispersion, logits=logits),gate_logits=gate_logits).to_event(1), obs=xs)
|
|
492
493
|
else:
|
|
@@ -585,7 +586,7 @@ class DensityFlow(nn.Module):
|
|
|
585
586
|
rate = theta * torch.sum(xs, dim=1, keepdim=True)
|
|
586
587
|
|
|
587
588
|
if self.loss_func == 'negbinomial':
|
|
588
|
-
logits = (mu.log()-dispersion.log()).clamp(min=-
|
|
589
|
+
logits = (mu.log()-dispersion.log()).clamp(min=-10, max=10)
|
|
589
590
|
if self.use_zeroinflate:
|
|
590
591
|
pyro.sample('x', dist.ZeroInflatedDistribution(dist.NegativeBinomial(total_count=dispersion,
|
|
591
592
|
logits=logits),gate_logits=gate_logits).to_event(1), obs=xs)
|
|
@@ -695,7 +696,7 @@ class DensityFlow(nn.Module):
|
|
|
695
696
|
rate = theta * torch.sum(xs, dim=1, keepdim=True)
|
|
696
697
|
|
|
697
698
|
if self.loss_func == 'negbinomial':
|
|
698
|
-
logits = (mu.log()-dispersion.log()).clamp(min=-
|
|
699
|
+
logits = (mu.log()-dispersion.log()).clamp(min=-10, max=10)
|
|
699
700
|
if self.use_zeroinflate:
|
|
700
701
|
pyro.sample('x', dist.ZeroInflatedDistribution(dist.NegativeBinomial(total_count=dispersion,
|
|
701
702
|
logits=logits),gate_logits=gate_logits).to_event(1), obs=xs)
|
|
@@ -774,7 +775,7 @@ class DensityFlow(nn.Module):
|
|
|
774
775
|
Z = []
|
|
775
776
|
with tqdm(total=len(dataloader), desc='', unit='batch') as pbar:
|
|
776
777
|
for X_batch, U_batch, _ in dataloader:
|
|
777
|
-
zns = self.
|
|
778
|
+
zns = self._get_complete_embedding(X_batch, U_batch)
|
|
778
779
|
Z.append(tensor_to_numpy(zns))
|
|
779
780
|
pbar.update(1)
|
|
780
781
|
|
|
@@ -1030,7 +1031,7 @@ class DensityFlow(nn.Module):
|
|
|
1030
1031
|
ad = sc.AnnData(xs)
|
|
1031
1032
|
binarize(ad, threshold=threshold)
|
|
1032
1033
|
xs = ad.X.copy()
|
|
1033
|
-
|
|
1034
|
+
elif self.loss_func == 'poisson':
|
|
1034
1035
|
xs = np.round(xs)
|
|
1035
1036
|
|
|
1036
1037
|
if sparse.issparse(xs):
|
|
@@ -1193,6 +1194,7 @@ class DensityFlow(nn.Module):
|
|
|
1193
1194
|
model = pickle.load(pickle_file)
|
|
1194
1195
|
|
|
1195
1196
|
print(f"🧬 DensityFlow Initialized:")
|
|
1197
|
+
print(f" - Codebook size: {model.code_size}")
|
|
1196
1198
|
print(f" - Latent Dimension: {model.latent_dim}")
|
|
1197
1199
|
print(f" - Gene Dimension: {model.input_size}")
|
|
1198
1200
|
print(f" - Hidden Dimensions: {model.hidden_layers}")
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|