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
a multi-state model in CENTER-TBI.
The workflow is completely automated using snakemake and a singularity
container with the required dependencies is awailable at [zenodo.org](https://zenodo.org/record/2641161)
(DOI: 10.5281/zenodo.2641161).
Execution requires
Singularity >= 2.6.0 is required to run the code in a container, alternatively
the dependencies can be installed manually (check the `container-recipe` file).
1. access to the CENTER-TBI Neurobot database at https://center-tbi.incf.org/ or
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
git clone https://git.center-tbi.eu/kunzmann/gose-6mo-imputation-production.git
cd gose-6mo-imputation-production
```
Next, download the pre-build container image from zenodo.org via the
provided script
```bash
./scripts/download-container
Open this folder in Rstudio. This should activate the prepared
R environment automatically and locall;y install any R package dependencies.
See the documentation for [renv](https://rstudio.github.io/renv/articles/renv.html)
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
directory.
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]
install.packages("renv")
renv::restore(clean = TRUE, prompt = FALSE)
```
The required data set (for version 1.2 on the Neurobot staging server) can
then automatically be downloaded via
```bash
singularity exec container.sif snakemake download
in an R console with working directory set to `[my-working-direcrtory]/gose-6mo-imputation-production`
where `[my-working-direcrtory]` is the location on yur file system that you
placed the repository in.
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
directly be places in the `data` subfolder (see `scripts/check-inputs` for
detailed specification).
The imputation can then be started by invoking
```bash
singularity exec container.sif snakemake impute
subjectId
Outcomes.DerivedCompositeGOSE
Outcomes.DerivedCompositeGOSEDaysPostInjury
Subject.Age
Subject.PatientType
Subject.DeathDate
```
This produces a .html and a .csv file with imputed values in the subfolder
`output`.
in exactly this order.
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(
censor.states = 2:7, # cannot be dead since these were filtered previously
control = list(
fnscale = 12000,
maxit = 10,# 10^4,
maxit = 10^4,
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