flexynesis 0.2.0__tar.gz → 0.2.1__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 (32) hide show
  1. {flexynesis-0.2.0 → flexynesis-0.2.1}/PKG-INFO +1 -1
  2. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/data.py +8 -0
  3. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/__init__.py +0 -1
  4. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/gnn_early.py +26 -17
  5. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/PKG-INFO +1 -1
  6. {flexynesis-0.2.0 → flexynesis-0.2.1}/pyproject.toml +1 -1
  7. {flexynesis-0.2.0 → flexynesis-0.2.1}/LICENCE.md +0 -0
  8. {flexynesis-0.2.0 → flexynesis-0.2.1}/README.md +0 -0
  9. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/__init__.py +0 -0
  10. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/__main__.py +0 -0
  11. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/cli.py +0 -0
  12. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/config.py +0 -0
  13. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/feature_selection.py +0 -0
  14. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/main.py +0 -0
  15. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/crossmodal_pred.py +0 -0
  16. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/direct_pred.py +0 -0
  17. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/on_ice/direct_pred_cnn.py +0 -0
  18. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/on_ice/direct_pred_gcnn.py +0 -0
  19. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/on_ice/modules_on_ice.py +0 -0
  20. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/supervised_vae.py +0 -0
  21. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/models/triplet_encoder.py +0 -0
  22. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/modules.py +0 -0
  23. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis/utils.py +0 -0
  24. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/SOURCES.txt +0 -0
  25. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/dependency_links.txt +0 -0
  26. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/entry_points.txt +0 -0
  27. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/requires.txt +0 -0
  28. {flexynesis-0.2.0 → flexynesis-0.2.1}/flexynesis.egg-info/top_level.txt +0 -0
  29. {flexynesis-0.2.0 → flexynesis-0.2.1}/setup.cfg +0 -0
  30. {flexynesis-0.2.0 → flexynesis-0.2.1}/tests/__init__.py +0 -0
  31. {flexynesis-0.2.0 → flexynesis-0.2.1}/tests/unit/__init__.py +0 -0
  32. {flexynesis-0.2.0 → flexynesis-0.2.1}/tests/unit/test_smoke.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flexynesis
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A deep-learning based multi-omics bulk sequencing data integration suite with a focus on (pre-)clinical endpoint prediction.
5
5
  Author-email: Bora Uyar <bora.uyar@mdc-berlin.de>, Taras Savchyn <Taras.Savchyn@mdc-berlin.de>, Ricardo Wurmus <Ricardo.Wurmus@mdc-berlin.de>, Ahmet Sarigun <Ahmet.Sariguen@mdc-berlin.de>
6
6
  Project-URL: homepage, https://github.com/BIMSBbioinfo/flexynesis
@@ -680,7 +680,15 @@ class MultiOmicDatasetNW(Dataset):
680
680
  if indices: # Ensure there are common features in this data type
681
681
  all_features[:, :, i] = data_matrix[:, indices]
682
682
  return all_features
683
+
684
+ def subset(self, indices):
685
+ # Create a subset of the main multiomic dataset
686
+ dataset_subset = self.multiomic_dataset.subset(indices)
683
687
 
688
+ # Create a new instance of MultiOmicDatasetNW with the subsetted multiomic dataset
689
+ return MultiOmicDatasetNW(dataset_subset, self.interaction_df.copy())
690
+
691
+
684
692
  def __getitem__(self, idx):
685
693
  node_features_tensor = self.node_features_tensor[idx]
686
694
  y_dict = {target_name: self.labels[target_name][idx] for target_name in self.labels}
@@ -3,5 +3,4 @@ from .supervised_vae import supervised_vae
3
3
  from .triplet_encoder import MultiTripletNetwork
4
4
  from .crossmodal_pred import CrossModalPred
5
5
  from .gnn_early import GNN
6
-
7
6
  __all__ = ["DirectPred", "supervised_vae", "MultiTripletNetwork", "CrossModalPred", "GNN"]
@@ -95,15 +95,16 @@ class GNN(pl.LightningModule):
95
95
  for var in self.variables:
96
96
  self.log_vars[var] = nn.Parameter(torch.zeros(1))
97
97
 
98
- self.encoders = flexGCN(
99
- node_count = dataset[0][0].shape[0], #number of nodes
100
- node_feature_count= dataset[0][0].shape[1], # number of node features
101
- node_embedding_dim=int(self.config["node_embedding_dim"]),
102
- num_convs = int(self.config['num_convs']), # Number of convolutional layers
103
- output_dim=self.config["latent_dim"],
104
- act = self.config['activation'],
105
- conv = self.gnn_conv_type
106
- )
98
+ self.encoders = nn.ModuleList([
99
+ flexGCN(
100
+ node_count = dataset[0][0].shape[0], #number of nodes
101
+ node_feature_count= dataset[0][0].shape[1], # number of node features
102
+ node_embedding_dim=int(self.config["node_embedding_dim"]),
103
+ num_convs = int(self.config['num_convs']), # Number of convolutional layers
104
+ output_dim=self.config["latent_dim"],
105
+ act = self.config['activation'],
106
+ conv = self.gnn_conv_type
107
+ )])
107
108
 
