Hi Mike,

I am trying to design a DESeq2 model using solely a **continuous variable**.

However, it is treated as a factor inside the model, even after I specify it 'as.numeric'.

- How can a "cont_var" be specified in a way that it is seen/accepted as a numeric continuous variable inside the
**model**? **results**?

Please, see a reproducible example below, many thanks in advance:

# gene counts

cts3 <- matrix(c(0, 1, 0, 2, 3000, 0, 100, 200, 500), ncol=3)

colnames(cts3) <- c("samp1", "samp2", "samp3")

rownames(cts3) <- c("gene1", "gene2", "gene3")

# metadata

metadata3 <- matrix(c(0, 4, 130), ncol=1)

rownames(metadata3) <- c("samp1", "samp2", "samp3")

colnames(metadata3) <- "cont_var"

metadata3

**# DESeq model, treats 'cont_var' as factor, why?
dds3 <- DESeqDataSetFromMatrix(countData = cts3,
colData = metadata3,
design = ~ as.numeric(cont_var)) **

dds3 <- DESeq(dds3)

# transformation

pca <- DESeq2::varianceStabilizingTransformation(dds3, blind=FALSE)

# plot

pcaplot(pca, intgroup="cont_var", text_labels=FALSE, point_size = 5)

**# contrast, how?
results = results(dds3, contrast=c("cont_var", .., ...), cooksCutoff = TRUE)**

Many thanks Mike,

The reason I think that the 'cont_var' is not considered as a continuous numeric variable is the plot above.

E.g. I expected the legend to have continuous scale rather than indicating individual values.

Am I wrong? Thanks

"group" is turned into a factor just for this PCA plot, but not for the DESeq() analysis. You can see it is a continuous variable by examining resultsNames(dds). There will be just a single coefficient, not two coefficients: 4_vs_0 and 130_vs_0.