Giter Club home page Giter Club logo

neelsoumya / dssurvivalclient Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 7.0 9.54 MB

Survival functions (client side) for DataSHIELD. Package for building survival models, Cox proportional hazards models and Cox regression models in DataSHIELD.

Home Page: https://neelsoumya.github.io/dsSurvivalbookdown/

License: GNU General Public License v3.0

R 15.74% TeX 0.24% HTML 84.02%
survival-analysis datashield survival-models cox cox-regression cox-model survival-functions cox-models federated-analysis datashield-technical-team

dssurvivalclient's Introduction

dsSurvivalClient

License

Introduction

dsSurvivalClient is a package for building survival functions (client side) in DataSHIELD (a platform for federated analysis of private data). These are client side functions for building survival models, Cox proportional hazards models and Cox regression models.

A tutorial in bookdown format with executable code is available here:

https://neelsoumya.github.io/dsSurvivalbookdown/

DataSHIELD is a platform for federated analysis of private data. DataSHIELD has a client-server architecture and this package has a client side and server side component.

If you use the code, please cite the following manuscript:

Banerjee S, Sofack G, Papakonstantinou T, Avraam D, Burton P, et al. (2022), dsSurvival: Privacy preserving survival models for federated individual patient meta-analysis in DataSHIELD, bioRxiv: 2022.01.04.471418.

https://www.biorxiv.org/content/10.1101/2022.01.04.471418v2

https://doi.org/10.1101/2022.01.04.471418

https://bmcresnotes.biomedcentral.com/articles/10.1186/s13104-022-06085-1

A bib file is available here:

https://github.com/neelsoumya/dsSurvival/blob/main/CITATION.bib

Quick start

Install R

https://www.r-project.org/

and R Studio

https://www.rstudio.com/products/rstudio/download/preview/

Install the following packages:

install.packages('devtools')
library(devtools)
devtools::install_github('neelsoumya/dsSurvivalClient')
devtools::install_github('datashield/[email protected]')
install.packages('rmarkdown')
install.packages('knitr')
install.packages('tinytex')
install.packages('metafor')
install.packages('DSOpal')
install.packages('DSI')
install.packages('opalr')
install.packages('patchwork')

Follow the tutorial in bookdown format with executable code:

https://neelsoumya.github.io/dsSurvivalbookdown/

This uses the Opal demo server which has all server-side packages preinstalled

https://opal-sandbox.mrc-epid.cam.ac.uk/

You can also see the script simple_script.R

https://github.com/neelsoumya/dsSurvival/blob/main/vignettes/simple_script.R

Installation

Screenshot of installation of package in VM

Please see the link below on how to install a package in Opal

https://opaldoc.obiba.org/en/latest/web-user-guide/administration/datashield.html#add-package

install.packages('devtools')

library(devtools)

devtools::install_github('neelsoumya/dsBaseClient')

devtools::install_github('neelsoumya/dsSurvivalClient')

If you want to use a certain release then you can do the following

library(devtools)

devtools::install_github('neelsoumya/[email protected]')

If you want to try privacy preserving survival curves (available in v2.0), you can use the main branch or you can do the following

library(devtools)

devtools::install_github('neelsoumya/dsSurvivalClient', ref = 'privacy_survival_curves')

or

library(devtools)

devtools::install_github('neelsoumya/[email protected]')

Usage

A tutorial in bookdown format is available here:

https://neelsoumya.github.io/dsSurvivalbookdown/

A screenshot of meta-analyzed hazard ratios from a survival model is shown below.

Meta-analyzed hazard ratios from survival models

For polished publication ready plots, use the following script forestplot_FINAL.R

https://github.com/neelsoumya/dsSurvival/blob/main/forestplot_FINAL.R

or the script simple_script.R

https://github.com/neelsoumya/dsSurvival/blob/main/vignettes/simple_script.R

If you want to learn the basics of survival models, see the following repository:

https://github.com/neelsoumya/survival_models

If you want to learn coding models in DataSHIELD, see the following repository:

https://github.com/neelsoumya/dsMiscellaneous

Release notes

v1.0.0: A basic release of survival models in DataSHIELD. This release has Cox proportional hazards models, summaries of models, diagnostics and the ability to meta-analyze hazard ratios. There is also capability to generate forest plots of meta-analyzed hazard ratios. This release supports study-level meta-analysis.

A shiny graphical user interface for building survival models in DataSHIELD has also been created by Xavier Escriba Montagut and Juan Gonzalez. It calls dsSurvival and dsSurvivalClient.

v1.0.1: Minor fixes.

v2.0.0: This release has privacy preserving survival curves.

v2.1.1: This has minor fixes.

v2.1.2: This has minor fixes.

v2.1.3: This has minor fixes, fixes for plotting of a stratified survival analysis and use of ggplot in plotting survival curves.

Acknowledgements

We acknowledge the help and support of the DataSHIELD technical team. We are especially grateful to Elaine Smith, Eleanor Hyde, Shareen Tan, Stuart Wheater, Yannick Marcon, Paul Burton, Demetris Avraam, Patricia Ryser-Welch, Kevin Rue-Albrecht, Maria Gomez Vazquez and Wolfgang Viechtbauer for fruitful discussions and feedback.

We thank Yannick Marcon and @StuartWheater for fixes, @joerghenkebuero for suggestions about documentation, @AlanRace and Stefan Buchka for bug fixes and Xavier Escriba Montagut for a fix to the plotting functionality.

