Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Michael Lawrence
Patch for the "c" issue submitted: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15681 On Sat, Feb 22, 2014 at 2:56 PM, Michael Lawrence wrote: > > > > On Sat, Feb 22, 2014 at 2:04 PM, Hervé Pagès wrote: > >> >> >> On 02/22/2014 01:59 PM, Michael Lawrence wrote: >> >>> Yea, I can see th

Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Michael Lawrence
On Sat, Feb 22, 2014 at 2:04 PM, Hervé Pagès wrote: > > > On 02/22/2014 01:59 PM, Michael Lawrence wrote: > >> Yea, I can see the argument for consistency. Not sure I'll get around to >> it though. How about we see if they take this patch first. >> > > Sounds good. I was hoping that fixing select

Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Hervé Pagès
On 02/22/2014 01:59 PM, Michael Lawrence wrote: Yea, I can see the argument for consistency. Not sure I'll get around to it though. How about we see if they take this patch first. Sounds good. I was hoping that fixing selectMethod would maybe fix ?generic(arg) automatically but that's probabl

Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Michael Lawrence
Yea, I can see the argument for consistency. Not sure I'll get around to it though. How about we see if they take this patch first. Michael On Sat, Feb 22, 2014 at 12:26 PM, Hervé Pagès wrote: > Thanks Michael. > > Do you think it would be sensible to offer a similar fix for > selectMethod? >

Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Hervé Pagès
Thanks Michael. Do you think it would be sensible to offer a similar fix for selectMethod? > setGeneric("f", function(x, y) standardGeneric("f")) > setMethod("f", c("numeric", "missing"), function(x, y) x) > selectMethod("f", "numeric") Error in selectMethod("f", "numeric") : no meth

Re: [Bioc-devel] cigarToRleList fails

