QFeatures
QFeatures copied to clipboard
Aggregating features when a value of fcol is "" (empty character)
Context
I tried to aggregate data to protein level using MaxQuant output. I forgot to remove unidentified proteins, which MaxQuant labels in the Proteins column as "". This leads to the error:
Error in SummarizedExperiment(assays = assays, colData = colData(object), :
the rownames and colnames of the supplied assay(s) must be NULL or identical to those of the
SummarizedExperiment object (or derivative) to construct
which is quite uninformative and doesn't guide how to solve this.
Reproducible example
library(QFeatures)
data(feat1)
feat1 <- aggregateFeatures(feat1, "psms", "Protein", name = "peptides") ## this is OK
rowData(feat1[["psms"]])$Protein[1] <- ""
feat1 <- aggregateFeatures(feat1, "psms", "Protein", name = "peptides2") ## error
Suggested solution
This is a very peculiar use case, and I don't think we should provide a fix for it. I would however suggest to add a check and throw a more informative error, for instance:
Some values in 'fcol' are "" (empty character string), which are not allowed. Please remove the corresponding features using:
filterFeatures(object, ~ Protein != "")
What's your opinion?