Search
Question: ORF lengths using Yeast Annotation package
0
gravatar for dktarathym
3.1 years ago by
dktarathym0
United States
dktarathym0 wrote:

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

ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by dktarathym0
2
gravatar for James W. MacDonald
3.1 years ago by
United States
James W. MacDonald45k wrote:

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 COMMENTlink written 3.1 years ago by James W. MacDonald45k
1
gravatar for Marc Carlson
3.1 years ago by
Marc Carlson7.2k
United States
Marc Carlson7.2k wrote:

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 COMMENTlink modified 3.1 years ago • written 3.1 years ago by Marc Carlson7.2k
0
gravatar for dktarathym
3.1 years ago by
dktarathym0
United States
dktarathym0 wrote:

HI Marc,

Yes, it worked.

Thank you so much.

Best regards,

Deepak

ADD COMMENTlink written 3.1 years ago by dktarathym0
0
gravatar for dktarathym
3.1 years ago by
dktarathym0
United States
dktarathym0 wrote:

Hi James,

It works. Thank you so much.

Best regards,

Deepak

ADD COMMENTlink written 3.1 years ago by dktarathym0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 280 users visited in the last hour