Commit 54cbfb2d authored by Kevin Kunzmann's avatar Kevin Kunzmann

updated docs

parent 69abd6dc
# GOSe 6mo imputation for CENTER-TBI # GOSe imputation for CENTER-TBI
This repository contains the code for imputing the 6 months GOSe using This repository contains the code for imputing the 6 months GOSe using
a multi-state model in CENTER-TBI. a multi-state model in CENTER-TBI.
The workflow is completely automated using snakemake and a singularity Execution requires
container with the required dependencies is awailable at [zenodo.org](https://zenodo.org/record/2641161)
(DOI: 10.5281/zenodo.2641161).
Singularity >= 2.6.0 is required to run the code in a container, alternatively 1. access to the CENTER-TBI Neurobot database at https://center-tbi.incf.org/ or
the dependencies can be installed manually (check the `container-recipe` file). a manually downloaded data file according to the specification given below
2. a recent version of [R](https://www.r-project.org/) (4+)
3. (optionally) the [RStudio IDE](https://rstudio.com/products/rstudio/download/)
4. (optionally) the version control system [git](https://git-scm.com/) to
easily download this repository to your local file system.
To get started, download the code and `cd` in the repository folder To get started, download the code and change into the repository folder.
Using git on a Unix system (Linux) this can be done via
```bash ```bash
git clone https://git.center-tbi.eu/kunzmann/gose-6mo-imputation-production.git git clone https://git.center-tbi.eu/kunzmann/gose-6mo-imputation-production.git
cd gose-6mo-imputation-production cd gose-6mo-imputation-production
``` ```
Next, download the pre-build container image from zenodo.org via the Open this folder in Rstudio. This should activate the prepared
provided script R environment automatically and locall;y install any R package dependencies.
```bash See the documentation for [renv](https://rstudio.github.io/renv/articles/renv.html)
./scripts/download-container in case of problems.
The required R environment can also be restored manually by invoking
``` ```
This will download the `container.sif` file (~1Gb) in the current working install.packages("renv")
directory. renv::restore(clean = TRUE, prompt = FALSE)
An automated download script via the Neurobot-API is provided but requires
that the Neurobot username and API token are available as environment variables
```bash
export NEUROBOT_USR=[your-neurobot-username]
export NEUROBOT_API=[your-neurobot-api-token]
``` ```
The required data set (for version 1.2 on the Neurobot staging server) can in an R console with working directory set to `[my-working-direcrtory]/gose-6mo-imputation-production`
then automatically be downloaded via where `[my-working-direcrtory]` is the location on yur file system that you
```bash placed the repository in.
singularity exec container.sif snakemake download
To execute the markdown file the recorded GOSe values are required
in a .csv file named `tbl_gose.csv` in the same folder, i.e. `[my-working-direcrtory]/gose-6mo-imputation-production/tbl_gose.csv`.
The .csv file must contain the Neurobot variables
``` ```
Alternatively, a .csv file with the correct column names / ordering can subjectId
directly be places in the `data` subfolder (see `scripts/check-inputs` for Outcomes.DerivedCompositeGOSE
detailed specification). Outcomes.DerivedCompositeGOSEDaysPostInjury
The imputation can then be started by invoking Subject.Age
```bash Subject.PatientType
singularity exec container.sif snakemake impute Subject.DeathDate
``` ```
This produces a .html and a .csv file with imputed values in the subfolder in exactly this order.
`output`. At the time of writing this report the newest staging data set could be
accessed via the saved link `https://neurobot-stage.incf.org/_5f476d41eedb867816a10376`.
Finally, open the project in Rstudio, open the `imputation-report.Rmd` in
Rstudio and [`knit' it](https://rmarkdown.rstudio.com/).
This produces a .html with a basic report and a `tbl_gose_imputed.csv`
file with imputed values.
...@@ -212,7 +212,7 @@ fit <- msm::msm( ...@@ -212,7 +212,7 @@ fit <- msm::msm(
censor.states = 2:7, # cannot be dead since these were filtered previously censor.states = 2:7, # cannot be dead since these were filtered previously
control = list( control = list(
fnscale = 12000, fnscale = 12000,
maxit = 10,# 10^4, maxit = 10^4,
trace = 2 trace = 2
) )
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment