This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Add GenomicRanges to SummarizedExperiment

Hi,

I've got RNAseq data which was processed and given to me in a text-file. The rows are EnsemblIDs, and the columns the individuals with their counts.

I've loaded these data, and ran DESeq2. Now I want to plot the log2 fold changes similar as is explained here: http://www.bioconductor.org/help/workflows/rnaseqGene/#plotting-fold-changes-in-genomic-space. Thing is, I need to 'manually' plug in the "GRanges" in the SummarizedExperiment object.

I could use some pointers - I have no idea how to start. Below the command I've used and the error message.

Code:

resGR <- results(RAW_DESeq2AF, lfcThreshold = 1, format = "GRanges")

Error:

>Error in results(RAW_DESeq2AF, lfcThreshold = 1, format = "GRanges") : 
>rowRanges is GRangesList and one or more GRanges have length 0. Use format='DataFrame' or 'GRangesList'

Thanks!

Sander

summarizedexperiment granges deseq2

The error is telling you to try resGR <- results(RAW_DESeq2AF, lfcThreshold = 1, format = "GRangesList").

I know. But the point is: these genomic ranges aren't present in my DESeq2 object. Like at all. So how do I get them in manually?

Try the rowRanges() accessor.

I did, here's what I get.

> rowRanges(RAW_DESeq2A)
> GRangesList object of length 63677:
> $ENSG00000000003 
> GRanges object with 0 ranges and 0 metadata columns:
>    seqnames    ranges strand
>       <Rle> <IRanges>  <Rle>
> 
> $ENSG00000000005 
> GRanges object with 0 ranges and 0 metadata columns:
>      seqnames ranges strand
> 
> $ENSG00000000419 
> GRanges object with 0 ranges and 0 metadata columns:
>      seqnames ranges strand
> 
> ...
> <63674 more elements>
> -------
> seqinfo: no sequences

Then use that same accessor to replace it:

rowRanges(RAW_DESeq2A) = proper_GRangesObject_or_GRangesList

I presume that the GRangesList or GRanges object will need to be appropriately ordered.

You can also use format = 'DataFrame'

1 answer

Using

resGR <- results(RAW_DESeq2AF, lfcThreshold = 1, format = "GRangesList")

or

resGR <- results(RAW_DESeq2AF, lfcThreshold = 1, format = "DataFrame")

should address the issue.

Log in to answer this question.