[Bioc-devel] How to use initializing functions correctly ?

Charles Plessy ch@r|e@@p|e@@y @end|ng |rom o|@t@jp
Tue May 12 02:48:59 CEST 2020

Dear Bioconductor developers,

I am using some S4 classes in my package (CAGEr) for type saftety and
functional polymorphism; in particular in some case I simply wrap on
an existing class, like this:

    newGPos <- setClass("newGPos", contains = "UnstitchedGPos")

(For example to express the fact that the GPos is a transcription start

I know I can create wrapped objects like this:

    newGPos(GPos("chr1:1:+", stitch = FALSE))

But I was surprised I can not do it like that:

    newGPos("chr1:1:+", stitch = FALSE)
    Error in as(as({ :
      no method or default for coercing “CompressedCharacterList” to “Ranges”

I am struggling to find some documentation explaining how to create a
constructor for the wrapping class, that would function the same way as
the constructor of the base class, except of course that it would return
the object in the wrapping class.

Have a nice day,

Charles Plessy

Charles Plessy - - ~ ~ ~ ~ ~ ~~~~ ~ ~ ~ ~ ~ - - charles.plessy using oist.jp
Okinawa  Institute  of  Science  and  Technology  Graduate  University
Staff scientist in the Luscombe Unit - ~ - https://groups.oist.jp/grsu
Toots from work - ~ ~~ ~ - https://mastodon.technology/@charles_plessy

More information about the Bioc-devel mailing list