gencode_regions icon indicating copy to clipboard operation
gencode_regions copied to clipboard

In your R script (create_regions_from_gencode.R) there is a small bug

Open Alex-Nesta opened this issue 5 years ago • 4 comments

transcripts.data <- unlist(transcripts.data) ###ERROR
exons.data <- unlist(exons.data)
threeUTRs.data <- unlist(threeUTRs.data)
fiveUTRs.data <- unlist(fiveUTRs.data)
cds.data <- unlist(cds.data)
introns.data <- unlist(introns.data)
genes.data <- unlist(genes.data) ####ERROR

There error is:

Error in getListElement(x, i, ...) : 
  GRanges objects don't support [[, as.list(), lapply(), or unlist() at
  the moment
Calls: unlist ... FUN -> [[ -> [[ -> getListElement -> getListElement
Execution halted

I did not need those lines to work for my purposes, but just an FYI on the issue.

Alex-Nesta avatar Feb 25 '19 20:02 Alex-Nesta

I have the same problem,Bioconductor 3.8 may not support the this,but I didn't solve it

xf78 avatar Feb 28 '19 02:02 xf78

Thanks @Alex-Nesta and @xf78 for reporting the issue. I will try to have a fix soonish. In the meantime, can you check if the data you need is here: https://github.com/saketkc/gencode_regions/tree/master/data Happy to add if it's missing (which is very likely!)

saketkc avatar Feb 28 '19 02:02 saketkc

I had the same issue, using GenomicFeatures v 1.34.3 (not sure which other packages/versions might be relevant for this). It appears that genes(), transcripts(), and promoters() return a GRanges object ["The only exception being when genes is used with single.strand.genes.only=FALSE, in which case a GRangesList object is returned."], while threeUTRsByTranscript(), fiveUTRsByTranscript(), cdsBy(), exonsBy(), intronsByTranscript() return a GRangesList object, so for the latter ones the unlist is required, but not for the former ones.

By simply removing the lines as mentioned above transcripts.data <- unlist(transcripts.data) and genes.data <- unlist(genes.data)

as well as replacing promoters.data <- unlist(promoters(TxDb, upstream=len, downstream=len)) with promoters.data <- promoters(TxDb, upstream=len, downstream=len)

I managed to recreate the files as provided in data/GRCm38/vM14/

bug1303 avatar May 23 '19 12:05 bug1303

I also encountered this issue currently, using conda hosted R-3.3.2 to install dependencies solved the issue. However, while conducting problem searching, I noticed that

The overall goal of all these changes is to bring more consitency between IRanges and GRanges objects
 (GRanges objects will also support [[, unlist(), as.list(), and lapply() in Bioconductor 3.8).

in unlist doesn't work for IRanges, so maybe downgrading to Bioconductor 3.8 version can also solve the issue (I'm not pretty sure, haven't tried yet).

longqh3 avatar Nov 27 '20 02:11 longqh3