"I loaded a TxDb object created from Gencode and queried it for the exons, then I used lapply to get all the LAST exons from each transcript that has >1 exon:
#Load db:
Gencode <- loadDb("gencode.v39.basic.annotation.sqlite")
#Exons by transcript
Exons <- exonsBy(Gencode, by = "tx", use.names=TRUE)
#Get Exon Counts
ExonCount <- as.data.frame(elementNROWS(Exons))
#Get the last exon for every transcript
lapply(1:nrow(ExonCount), function(x) Exons[[x]][ExonCount$`elementNROWS(Exons)`[x]])
Next, I want to perform actions on these ranges. Such as shift() or anythign else. However I get a warning:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘resize’ for signature ‘"list"’
My question is, how can I get this object back into a format I can manipulate with GRanges functions?
Alternatively, how can I get the final exon of every transcripts in a way that avoids this problem?
I do not know how to query the final exon in another way, but I did find a way to reformat the lapply output:
My attempt was to concatenate each individual element from the
lapply()function back into a GRanges object:or