jsxlei/SCALEX

impute=True error

scottgigante-immunai opened this issue · 2 comments

Looks like a typo. If impute=True, you will always get this error unless True is a valid batch_id:

Traceback (most recent call last):
    adata = scalex.SCALEX(
  File "/usr/local/lib/python3.8/site-packages/scalex/function.py", line 191, in SCALEX
    adata.layers['impute'] = model.encodeBatch(testloader, out='impute', batch_id=impute, device=device, eval=eval)
  File "/usr/local/lib/python3.8/site-packages/scalex/net/vae.py", line 110, in encodeBatch
    batch_id = list(dataloader.dataset.adata.obs['batch'].cat.categories).index(batch_id)
ValueError: True is not in list

Thank you for pointing out this bug. The decoder of SCALEX is batch-specific, that means SCALEX can only impute one style of batch at a time. We expect the user use the name of batch as --impute batch_name, but if is True which will make it have no idea of which batch to choose. Now this bug has been fixed by setting batch_id = 0 if impute is not a batch_name otherwise will choose the specified batch name.
Here are two ways to solve this issue:

  1. install the latest version using pip install git+https://github.com/jsxlei/scalex.git, then run your orignal command.
  2. Specify the name of batch e.g. --impute batch_name without the need to update to the latest version.