[Bioc-devel] Best Practices for Renaming S4 Slots

Chris Eeles chr|@topher@ee|e@ @end|ng |rom out|ook@com
Thu Oct 14 22:08:20 CEST 2021


Hello BioC community,

I am the lead developer for the CoreGx, PharmacoGx, RadioGx and ToxicoGx packages. We have recently been working on major updates to the structure of a CoreSet, which is inherited by the main class in all three of the other packages listed.

While making these changes, we would like to rename some CoreSet slots to increase the amount of code that can be refactored into CoreGx, simplifying maintenance and development of inheriting packages in the future.

The slot names and their accessors will be made more generic, for example the 'cell' slot will become 'sample' to allow a CoreSet derived class to store Biological model systems other than cancer cell lines. Similarly, 'drug' or 'radiation' slots in inheriting packages will be replaced with a 'treatment' slot in the CoreSet. This will allow us to simplify inheritance, removing much redundant code from the inheriting packages and setting us up to integrate other lab packages, such as Xeva for PDX models, into the general CoreSet infrastructure.

I took a brief look through the Bioconductor developer documentation but didn't see anything talking about best practices for renaming slots.

It is easy enough to make the code changes, but my major concern is being able to update existing objects from these packages to use the new slot names.

I am aware of the updateObject function in BiocGenerics, but tried using it to update some example data in CoreGx without success.

Is this the proper function to use when you wish to update an S4 object whose class definition has been modified? If not, is there existing infrastructure for accomplishing this task?

Any tips for implementing slot renaming, as well as links to existing documentation or articles on the topic would be appreciated.

Best,
---
Christopher Eeles
Software Developer
BHK Laboratory<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.bhklab.ca%2F&data=02%7C01%7Ctao.qing%40yale.edu%7Ce130a2d3267b46a945ab08d79f7660ad%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C637153203084194682&sdata=nGXPfLnlbcaLQdDOHFDmp4lZ7lD9H29uFeVCAqjT9Ds%3D&reserved=0>
Princess Margaret Cancer Centre<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pmgenomics.ca%2Fpmgenomics%2F&data=02%7C01%7Ctao.qing%40yale.edu%7Ce130a2d3267b46a945ab08d79f7660ad%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C637153203084194682&sdata=b2ZjA%2FPDKjTZmAWGbnQAY1SjVtCDQGQmXu2Thz%2FXQkI%3D&reserved=0>
University Health Network<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.uhn.ca%2F&data=02%7C01%7Ctao.qing%40yale.edu%7Ce130a2d3267b46a945ab08d79f7660ad%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C637153203084204675&sdata=NH1nVdRr9SsFOtMYhC%2BaXpdZiC7Nm%2BaUt37NvDWBfCg%3D&reserved=0>


	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list