Before I report this as a bug can someone show me the proper way to add metadata using the AddMetaData
function.
I first read a file that is new line delimited with the meta data labels I want using read table. The ftimecell_columns.txt file looks like this:
"12wks"
"12wks"
"12wks"
"12wks"
"12wks"
...
So I do this command to make the dataframe:
timecell_col <- read.table("~/Projects/FetalPancreas/timecell_columns.txt", header=FALSE, sep="\n")
and then this to AddMetaData:
AddMetaData(object = scfp, metadata = timecell_col, col.name = 'time.cell')
However, when I do:
head(x = scfp@meta.data)
All I see is the original meta data values:
orig.ident nCount_RNA nFeature_RNA
GSM2978830 scfetpan 382565 5080
GSM2978831 scfetpan 634726 4932
GSM2978832 scfetpan 565912 4501
GSM2978833 scfetpan 717152 5117
GSM2978834 scfetpan 207659 3508
GSM2978835 scfetpan 869148 5055
Am I reading the data in correctly?
Any help would be appreciated!
Very Respectfully, Pratik
That worked with scfp <- AddMetaData, Gosh, silly mistake... but now problem is the MetaData displays as NA NA NA NA NA... I think it could be a problem with how my dataframe is formatted, and the way Seurat wants it. swbarnes2, if you don't mind me asking when you're loading a data frame what does it look like? Do you have the data frame you're reading as column 1, and all the metadata as rows like I showed above with:
Or do you have them as the actual column names? What is the data frame format supposed to be? When I use the cbind as you remember from this post C: How to embed known cell information into Seurat object? AddMetaData? the data frame is fine and the meta data loads into it perfectly, but I'm assuming Seurat wants the dataframe a certain way?
Any help would be appreciated!
Very Respectfully, Pratik
So your metadata is by project, and not cell barcode? I don't understand what you are doing at all.
Instead of cell barcode, the cells are labeled by the unique cell sample name, that's all.
I was wondering what format a data frame should be in, in order to use it to add meta data using the
AddMetaData
function.