theislab / scgen

Single cell perturbation prediction
https://scgen.readthedocs.io
GNU General Public License v3.0
260 stars 52 forks source link

Add annotations to corrected object #7

Closed cartal closed 5 years ago

cartal commented 5 years ago

Hi @falexwolf and @M0hammadL ,

Thanks very much for developing this tool. Is giving me amazing results!

However, right now I have an issue. The tool takes batch and cell_types as main labels, then I run this as in your notebook and everything works nicely. However, whenever I try to add a new set of lables as follows:

adata_hvg_scGen = adata_hvg.copy() adata_hvg_scGen.obs["batch"] = adata_hvg.obs["source"].tolist() adata_hvg_scGen.obs["cell_type"] = adata_hvg.obs["leiden"].tolist() adata_hvg_scGen.obs["location"] = adata_hvg.obs["location"].tolist() adata_hvg_scGen.obs["method"] = adata_hvg.obs["method"].tolist()

the labels are all jumbled around and they don't correspond in the UMAP. I also noticed that the index is removed from after applying adata_corrected = scgen.batch_removal(adata_network, adata_hvg_scGen)

Do you know how to solve this?

Thanks

M0hammadL commented 5 years ago

Hi . Thanks for your feedback and sorry for late reply:( We added two new parameters to batch_removal(network, adata, batch_key="batch", cell_label_key="cell_type"). Therefore, now you can set batch_key and cell_label_key according to your labels in adata. Regarding the index, we added a new line to code https://github.com/theislab/scgen/blob/22dcc45c7397759e502aed818e16973fe5040180/scgen/models/util.py#L315 that should fix this issue.

Let me know if it works for you. Mo

cartal commented 4 years ago

It did! Thanks