Create singlecellexperiment object with colData
Hello all,
I'm trying to create a singlecellexperiment with following command
SingleCellExperiment(assays = list(logcounts = logtpm),
colData = df[colnames(logtpm),])
However it prompted error
Error in if (!ok) { : missing value where TRUE/FALSE needed
Calls: SingleCellExperiment -> SummarizedExperiment
Execution halted
I think it due to colData = df[colnames(logtpm),], since it worked fine when I excluded this line. However I cannot debug this because I don't unsderstand why it causes error. I follow the example of creating singlecellexperiment object from this https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#5_Adding_alternative_feature_sets
If anybody experienced this error before can give me any tips for debugging?
Thanks for your help.
• 3,861 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Does
logtpmhave column names, and doesdfhave rownames that match the column names? You may want to include a snippet of your matrixlogtpm[1:10, 1:10]and column datahead(df).Here are result for
so, what happens when you do
head(df[colnames(logtpm),]?It's as following for
head(df[colnames(logtpm),]. It's actually weird to me that running this alone is fine but when putting them in creating SCE command, it prompts error. Do you know if I need to set anything to true or false when adding colData to SCE? Or is there anyway to add colData after creating SCE. Since when I runSingleCellExperiment(assays = list(logcounts = logtpm), it worked normally.Could you share a small subset of both datasets using
dput(head(logtpm))anddput(head(df))? As it stand I do not see errors in your code but there seem to be something wrong with data formattingHere are results for dput:
Do you think if input structure is inappropriate to SCE?
I suggest that not all colnames(logtpm) are present in rownames(df). Could you have a look at
length(intersect(colnames(logtpm),rownames(df)))andlength(colnames(logtpm))? Indeed they should be equivalent otherwise you can't create the SCE objectHello, indeed, some genes are missing in df. Thanks for your suggestion.