Contact

  • Soumya Banerjee, Demetris Avraam, Paul Burton, Xavier Escriba Montagut, Juan Gonzalez, Tom R. P. Bishop and DataSHIELD technical team

  • [email protected]

  • DataSHIELD

Citation

If you use the code, please cite the following manuscript:

Banerjee S, Sofack G, Papakonstantinou T, Avraam D, Burton P, et al. (2022), dsSurvival: Privacy preserving survival models for federated individual patient meta-analysis in DataSHIELD, bioRxiv: 2022.01.04.471418.

https://www.biorxiv.org/content/10.1101/2022.01.04.471418v2

https://doi.org/10.1101/2022.01.04.471418

https://bmcresnotes.biomedcentral.com/articles/10.1186/s13104-022-06085-1

A bib file is available here:

https://github.com/neelsoumya/dsSurvivalClient/blob/main/project/CITATION.bib

@article{Banerjee2022,
author = {Banerjee, Soumya and Sofack, Ghislain and Papakonstantinou, Thodoris and Avraam, Demetris and Burton, Paul and Z{\"{o}}ller, Daniela and Bishop, Tom RP},
doi = {10.1101/2022.01.04.471418},
journal = {bioRxiv},
month = {jan},
pages = {2022.01.04.471418},
publisher = {Cold Spring Harbor Laboratory},
title = {{dsSurvival: Privacy preserving survival models for federated individual patient meta-analysis in DataSHIELD}},
year = {2022}
}

Publications

The following publications describe dsSurvival

Banerjee, S., Sofack, G.N., Papakonstantinou, T. et al. dsSurvival: Privacy preserving survival models for federated individual patient meta-analysis in DataSHIELD. BMC Res Notes 15, 197 (2022). https://doi.org/10.1186/s13104-022-06085-1

Banerjee, S., Bishop, T.R.P. dsSurvival 2.0: privacy enhancing survival curves for survival models in the federated DataSHIELD analysis system. BMC Res Notes 16, 98 (2023). https://doi.org/10.1186/s13104-023-06372-5

If you use the code, please cite the following manuscript:

Banerjee, S., Sofack, G.N., Papakonstantinou, T. et al. dsSurvival: Privacy preserving survival models for federated individual patient meta-analysis in DataSHIELD. BMC Res Notes 15, 197 (2022). https://doi.org/10.1186/s13104-022-06085-1

dssurvivalclient's People

Contributors

alanrace avatar escri11 avatar neelsoumya avatar stuartwheater avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dssurvivalclient's Issues

Deprecated message for "survival::Surv"

Describe the bug

When running test I get the error message:

Warning (test-smk-ds.cox.zphSLMA.R:65:5): simple error,wrong formula
invalid formula "survival::Surv(time=SURVTIME,event=EVENT)=D$age": assignment is deprecated**

To Reproduce

Run testhat tests with devtools::test()

Issue with ds.plotsurvfit when dataName is specified

Discussed in #13

Originally posted by MatBCHR January 24, 2023
Hello,

When I want to specify dataName argument of dsSurvivalClient::ds.plotsurvfit function I obtain the following error :

" Error: The 'datasources' were expected to be a list of DSConnection-class objects "

It seems that it is related to the order of arguments passed into dsBaseClient::ds.exists function

   if (!(is.null(dataName))) {
        defined <- dsBaseClient::ds.exists(datasources, dataName)
    }

which is not consistent with the order described in the Help page of the function

image

Is it possible to check on your side ?

Thanks

Cox models and rare events

A recent paper by Schumie et al (doi:10.1177/09622802211060518) combines results from time to event data but with the likelihood function approximation at each site not necessarily being normal. According to the authors this is suitable for rare events where traditional cox might not give any result in a specific site if no events in one of the groups. The method is implemented in the R package EvidenceSynthesis. Each site needs to use the package, return the aggregated parameters to the analyst who then can use the same package for the meta analysis. In other words, the traditional way of doing meta analysis.

The beauty of the dsSurvival package is that you can perform the Cox regressions in a federated way using DataSHIELD. Although in case of rare events you might have trouble estimating Cox, not only because of disclosure options set in Opal but also because Cox will not give an answer. It might be something to consider using as an option in the dsSurvival package - merging the federated approach you use with a likelihood approximation Schumie et al use.

Issue with plotsurvfitDS after using ds.Surv and ds.survfit

Describe the bug
Hello, when using dsSurvivalClient::ds.Surv and dsSurvivalClient::ds.survfit I have an issue. I cannot plot the output with plotsurvfitDS as it is an object and not a vector, making the ds.plotsurvfit.R code failing at line 119.

To Reproduce
Steps to reproduce the behavior:

ds.Surv(time="D_patients$dob_day", time2="D_patients$dod_day", "D_patients$expire_flag", type="counting", objectname='surv_object')
ds.survfit(formula='surv_object~1', objectname='survfit_object')
ds.plotsurvfit(formula='surv_object')

Generates the error:

[1] "Command 'plotsurvfitDS(formula = \"surv_object\", NULL)' failed on 'abc': Error while evaluating 'dsSurvival::plotsurvfitDS(formula = \"surv_object\", NULL)' -> Error : $ operator is invalid for atomic vectors\n"

Improve feedback to user

At the moment most of the functions don't return a message to the user that lets them know if things have worked - they just return NULL

If you look at a lot of assign functions (e.g. ds.dataFrame) it checks whether the object was created on the serverside and confirms this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.