Skip to content

Commit

Permalink
Merge pull request #48 from Mye-InfoBank/solo-on-small-batches
Browse files Browse the repository at this point in the history
Fix bug with SOLO if batch size is smaller than 128
  • Loading branch information
nictru authored Feb 23, 2024
2 parents a156b0a + c2d8cfa commit 53740ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/solo.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ process SOLO {
adata = sc.read_h5ad("${adata}")
adata_batch = adata[adata.obs.batch == "${batch}"]
batch_size = len(adata_batch)
if batch_size < 128:
print(f"Batch size too small ({batch_size}), skipping SOLO")
solo_res = pd.DataFrame(index=adata_batch.obs.index)
solo_res["doublet_label"] = "Unknown"
solo_res.to_pickle("${new_meta.id}.solo.pkl")
exit(0)
if ${has_celltypes ? "True" : "False"}:
scvi.model.SCANVI.setup_anndata(adata, batch_key="batch", labels_key="cell_type", unlabeled_category="Unknown")
scvi_model = scvi.model.SCANVI.load("${scvi_model}", adata=adata)
Expand Down

0 comments on commit 53740ad

Please sign in to comment.