How to transfer annotation from cell subset to original object?

Hi,

I can not find an answer to this anywhere, so I create a post, hope you can help me.

I am a beginner in bioinformatics and single cell analysis.

I have a large dataset of immune cells from two types of tissues that is difficult to annotate on the full object, so I subsetted to groups of cells (T-cells, B-cells, Myeloid cells etc.) and recluster and then annotate these. But I want to show the annotations on the full dataset. How do I transfer the annotations I have made back to the un-subsetted object?

Thank you!

Hi @maisom,

I suggest to extract the column that contains the annotations from the obs dataframe of teh AnnData object or from the GeoDataFrame object used for shapes (this depends on where you are storing the annotations) and to transfer such column to the full table/shapes obejct using pd.merge (using the instance_key column as key for the merge).

The instance_key column can be retrieved using get_table_keys().