[Bioc-devel] how to define parallelVectorNames()

Aaron Lun alun at wehi.edu.au
Mon Feb 22 20:27:15 CET 2016


I've noticed that the parallelVectorNames function definition in 
S4Vectors has changed at commit 113621, from:

setMethod("parallelVectorNames", "ANY", function(x) character())

... to:

setMethod("parallelVectorNames", "ANY",
           function(x) colnames(as.data.frame(new(class(x)))))

This ends up breaking some of my code at makeFixedColumnEnv(), as it 
assumes that an accessor method exists with the same name as each entry 
of parallelVectorNames(), which is not the case. (Specifically, for my
genomic interactions class, I have two GRanges representing pairs of 
anchor regions, and as.data.frame yields a data.frame with column names 
of seqnames1, start1, end1, ... and seqnames2, start2, end2, etc. that 
do not have corresponding accessor methods.)

What is the recommended course of action here? Defining an accessor for 
seqnames1, etc. is not impossible, but it seems a bit excessive given 
that those functions would rarely ever be used. Is it okay to restate 
the old definition for the affected class in my package, i.e.:

setMethod("parallelVectorNames", "GInteractions",
     function(x) character())

... or is there something extra that it should return? I don't really 
know what parallelVectorNames() is designed for, so it's hard to tell.

Cheers,

Aaron



More information about the Bioc-devel mailing list