YosefLab / ImpulseDE2

37 stars 10 forks source link

Error in checkNumeric(dfAnnotation$Time, "dfAnnotation$Time") : ERROR: dfAnnotation$Time contains non-numeric elements. Requires numeric data #4

Open senaj opened 6 years ago

senaj commented 6 years ago

Hi,

I get the following warning. But it seems to me that the Time column does contain numeric data.

Please, can you give me advice on how to correct this?

Error in checkNumeric(dfAnnotation$Time, "dfAnnotation$Time") : ERROR: dfAnnotation$Time contains non-numeric elements. Requires numeric data. Timing stopped at: 0.022 0.001 0.023

My Code

library(ImpulseDE2)

data input

countdata <- read.table("counts_sncRNA_DE.tsv", header=TRUE, sep='\t',row.names=1)

Convert to matrix

countdata <- as.matrix(countdata) head(countdata)

specify experimental design

annot <- read.table("coldata.txt", header=TRUE) annot <- as.matrix(annot) annotdf <- as.data.frame(annot) head(annotdf)

Sample Condition Time 1 M1C_2hr Act 2 2 M2C_2hr Act 2 3 M3C_2hr Act 2 4 M4C_2hr Act 2 5 M1C_6hr Act 6 6 M2C_6hr Act 6

pVal <- 0.05

DEG analysis

impulse_results <- runImpulseDE2(matCountData = countdata, dfAnnotation = annotdf, boolCaseCtrl = TRUE, scaNProc = 2, scaQThres = pVal, boolIdentifyTransients = TRUE)

davidsebfischer commented 5 years ago

Hi @senaj! Sorry for the late reply and thanks for the issue! I assume that time was converted to a factor at this line: annotdf <- as.data.frame(annot). Factors are a bit ambigous meaning when it comes to numeric vectors so I decided to block them for the time covariate. You can reassign this column of the data frame with a numeric column: annotdf$time <- as.numeric(annotdf$time). Hope this helps!