ORF lengths using Yeast Annotation package
4
0
Entering edit mode
dktarathym • 0
@dktarathym-6880
Last seen 10.2 years ago
United States

Hi,

I am trying to find out length of Yeast ORF. Where is my mistake?

> sacCer3Length <- function(symbols)
  {
  require(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene)
  require(org.Sc.sgd.db)
  exons.db = exonsBy(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene, by='gene')
  egs    = unlist(  mget(symbols[ symbols %in% keys(org.Sc.sgd) ],org.Sc.sgd) )
  sapply(egs,function(eg)
  {
  exons = exons.db[[eg]]
  exons = reduce(exons)
  sum( width(exons) )
  })
  }

> sacCer3Length('YNL079C')

Error in unlist(mget(symbols[symbols %in% keys(org.Sc.sgd)], org.Sc.sgd)) :
  error in evaluating the argument 'x' in selecting a method for function 'unlist': Error in mget(symbols[symbols %in% keys(org.Sc.sgd)], org.Sc.sgd) :
  error in evaluating the argument 'x' in selecting a method for function 'mget': Error in symbols %in% keys(org.Sc.sgd) :
  error in evaluating the argument 'table' in selecting a method for function '%in%': Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘keys’ for signature ‘"function"'

 

Regards,

Deepak

yeast genomicranges • 1.8k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

You are trying to be trickier than is necessary. The IDs you appear to want to pass into the function are the gene names that you will have for the GRangesList that you create with exonsBy().

sacCer3Length <- function(symbols){
require("TxDb.Scerevisiae.UCSC.sacCer3.sgdGene", character.only = TRUE)
exons.db <-  exonsBy(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene, by='gene')
symbols <- symbols[symbols %in% names(exons.db)]
exons <- exons.db[symbols]
exons <- reduce(exons)
sum( width(exons) )
}

> ks
 [1] "MAL42"      "YNR058W"    "YJR010W"    "YDL205C"    "YJL053W"   
 [6] "YDR008C"    "YILCdelta1" "YOL059W"    "YHR160C"    "YNL235C"   
[11] "YHR063C"    "YGR296C-A"  "YDR253C"    "YNL081C"    "YJR101W"   
[16] "YCL020W"    "YOR375C"    "YHR091C"    "tD(GUC)J1"  "snR58"     
[21] "YLR014C"    "YKL028W"    "YNL330C"    "YGL183C"    "YMR078C"   
[26] "YIR007W"    "YNL262W"    "YOL035C"    "RDN5-4"     "YCR081C-A"
> sacCer3Length(ks)
  YNR058W   YJR010W   YDL205C   YJL053W   YDR008C   YOL059W   YHR160C   YNL235C
     1443      1536       984      1140       351      1323       852       432
  YHR063C YGR296C-A   YDR253C   YNL081C   YJR101W   YOR375C   YHR091C   YLR014C
     1140       576       576       432       801      1365      1932      2715
  YKL028W   YNL330C   YGL183C   YMR078C   YIR007W   YNL262W   YOL035C YCR081C-A
     1449      1302       981      2226      2295      6669       303       237

 

ADD COMMENT
1
Entering edit mode
Marc Carlson ★ 7.2k
@marc-carlson-2264
Last seen 8.4 years ago
United States

Hi Deepak,

It looks like one thing that is wrong is that you are trying to pass the value org.Sc.sgd to the keys method.  Which is a problem since org.Sc.sgd is not the OrgDb object loaded by the org.Sc.sgd.db package.

org.Sc.sgd.db is that object.  So if all you want is the set of things that are an yeast ORF identifier, then really you only need to say something like this:

egs = keys(org.Sc.sgd.db)

Instead of:

egs = unlist(  mget(symbols[ symbols %in% keys(org.Sc.sgd) ],org.Sc.sgd) )

And if you needed to lookup some other identifier, then I would recommend that you use the select method for that.  You can learn more about it here:

http://www.bioconductor.org/help/workflows/annotation/annotation/

 

But really this whole function looks to me like it could probably be simplified quite a lot.  For a first pass, it looks like all you really need to do is something like this:

sacCer3Length <- function(symbols){
    require(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene)
    require(org.Sc.sgd.db)
    exons.db = exonsBy(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene, by='gene')
    sapply(symbols, function(eg){
        exons <- exons.db[[eg]]
        if(!is.null(exons)){
            exons <- sum(width(reduce(exons)))
        }else{
            exons
        }
    })    
}

sacCer3Length('YNL079C')

 

Does that help?

 

 Marc

ADD COMMENT
0
Entering edit mode
dktarathym • 0
@dktarathym-6880
Last seen 10.2 years ago
United States

HI Marc,

Yes, it worked.

Thank you so much.

Best regards,

Deepak

ADD COMMENT
0
Entering edit mode
dktarathym • 0
@dktarathym-6880
Last seen 10.2 years ago
United States

Hi James,

It works. Thank you so much.

Best regards,

Deepak

ADD COMMENT

Login before adding your answer.

Traffic: 528 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