2014-02-22 Thread Michael Lawrence
Translated it into a patch against R, submitted here: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15680 On Fri, Feb 21, 2014 at 2:53 PM, Hervé Pagès wrote: > > > On 02/21/2014 02:01 PM, Michael Lawrence wrote: > >> This function seems to solve the problem: >> >> helpwith <- function(ex

Re: [Bioc-devel] cigarToRleList fails

2014-02-21 Thread Hervé Pagès
On 02/21/2014 02:01 PM, Michael Lawrence wrote: This function seems to solve the problem: helpwith <- function(expr) { env <- IRanges:::top_prenv(expr) expr <- substitute(expr) fun <- eval(expr[[1L]], env) fun.name <- deparse(expr[[1L]]) if (!isGeneric(fun.name

Re: [Bioc-devel] cigarToRleList fails

2014-02-21 Thread Michael Lawrence
On Fri, Feb 21, 2014 at 2:03 PM, Gabriel Becker wrote: > Michael, > > Why not just load the help page for the function if it's not a generic > instead of throwing an error? > > Also, it's possible that it skipping missing arguments and going straight > to any is a bug in help, rather than the desi

Re: [Bioc-devel] cigarToRleList fails

2014-02-21 Thread Gabriel Becker
Michael, Why not just load the help page for the function if it's not a generic instead of throwing an error? Also, it's possible that it skipping missing arguments and going straight to any is a bug in help, rather than the designed behavior. Perhaps we should check? ~G On Fri, Feb 21, 2014 a

Re: [Bioc-devel] cigarToRleList fails

2014-02-21 Thread Michael Lawrence
This function seems to solve the problem: helpwith <- function(expr) { env <- IRanges:::top_prenv(expr) expr <- substitute(expr) fun <- eval(expr[[1L]], env) fun.name <- deparse(expr[[1L]]) if (!isGeneric(fun.name, env)) { stop("'expr' must be a call to a generic") } args <- form

Re: [Bioc-devel] cigarToRleList fails

2014-02-21 Thread Hervé Pagès
Hi Gabriel, On 02/20/2014 05:03 PM, Gabriel Becker wrote: Herve, The help is correct (though possibly a bit pedantic), there is no method for that signature. But the dispatch mechanism is able to find one because 'import(path_to_gff)' *does* work. So the help maybe is correct but that doesn'

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Gabriel Becker
My conjecture is that this is because while import can handle you not passing in a format, it doesn't have a default value for the parameter, so ? has no way of knowing what the body of the function is going to put into the format variable before it uses it. ~G On Thu, Feb 20, 2014 at 5:03 PM, G

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Gabriel Becker
Herve, The help is correct (though possibly a bit pedantic), there is no method for that signature. ?import("", "") works for me though ~G On Thu, Feb 20, 2014 at 4:51 PM, Hervé Pagès wrote: > On 02/20/2014 04:16 PM, Michael Lawrence wrote: > >> There's also "?coverage(ga)", so the user ca

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Hervé Pagès
On 02/20/2014 04:16 PM, Michael Lawrence wrote: There's also "?coverage(ga)", so the user can see what happens specifically for their object, without worrying about typing out the class. I was never lucky with this: > library(rtracklayer) > path_to_gff <- system.file("tests", "v1.gff", pac

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Michael Lawrence
There's also "?coverage(ga)", so the user can see what happens specifically for their object, without worrying about typing out the class. At some point it would be neat to generate S4 documentation at run-time. Just popup a browser and see every method that might be dispatched with a given object

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Hervé Pagès
On 02/20/2014 02:55 PM, Martin Morgan wrote: On 02/20/2014 02:32 PM, Hervé Pagès wrote: Hi Jesper, On 02/20/2014 02:13 PM, Jesper Gådin wrote: Very true that it is quite difficult to find the documentation when one is not aware of its existence :P Yeah, this has been a source of frustratio

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Martin Morgan
On 02/20/2014 02:32 PM, Hervé Pagès wrote: Hi Jesper, On 02/20/2014 02:13 PM, Jesper Gådin wrote: Very true that it is quite difficult to find the documentation when one is not aware of its existence :P Yeah, this has been a source of frustration for many people. And always a source of embarr

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Hervé Pagès
Hi Jesper, On 02/20/2014 02:13 PM, Jesper Gådin wrote: Very true that it is quite difficult to find the documentation when one is not aware of its existence :P Yeah, this has been a source of frustration for many people. And always a source of embarrassment (for us) when teaching our software

Re: [Bioc-devel] cigarToRleList fails

2014-02-20 Thread Jesper Gådin
Very true that it is quite difficult to find the documentation when one is not aware of its existence :P coverage() is fast and beautiful. Thanks! /Jesper On Wed, Feb 19, 2014 at 9:21 PM, Hervé Pagès wrote: > Hi Jesper, > > > On 02/19/2014 08:44 AM, Michael Lawrence wrote: > >> On Wed, Feb 19

Re: [Bioc-devel] cigarToRleList fails

2014-02-19 Thread Hervé Pagès
Hi Jesper, On 02/19/2014 08:44 AM, Michael Lawrence wrote: On Wed, Feb 19, 2014 at 8:39 AM, Jesper Gådin wrote: Hi Michael, Herves suggestion will probably work for my use case, but if there are any smoother ways it would be preferable. The use case is as follows: 1) calculate strand specif

Re: [Bioc-devel] cigarToRleList fails

2014-02-19 Thread Michael Lawrence
On Wed, Feb 19, 2014 at 8:39 AM, Jesper Gådin wrote: > Hi Michael, > > Herves suggestion will probably work for my use case, but if there are any > smoother ways it would be preferable. > > The use case is as follows: > > 1) calculate strand specific coverage over a region from > GAlignments objec

Re: [Bioc-devel] cigarToRleList fails

2014-02-19 Thread Jesper Gådin
Hi Michael, Herves suggestion will probably work for my use case, but if there are any smoother ways it would be preferable. The use case is as follows: 1) calculate strand specific coverage over a region from GAlignments object (or file) At the moment I read a file using readGAlignmentsFromBam

Re: [Bioc-devel] cigarToRleList fails

2014-02-18 Thread Michael Lawrence
Hi Jesper, Would you be willing to volunteer your use case? As Herve hinted, cigarToRleList and friends are low-level helpers. There may be an easier way to achieve what you want, or an opportunity to improve things. Michael On Mon, Feb 17, 2014 at 1:10 AM, Jesper Gådin wrote: > Hi, > > Have c

Re: [Bioc-devel] cigarToRleList fails

2014-02-18 Thread Hervé Pagès
Hi Jesper, On 02/17/2014 01:10 AM, Jesper Gådin wrote: Hi, Have come across a cigar-vector that is problematic to process. #load package library(GenomicAlignments) #load data (see attached file) load("2014-02-17-cigarExample.rdata") #run function cigarToRleList cigarRle <- cigarToRleLis