Skip to content

Commit

Permalink
Merge pull request #87 from theislab/batch_corr_labels
Browse files Browse the repository at this point in the history
  • Loading branch information
M0hammadL authored Oct 1, 2023
2 parents 0608477 + bdb646c commit d79e1f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scgen/_scgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def batch_removal(self, adata: Optional[AnnData] = None) -> AnnData:
corrected = AnnData(
self.module.generative(torch.Tensor(all_shared_ann.X))["px"]
.cpu()
.detach()
.numpy(),
obs=all_shared_ann.obs,
)
Expand All @@ -283,7 +284,7 @@ def batch_removal(self, adata: Optional[AnnData] = None) -> AnnData:
adata_raw = AnnData(X=adata.raw.X, var=adata.raw.var)
adata_raw.obs_names = adata.obs_names
corrected.raw = adata_raw
corrected.obsm["latent"] = all_shared_ann.X
corrected.obsm["latent"] = all_shared_ann[corrected.obs_names,:].X
corrected.obsm["corrected_latent"] = self.get_latent_representation(
corrected
)
Expand All @@ -303,6 +304,7 @@ def batch_removal(self, adata: Optional[AnnData] = None) -> AnnData:
corrected = AnnData(
self.module.generative(torch.Tensor(all_corrected_data.X))["px"]
.cpu()
.detach()
.numpy(),
obs=all_corrected_data.obs,
)
Expand All @@ -312,7 +314,7 @@ def batch_removal(self, adata: Optional[AnnData] = None) -> AnnData:
adata_raw = AnnData(X=adata.raw.X, var=adata.raw.var)
adata_raw.obs_names = adata.obs_names
corrected.raw = adata_raw
corrected.obsm["latent"] = all_corrected_data.X
corrected.obsm["latent"] = all_corrected_data[corrected.obs_names,:].X
corrected.obsm["corrected_latent"] = self.get_latent_representation(
corrected
)
Expand Down

0 comments on commit d79e1f0

Please sign in to comment.