Entering edit mode
Hi, I am stuck with starting off with Matrix to DataSet conversion for DESeq analysis. Can you please see what possibly is going wrong?
Thank you.
Code should be placed in three backticks as shown below
Rawcounts_old_retina <- read_csv("Rawcounts old_retina.csv")
View(Rawcounts_old_retina)
readcount_matrix <- as.matrix(read.csv("Rawcounts old_retina.csv"), row.names= ("Genes"))
head(readcount_matrix,1)
Metadata <- data.frame(sample = c( "S7", "S8", "S9", "S10", "S11", "S12"), condition = c("control", "control", "control", "KO", "KO", "KO"), row.names= "sample")
Metadata$condition <- as.factor(Metadata$condition)
countData<- data.frame(readcount_matrix)
countData
all(rownames(Metadata) %in% colnames(countData))
countData<- countData[,-1]
all(rownames(Metadata) == colnames(countData))
problematic code is DESeqDataSetFromMatrix
dds <- DESeqDataSetFromMatrix(countData = countData, colData = Metadata, design= ~condition)
ERROR
Error in DESeqDataSet(se, design = design, ignoreRank) : some values in assay are negative
It says some values are negative. But I really cannot spot any negative value. What should I do to rectify this? Any idea?
I filtered csv columns, using 'less than 0' filter. And there were no values below 0. On R, I used:
any(countData<0)
[1] TRUEI don't understand the conflict here.
How did you check that there are no negative values?
If you do
That means you have some values below zero!
Hi James,
Is there a way to avoid these negative values present in the matrix? Will appreciate some help.
I would first want to know why you have negative values. If they are counts then by definition there should be no values lower than zero. If they aren't counts, then you probably shouldn't be using
DESeq2
to model them.Also, when the instructions say to put code within triple backticks, what that means is you should put a triple backtick on one line, hit Enter, then paste your code, then hit Enter, and then put in another set of three backticks. This is what it looks like when you do that:
Which looks like a block of code. If you wrap each line separately it looks like this:
z <- rnorm(1000)
zz <- rnorm(10000)
Which is still more legible than what you had previously, but it's pretty janky looking...