[Bioc-devel] Versioned (Biobase) "initialize" method

Morgan, Martin Martin.Morgan at roswellpark.org
Tue Jan 19 21:57:50 CET 2016

Hi Michael -- sorry not to respond sooner.

The lessons in the StackOverflow post were learned by the mistakes in Biobase; many of the classes there fail to follow its advice. Also, there are a number of packages in Bioconductor that depend on the existing Biobase formulation. Unfortunately, the inertia here is strong.

A work-around might be to write an initialize method for "A" that uses callNextMethod() with an argument versions=, thereby freeing up ... for copy construction.

The S4Vectors infrastructure is in many ways a better starting point for new class development.

From: Bioc-devel [bioc-devel-bounces at r-project.org] on behalf of Stravs, Michael [Michael.Stravs at eawag.ch]
Sent: Thursday, January 07, 2016 10:41 AM
To: bioc-devel at r-project.org
Subject: [Bioc-devel] Versioned (Biobase) "initialize" method


The "initialize" method of the Versioned class in Biobase is defined in a way that breaks when inheriting classes want to define a copy constructor.

Code to reproduce:

         representation = representation(var1="integer"),
                             new("Versioned", versions=c(A = "0.1.0"))),

ia <- new("A")
ia2 <- new("A", ia)
# "ia" is mapped to the argument "versions" of the Versioned "initialize" method!

Full gist snippet including bugfix:

For explanation, see:

The Versioned class in Biobase has the following "initialize" method:

function (.Object, ...)
    .local <- function (.Object, versions = list(), ...)
        .Object <- callNextMethod(.Object, ...)
        classVersion(.Object)[names(versions)] <- versions
    .local(.Object, ...)

Can you change it as follows:

function (.Object, ...)


    .local <- function (.Object, ..., versions = list())


        .Object <- callNextMethod(.Object, ...)

        classVersion(.Object)[names(versions)] <- versions



    .local(.Object, ...)


This will fix the problem.

Michael Stravs
BU E 23
�berlandstrasse 133
8600 D�bendorf
+41 58 765 6742

        [[alternative HTML version deleted]]

This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.

More information about the Bioc-devel mailing list