Transferring labels from combined embedding back to query with scArches

I am following this tutorial to query the HCLA so that I can get cell labels.

Unless I’m missing it, I can’t figure out how it is recommended to transfer the cell labels in the combined embedding back to my query anndata object.

Is there a recommended way do this? I apologize if this is a very simple python question- I am still learning!


Hi, thank you for your question. If I’m understanding your question correctly, you can do this as follows:

for key in [l + "_pred" for l in label_keys]:
    query_data.obs[key] = query_emb.obs[key]

since combined_emb is just the concatenation of ref_emb and query_emb. Hope this helps!

Thank you, that works great!