##chargement des packages----
library(questionr)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.1     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tableone)
library(labelled)
library(gtsummary)
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library(readxl)
library(effects)
## Le chargement a nécessité le package : carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
library(survival)
library(survminer)
## Le chargement a nécessité le package : ggpubr
## 
## Attachement du package : 'survminer'
## 
## L'objet suivant est masqué depuis 'package:survival':
## 
##     myeloma
library(ggplot2)
library(dplyr)
library(knitr)
library(cowplot)
## 
## Attachement du package : 'cowplot'
## 
## L'objet suivant est masqué depuis 'package:ggpubr':
## 
##     get_legend
## 
## L'objet suivant est masqué depuis 'package:lubridate':
## 
##     stamp
##chargement des données 

bddpajea_050225 <- read_excel("Y:/fp/FAC/2024-2025/Thèses/Pauline Jeanselme/bddpajea_050225.xlsx")

venlalt<-filter(bddpajea_050225, evaluable=="oui")

##recodage des variables et bases de données le cas échéant----
venlalt$old65<-ifelse(venlalt$age_initiation>65, 1, 0)
venlalt$overalresponse<-ifelse(venlalt$mro =="rc"| venlalt$mro =="rp", 1, 0)


##renommer des variables pour présentation dans les tableaux de résultats
library(labelled)
var_label(venlalt$old65) <- "Patients older than 65"
var_label(venlalt$greffe_pre_ven) <- "Previous allograft"
var_label(venlalt$age_initiation) <- "Age at initiation"
var_label(venlalt$nb_ligne_avant_ven) <- "N previous lines"
var_label(venlalt$blastose) <- "% of circulating blasts"
var_label(venlalt$blastes_medullaires) <- "% of medullar blasts"
var_label(venlalt$oms_diagnostic) <- "Performans status at diagnosis"
var_label(venlalt$infiltration_snc) <- "Patients wiht cns inflitration"
var_label(venlalt$event_rc) <- "Patients wiht complete response"
var_label(venlalt$mro) <- "Best response observed"
var_label(venlalt$allogreffe_postven) <- "Patients who underwent allograft"
var_label(venlalt$consequence_clinique_toxicite) <- "Patients with clinically relevant toxicity"
var_label(venlalt$sexe) <- "Sex"
var_label(venlalt$diagnostic) <- "Disease"
var_label(venlalt$overalresponse) <- "Overall response rate"

