I have processed a Seurat scRNAseq object with the CellTypist package (Jupyter Notebook) to annotate immune cell types. I managed to export the predicted cell labels as a CSV. I have read this into R and would like to merge the results as an Idents column in the Seurat object metadata.
However, when I use the AddMetaData
function and view the merged object metadata, all of the new labels are listed as 'N/A' (they had the correct labels when I checked the csv). They share the exact same row labels as the original Seurat object, which is the cell identifier barcode. The headings from the csv have also transferred across correctly, as their own Idents columns. The two objects (the Seurat object and the csv) are also of the same length. Something seems to be going wrong when I merge them together.
The code I am using is this:
meta.data = read.csv("predicted_labels.csv")
Tum_July_new <- AddMetaData(object = Tum_July, metadata = meta.data)