library(microViz)
#> microViz version 0.12.6 - Copyright (C) 2021-2024 David Barnett
#> ! Website: https://david-barnett.github.io/microViz
#>  Useful?  For citation details, run: `citation("microViz")`
#>  Silence? `suppressPackageStartupMessages(library(microViz))`

Do I need to read this?

This article is important for you to read if you are already using microViz version 0.9.7 or earlier, and would like to upgrade to the newest version. You can check which version of microViz you are using by running the following code.

packageVersion("microViz")
#> [1] '0.12.6'

Key points

microViz version 0.10.0 introduces changes that may break some code written with older versions of microViz.

  • Breaking change 1:

    • Description: using the $ operator to access parts of the old “ps_extra” S3 class list (e.g. yourData$ps or yourData$dist) will no longer work in microViz 0.10.0 or later

    • Solution: You must replace the use of the $ operator with accessor functions, e.g. ps_get() or dist_get()

  • Breaking change 2:

    • Description: if you have a saved “ps_extra” object generated with an older version of microViz, this will not be compatible with microViz version 0.10.0 and later versions

    • Solution: you can convert old “ps_extra” objects to the new “psExtra” S4 objects with the new function upgrade_ps_extra_to_psExtra()

  • Need more help?

    • If you have questions about upgrading your version of microViz, please ask them here on the Discussions page.

    • If you encounter any other problems (not mentioned here) after upgrading to version 0.10.0 or later, please report them as Issues, and describe which version of microViz they occur with, e.g. include the output of packageVersion("microViz") or sessionInfo().

Explanation

Many microViz functions, including tax_transform(), dist_calc(), etc. use and produce R objects that contain a “phyloseq” object along with additional information (e.g. the name of the transformation applied, and the name of the distance method used) and additional objects (e.g. the distance matrix itself).

In microViz versions 0.9.7 and earlier, the extra information and objects were stored alongside the phyloseq object in a simple (S3) list object with the class, “ps_extra”.

From microViz version 0.10.0 onwards, the S3 “ps_extra” object class is no longer used. It has been replaced with an S4 object class “psExtra”. The “psExtra” S4 class is an extension of the “phyloseq” S4 class, with extra slots to store other information and additional objects. All slots have a clearly named accessor function to retrieve the information or data stored within them.

Why was this change made?

In the long term, this change should simplify compatibility of microViz with other packages that work with phyloseq objects. Most functions that expect a phyloseq object should now also work with psExtra objects, as the extra slots can just be ignored. (But for now, if you are unsure, it is safest to use ps_get to extract a plain phyloseq from any psExtra object.)

Do I need to understand what S4 and S3 classes are?

No, you do not need to understand these concepts to use microViz. But If you are interested to learn, a good place to start is Hadley Wickham’s Advanced R book chapter on object-oriented programming.