[Bioc-devel] Making transcriptLength function a method in GenomicFeatures?

Hervé Pagès hpages at fredhutch.org
Mon May 2 07:38:46 CEST 2016

Hi Johannes,

We can make transcriptLengths() a generic but isn't the situation
similar to the extractTranscriptSeqs() situation that you brought
in January 
(https://stat.ethz.ch/pipermail/bioc-devel/2016-January/008570.html) for 
which adding the ellipsis to the argument list of the
function and proper forwarding of the extra arguments did the trick?
In the case of transcriptLengths() the extra arguments would be
forwarded to the internal calls to transcripts(), exonsBy(), cdsBy(),
fiveUTRsByTranscript(), and threeUTRsByTranscript(), and so
transcriptLengths() would work out-of-the-box on EnsDb objects.
Would that work?


On 04/30/2016 04:05 AM, Rainer Johannes wrote:
> Dear all,
> I was wondering, you think it would be possible to make the transcriptLength function in GenomicFeatures a method and export that? Reason is that I have also implemented a transcriptLength function (actually presently a method in order to allow that to be used for EnsDb and TxDb objects), but this causes the warning
> The following object is masked from 'package:GenomicFeatures':
>      transcriptLengths
> on package loading.
> Just in case, that’s the code from my package:
> if(!isGeneric("transcriptLengths"))
>      setGeneric("transcriptLengths", function(x, with.cds_len=FALSE,
>                                               with.utr5_len=FALSE,
>                                               with.utr3_len=FALSE, ...)
>          standardGeneric("transcriptLengths”))
> setMethod("transcriptLengths", "EnsDb", function(x, with.cds_len=FALSE, with.utr5_len=FALSE,
>                                                  with.utr3_len=FALSE, filter=list()){
>      return(.transcriptLengths(x, with.cds_len=with.cds_len, with.utr5_len=with.utr3_len,
>                                with.utr3_len=with.utr3_len, filter=filter))
> })
> cheers, jo
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioc-devel mailing list