Skip to content
Prev 13941 / 21312 Next

[Bioc-devel] Help with class lost after subsetting.

On 08/27/2018 11:01 PM, Martin Morgan wrote:
Yep. Personally I tend to prefer BiocGenerics:::replaceSlots()
over initialize() because the former can be called with check=FALSE
in order to skip a possibly expensive validation. So:

     BiocGenerics:::replaceSlots(x
         ExperimentList = harmon[["experiments"]],
         colData = harmon[["colData"]],
         sampleMap = harmon[["sampleMap"]],
         metadata = metadata(x),
         check = FALSE)

If you know that the replacement values are valid (because of the way
you prepared them), then validation should not be needed.

Also when only **some** of the slots are updated (which is not the
case in the above example where all the slots are being replaced),
I find that the use of initialize() is misleading from a readability
point of view.

See https://stat.ethz.ch/pipermail/bioc-devel/2017-September/011496.html
for a discussion about this about 1 year ago.

H.