Entering edit mode
2.2 years ago
Alex
•
0
Hellow there. I'm new in the bioinformatics and programmigs. I'm trying to follow this example (link:GeneExpression) and everything was going well, but I get the error at this step:
mcols(dm.genes) <- res[names(dm.genes), c("log2FoldChange", "stat", "pvalue", "padj")]
In my case I get this:
mcols(dm.genes) <- res[names(dm.genes), c("log2FoldChange", "stat", "pvalue", "padj")]
Error: subscript contains invalid names
What can the error be related to and how to fix it?
try print
dm.genes
firstly and see if the column names in the dataframe of dm.genes matches the vectorc("log2FoldChange", "stat", "pvalue", "padj")
To give a bit more context: the error message indicates that you're asking for rows (via
names(dm.genes)
) or columns (viac("log2FoldChange", "stat", "pvalue", "padj")
that aren't part of the data.frameres
. To pinpoint the issue, you need to figure out which entries of your subset are missing fromres
(or are named differently, even if a column is namedPadj
, it won't be recognized if you try to subset viapadj
)all(names(dm.genes) %in% rownames(res)
will tell you if there are gene names in yourdm.genes
object that aren't part of the rownames ofres
(if all are found, the result should beTRUE
)all(c("log2FoldChange", "stat", "pvalue", "padj") %in% colnames(res))
Thank you so much! I get it