This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error function vst in DESeq2
dds <- DESeqDataSetFromMatrix (countData = countdata,
                               colData = metadata,
                               design = ~ Condition + Genotype)
dds <- estimateSizeFactors(dds)
vst_data <- vst(dds, blind = TRUE)
vst_counts <- assay(vst_data)
analysis<- DESeq(vst_counts)

At this step I always have this error:

Error in DESeq(vst_counts) : is(object, "DESeqDataSet") is not TRUE

How to correct that?

vst deseq2
## this creates the DESeq object from martix
dds <- DESeqDataSetFromMatrix (countData = countdata,
                               colData = metadata,
                               design = ~ Condition + Genotype)

## this runs the DESeq2 analysis as per your specified condition
dds <- DESeq(dds)
## you don't need to estimateSizeFactors manually because DESeq() does this as part of the pipeline

## returns the result from the DESeq analysis, you can specify the contrast specifically here - see the DESeq2 manual
dds.res <- results(dds)

## transforms the dds object using a variance stabilising transformation which converts the counts to a ~log2 type format
ddt <- vst(dds)

## returns the matrix of transformed ~log2 counts for downstream analysis & visualisation like PCA/TSNE/heatmaps etc
vst.mat <- assay(ddt)

As others have said, you should familiarise yourself with the DESeq2 manual, but this is a basic set of commands to doing a DESeq2 analysis.

Provided you've used the right contrast, dds.res contains information like LFC, standard error, p-value and adjuvsted p-value for the differentially expressed genes. You can convert it to a data-frame and immediately use it in visualisations like volcano-plots etc.

Just remember that DESeq2 will always require raw, untransformed counts for running differential analysis, and the rlog2/vst transformed data for downstream applications.

If you see:

dds <- estimateSizeFactors(dds)
vst_data <- vst(dds, blind = TRUE)

This is skipping the differential expression part and just generates ~log2 transformed data for downstream without doing any statistical testing.

2 answers

Don't use vst counts in DESeq and instead provide a DESeqDataSet as is intended. VST counts should largely only be used for viz/downstream purposes.

Hi, I think you first follow the DESeq2 tutorial to familiarize yourself with the protocol:

https://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html

In short, if you look at the "Quick start" section, you will come to know the flaw in your method.

Log in to answer this question.