108
109
  # Init output layers
109
110
  self.MLPs = nn.ModuleDict()
@@ -129,14 +130,15 @@ class GNN(pl.LightningModule):
129
130
  Returns:
130
131
  dict: Outputs from the MLPs, one for each target variable.
131
132
  """
132
- embeddings = self.encoders(x, edge_index)
133
+ # notice we are using the first encoder (it is currently a early fusion method)
134
+ embeddings = self.encoders[0](x, edge_index)
133
135
  outputs = {}
134
136
  for var, mlp in self.MLPs.items():
135
137
  outputs[var] = mlp(embeddings)
136
138
  return outputs
137
139
 
138
140
 
139
- def training_step(self, batch):
141
+ def training_step(self, batch, batch_idx, log = True):
140
142
  """
141
143
  Performs a training step including loss calculation and logging.
142
144
 
@@ -164,10 +166,11 @@ class GNN(pl.LightningModule):
164
166
 
165
167
  total_loss = self.compute_total_loss(losses)
166
168
  losses["train_loss"] = total_loss
167
- self.log_dict(losses, on_step=False, on_epoch=True, prog_bar=True, batch_size=len(batch))
169
+ if log:
170
+ self.log_dict(losses, on_step=False, on_epoch=True, prog_bar=True, batch_size=len(batch))
168
171
  return total_loss
169
172
 
170
- def validation_step(self, batch):
173
+ def validation_step(self, batch, batch_idx, log = True):
171
174
  """
172
175
  Performs a validation step, computing losses for a batch of data.
173
176
 
@@ -194,7 +197,8 @@ class GNN(pl.LightningModule):
194
197
 
195
198
  total_loss = sum(losses.values())
196
199
  losses["val_loss"] = total_loss
197
- self.log_dict(losses, on_step=False, on_epoch=True, prog_bar=True, batch_size=len(batch))
200
+ if log:
201
+ self.log_dict(losses, on_step=False, on_epoch=True, prog_bar=True, batch_size=len(batch))
198
202
  return total_loss
199
203
 
200
204
  def configure_optimizers(self):
@@ -341,7 +345,8 @@ class GNN(pl.LightningModule):
341
345
  for x, y_dict, samples in dataloader:
342
346
  x = x.to(device) # Move data to GPU
343
347
 
344
- embeddings = self.encoders(x, edge_index).detach().cpu().numpy() # Compute embeddings and move to CPU
348
+ # notice we are using the first encoder (it is currently a early fusion method)
349
+ embeddings = self.encoders[0](x, edge_index).detach().cpu().numpy() # Compute embeddings and move to CPU
345
350
  all_embeddings.append(embeddings)
346
351
  sample_ids.extend(samples)
347
352
 
@@ -455,8 +460,12 @@ class GNN(pl.LightningModule):
455
460
  features = dataset.common_features
456
461
  target_class_label = dataset.label_mappings[target_var].get(i) if target_var in dataset.label_mappings else ''
457
462
  for l in range(len(layers)):
458
- # extracting node feature attributes coming from different omic layers
459
- importances = imp[i].squeeze().detach().numpy()[:,l]
463
+ # Extracting node feature attributes coming from different omic layers
464
+ importances_array = imp[i].squeeze().detach().numpy()
465
+ if importances_array.ndim == 1:
466
+ importances = importances_array # Use the array as is if it is 1-dimensional
467
+ else:
468
+ importances = importances_array[:, l] # Use the original indexing for 2D arrays
460
469
  df_list.append(pd.DataFrame({'target_variable': target_var,
461
470
  'target_class': i,
462
471
  'target_class_label': target_class_label,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flexynesis
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A deep-learning based multi-omics bulk sequencing data integration suite with a focus on (pre-)clinical endpoint prediction.
5
5
  Author-email: Bora Uyar <bora.uyar@mdc-berlin.de>, Taras Savchyn <Taras.Savchyn@mdc-berlin.de>, Ricardo Wurmus <Ricardo.Wurmus@mdc-berlin.de>, Ahmet Sarigun <Ahmet.Sariguen@mdc-berlin.de>
6
6
  Project-URL: homepage, https://github.com/BIMSBbioinfo/flexynesis
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flexynesis"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  authors = [
9
9
  {name = "Bora Uyar", email = "bora.uyar@mdc-berlin.de"},
10
10
  {name = "Taras Savchyn", email = "Taras.Savchyn@mdc-berlin.de"},
File without changes
File without changes
File without changes
File without changes
File without changes