I am running RNA Seq analysis on a dataset and I keep receiving this error when using DESeqDataSetFromMatrix. The df is counts data and the coldata is coldata.
Error in DESeqDataSet(se, design = design, ignoreRank) : counts matrix should be numeric, currently it has mode: logical Here is the code being used:
df <- "C:\\Users\\reach\\OneDrive\\Desktop\\REU Summer 2021\\Autotaxin Cancer\\mRNA_counts_and_annotation\\mRNA_counts.csv"
df <- read.csv(df)
coldata <- "C:\\Users\\reach\\OneDrive\\Desktop\\REU Summer 2021\\Autotaxin Cancer\\mRNA_counts_and_annotation\\coldata.txt"
coldata <- read.csv(coldata)
coldata <- coldata %>%
dplyr:: filter("condition" == "Tumor"| "condition" == "Normal" | "condition" == "At_risk")
coldata %>% select(condition)
colnames(df) <- stringr::str_replace_all(string = colnames(df),pattern = "-", replacement = "_")
geneID <- rownames(df)
df <- df%>%
dplyr::select(rownames(coldata))
coldata$condition <- as.factor(coldata$condition)
df <- df[,rownames(coldata)]
all(rownames(coldata) %in% colnames(df))
all(rownames(coldata) == colnames(df))
ddsall <- DESeq2::DESeqDataSetFromMatrix(countData = df,
colData = coldata,
design = ~ condition)
Any suggestions on how to improve this code so that the DESEQ2 runs without error?
I am not sure which version of R you use but a couple of things you can do is:
sep=","
) when uploading your data frame with countsdata.matrix()
browseVignettes("DESeq2")