##tableau descriptif population globales ----
tbl_summary(
  venlalt, include = c("age_initiation","old65","sexe", "diagnostic", "nb_ligne_avant_ven","greffe_pre_ven", "blastose", "blastes_medullaires", "oms_diagnostic", "infiltration_snc" ),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 161
Age at initiation 54 (37, 65)
Patients older than 65 4 (25.0%)
Sex
    F 5 (31.2%)
    H 11 (68.8%)
Disease
    LAL biclonale 1 (6.2%)
    LAL ETP 2 (12.5%)
    LAL near ETP 1 (6.2%)
    LAL T 5 (31.2%)
    LAL T near ETP 3 (18.8%)
    LL T 4 (25.0%)
N previous lines
    0 4 (25.0%)
    1 1 (6.2%)
    2 7 (43.8%)
    3 3 (18.8%)
    4 1 (6.2%)
Previous allograft 6 (37.5%)
% of circulating blasts
    0 4 (36.4%)
    0.026 1 (9.1%)
    0.25 1 (9.1%)
    0.28 1 (9.1%)
    0.52 1 (9.1%)
    0.67 1 (9.1%)
    0.93 1 (9.1%)
    0.96 1 (9.1%)
    Unknown 5
% of medullar blasts 0.45 (0.10, 0.91)
    Unknown 2
Performans status at diagnosis
    0 2 (12.5%)
    1 8 (50.0%)
    2 1 (6.2%)
    NR 5 (31.2%)
Patients wiht cns inflitration 1 (6.2%)
1 Median (IQR); n (%)
##variables continunes, variantes mediane [min-max]
tbl_summary(
  venlalt, include = c("age_initiation","old65","sexe", "diagnostic", "nb_ligne_avant_ven","greffe_pre_ven", "blastose", "blastes_medullaires", "oms_diagnostic", "infiltration_snc" ),
  statistic = all_continuous() ~ "{median} [{min} - {max}]",
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 161
Age at initiation 54 [18 - 75]
Patients older than 65 4 (25.0%)
Sex
    F 5 (31.2%)
    H 11 (68.8%)
Disease
    LAL biclonale 1 (6.2%)
    LAL ETP 2 (12.5%)
    LAL near ETP 1 (6.2%)
    LAL T 5 (31.2%)
    LAL T near ETP 3 (18.8%)
    LL T 4 (25.0%)
N previous lines
    0 4 (25.0%)
    1 1 (6.2%)
    2 7 (43.8%)
    3 3 (18.8%)
    4 1 (6.2%)
Previous allograft 6 (37.5%)
% of circulating blasts
    0 4 (36.4%)
    0.026 1 (9.1%)
    0.25 1 (9.1%)
    0.28 1 (9.1%)
    0.52 1 (9.1%)
    0.67 1 (9.1%)
    0.93 1 (9.1%)
    0.96 1 (9.1%)
    Unknown 5
% of medullar blasts 0.45 [0.00 - 0.99]
    Unknown 2
Performans status at diagnosis
    0 2 (12.5%)
    1 8 (50.0%)
    2 1 (6.2%)
    NR 5 (31.2%)
Patients wiht cns inflitration 1 (6.2%)
1 Median [Range]; n (%)
##réponses et toxicités

tbl_summary(
  venlalt, include = c("mro","overalresponse", "event_rc","allogreffe_postven", "consequence_clinique_toxicite"),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 161
Best response observed
    dc 1 (6.2%)
    pd 3 (18.8%)
    rc 10 (62.5%)
    rp 2 (12.5%)
Overall response rate 12 (75.0%)
Patients wiht complete response 10 (62.5%)
Patients who underwent allograft 4 (25.0%)
Patients with clinically relevant toxicity 6 (37.5%)
1 n (%)
##Durée de réponse 

km_duree_reponse<-survfit(Surv(venlalt$duree_reponse, venlalt$evt_duree_reponse)~1)

km_duree_reponse
## Call: survfit(formula = Surv(venlalt$duree_reponse, venlalt$evt_duree_reponse) ~ 
##     1)
## 
##       n events median 0.95LCL 0.95UCL
## [1,] 16     10    9.4    2.63      NA
##Survies

##PFS 

km_pfs<-survfit(Surv(venlalt$pfs, venlalt$evt_pfs)~1)

km_pfs
## Call: survfit(formula = Surv(venlalt$pfs, venlalt$evt_pfs) ~ 1)
## 
##       n events median 0.95LCL 0.95UCL
## [1,] 16     11   6.87     4.2      NA
ggsurvplot(km_pfs, data = venlalt,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=3,
           surv.median.line = "hv"
)

##PFS censurée à la greffe

km_pfs_censure_greffe<-survfit(Surv(venlalt$pfs_censure_greffe, venlalt$evt_pfs_censure_greffe)~1)

km_pfs_censure_greffe
## Call: survfit(formula = Surv(venlalt$pfs_censure_greffe, venlalt$evt_pfs_censure_greffe) ~ 
##     1)
## 
##       n events median 0.95LCL 0.95UCL
## [1,] 16     10      6     4.2      NA
ggsurvplot(km_pfs_censure_greffe, data = venlalt,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=3,
           surv.median.line = "hv"
)

##OS

km_os<-survfit(Surv(venlalt$os, venlalt$evt_os)~1)

km_os
## Call: survfit(formula = Surv(venlalt$os, venlalt$evt_os) ~ 1)
## 
##       n events median 0.95LCL 0.95UCL
## [1,] 16      9   27.4    5.83      NA
ggsurvplot(km_os, data = venlalt,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=3,
           surv.median.line = "hv"
)