SOLO - channel vs batch

As per the guide

scvi.data.setup_anndata(adata, batch_key=“batch”)
vae = scvi.model.SCVI(adata)
vae.train()
solo_batch_1 = scvi.external.SOLO.from_scvi_model(vae, restrict_to_batch=“batch 1”)

but what if you want to use a batch term in the model that is not the microfluidics channel (i.e processing batch, etc… because individual channels might be technical replicates of each other) ,
but then want to restrict the SOLO analysis to individual channels?

What would be the reason not to use the channels as the batch category in setup_anndata?

If i have an experiment where I have batches each containing multiple microfluidics channels that are technical replicates of each other, or are similar in that they are multiplexed in different mixture patterns but all processed together, then the batch key would be the sets of channels rather than individual channels - at least for downstream clustering etc…
So I am assuming here that it would be desirable to use the same model for clustering/annotation etc and for doublet filtering.
You could of course train a separate model with batch=channel for doublet filtering.
I am just wondering if it is worth or desirable to add additional flexibility into scvi.external.SOLO.from_scvi_model ()

If I’m understanding correctly, can’t you use the adata parameter of from_scvi_model()? And use it by giving a subset of the cells (corresponding to one channel) for the batch used in restrict_to_batch?

If i want to use the same model for getting a latent space → clustering etc… and for doing doublet detection with solo, I may not want the batch to be channel. I may want it to be a batch term that includes a number of channels. but solo should be run on individual channels.

scvi.external.SOLO.from_scvi_model(vae, restrict_to_batch=“channel1”)

Limits you to using the batch key you used in the initial model which may not be the channel.

Right, so I’m suggesting you

scvi.external.SOLO.from_scvi_model(vae, restrict_to_batch=“batch1”, adata=adata[adata.obs["channel"] == "1"].copy())

This is a workaround that looks like it would work.
Thanks,

Please be sure to update to the newest version as this parameter didn’t work properly before!