DESeq2 in R
2
0
Entering edit mode
amoaristotle ▴ 10
@user-24704
Last seen 3.9 years ago

I ran the following code correctly:

#just.raw.counts was my countData and meta.data is my colData

>just.raw.counts = read.delim("Raw_counts_input.txt")
>just.raw.counts = read.delim("Raw_counts_input.txt", row.names=1)
>just.raw.counts <- as.matrix(just.raw.counts)
>meta.data = read.delim(file="meta_data.txt", row.names = 1)
>count.data.set <- DESeqDataSetFromMatrix(countData=just.raw.counts, 
                                         colData=meta.data, design= ~ condition) 
>count.data.set.object <- DESeq(count.data.set)

I had no issues to this point

Then I want to apply the apeglm shrinkage but first I ran this code below

>resultsNames(count.data.set.object)

and it gave me the coef below

[1] "Intercept"                 "condition_Day1_vs_Control" "condition_Day2_vs_Control" "condition_Day3_vs_Control"
[5] "condition_Day5_vs_Control"

Afterwards I ran the following code to perform the apeglm shrinkage:

count.data.set.object.2 <- lfcShrink(dds=count.data.set.object, coef=5, type="apeglm")

At this point there was not problem

Then I ran another code to show the result

res <- results(count.data.set.object.2, contrast=c("condition","Day1","Control"))

At this point, I got an error which is

Error in results(count.data.set.object.2, contrast = c("condition", "Day1",  : 
  is(object, "DESeqDataSet") is not TRUE

AT this point am dumbfounded and I don't know what to do.

Please help me

DESeq2 apeglm • 1.4k views
ADD COMMENT
1
Entering edit mode
swbarnes2 ★ 1.4k
@swbarnes2-14086
Last seen 4 days ago
San Diego

It's exactly what the error says. count.data.set.object.2 is not a DESeq object. It's a DESeqResults object.

ADD COMMENT
1
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 6 weeks ago
Republic of Ireland

Apologies to ask, but, did you check how this is done in the vignette? - see http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#quick-start

You just seem to be running 2 commands in the incorrect order and have variables / coefficients in the incorrect place.

You could try something like:

just.raw.counts = read.delim("Raw_counts_input.txt")
just.raw.counts <- as.matrix(just.raw.counts)
meta.data = read.delim(file="meta_data.txt", row.names = 1)
count.data.set <- DESeqDataSetFromMatrix(
  countData=just.raw.counts, 
  colData=meta.data,
  design= ~ condition)
count.data.set.object <- DESeq(count.data.set)

# Day 5 versus control
res <- results(count.data.set.object, name = 'condition_Day5_vs_Control')
res <- lfcShrink(count.data.set.object, coef = 'condition_Day5_vs_Control', type = 'apeglm')

For other type of comparisons involving coefficients not listed by resultsNames(), take a look here: https://www.biostars.org/p/325009/#325036

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 621 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6