Skip to content

Commit

Permalink
Debugging prints
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcorneliusmartin committed Sep 8, 2024
1 parent a9576d3 commit b68316a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
16 changes: 12 additions & 4 deletions docker/vtg.survfit.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ COPY ./vtg.preprocessing/ /usr/local/R/vtg.preprocessing/
RUN Rscript -e 'install.packages("/usr/local/R/vtg.preprocessing", \
repos = NULL, type = "source")'

# Install federated survfit package
COPY ./${PKG_NAME}/src /usr/local/R/${PKG_NAME}/
RUN R -e "remove.packages('prettyunits')"
RUN R -e "install.packages('prettyunits', repos='http://cran.rstudio.com/')"

WORKDIR /usr/local/R/${PKG_NAME}
RUN Rscript -e 'library(devtools)' -e 'install_github("IKNL/vtg")'
RUN Rscript -e 'install.packages("RCurl", repos = "http://cran.rstudio.com/")'
RUN Rscript -e 'devtools::install_deps(".")'

COPY ./${PKG_NAME}/src/DESCRIPTION /usr/local/R/${PKG_NAME}/DESCRIPTION

WORKDIR /usr/local/R/${PKG_NAME}
# Somehow prettyunit crashes when installed using the `install_deps`
RUN Rscript -e 'devtools::install_deps(".", dependencies = TRUE)'

# Install federated survfit package
COPY ./${PKG_NAME}/src /usr/local/R/${PKG_NAME}/

RUN Rscript -e 'install.packages(".", repos = NULL, type = "source", INSTALL_opts = "--no-multiarch")'

# Change directory to '/app’ and create files that will be
Expand Down
2 changes: 1 addition & 1 deletion vtg.survfit/src/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Type: Package
Version: 1.0.0
Title: vtg.survfit
Description: This package can be used with vantage6
(see https://github.com/vantage6/vantage6).
(see https://github.com/vantage6/vantage6).
Encoding: UTF-8
LazyData: true
Imports:
Expand Down
6 changes: 5 additions & 1 deletion vtg.survfit/src/R/dsurvfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ dsurvfit <- function(client, formula, conf.int = 0.95, conf.type = "log", tmax =


KM <- function(vars, stratum = NULL) {
vtg::log$debug(" - [KM]")
vtg::log$debug(" - stratum: {stratum}")
master <-
if (length(vars) > 3) {
list(
Expand Down Expand Up @@ -139,7 +141,9 @@ dsurvfit <- function(client, formula, conf.int = 0.95, conf.type = "log", tmax =
extend_data = extend_data
)
stratum <- unique(unlist(node_strata))
print(stratum)
vtg::log$info("stratum:")
lapply(stratum, function (k) vtg::log$info(k))
vtg::log$info("stratum end")
master <- lapply(stratum, function(k) KM(vars, k))
names(master) <- paste0(vars[3], "=", stratum)
}
Expand Down
13 changes: 3 additions & 10 deletions vtg.survfit/test.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# Clear the environment completely
rm(list = ls(all.names = TRUE))
devtools::load_all("./vtg.preprocessing/src")
devtools::load_all("./vtg.preprocessing/R")
devtools::load_all("./vtg.survfit/src")
# This seems to be equivalent to "import x as y"
library(namespace)
tryCatch({
invisible(registerNamespace('vtg', loadNamespace('vtg')))
}, error = function(e) {
vtg::writeln("Package 'vantage.infrastructure' already loaded.")
})

library(vtg.survfit)

d1 <- read.csv("C:\\data\\euracan-node-a.csv")
d1 <- read.csv("~/data/euracan-node-a.csv")
dataset=list(d1, d1, d1)
###exapl

# formula = Surv(time, status) ~ trt
#formula = Surv(time,, status) ~ trt
formula = 'Surv(surv, deadOS) ~ b04_sex'
formula = 'Surv(surv, deadOS) ~ site'

conf.int=0.95
conf.type='log'
Expand Down

0 comments on commit b68316a

Please sign in to comment.