##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 

data_guillaume_cbnpc <- read_excel("Y:/fp/FAC/2023-2024/Memoires DES/Guillaume Flandin/20240322/data_guillaume_cbnpc.xlsx")
## New names:
## • `Détail` -> `Détail...42`
## • `Détail` -> `Détail...49`
## • `Détail` -> `Détail...58`
## • `Détail` -> `Détail...60`
pneumo_g<-filter(data_guillaume_cbnpc, c(eligible_etude=="1" ))

##recodage bases de données le cas échéant----
pneumo_g$charlson_2<-ifelse(pneumo_g$charlson>=2, 1, 0)


##renommer des variables pour présentation dans les tableaux de résultats
library(labelled)
var_label(pneumo_g$type_evt) <- "evenement lié au médicament"
var_label(pneumo_g$consequence_evt) <- "conséquence des evenements liés au médicament"
var_label(pneumo_g$meta_snc) <- "presence de métastase cérébrale"
var_label(pneumo_g$polymedique) <- "patient polymediqué"         
var_label(pneumo_g$comprehension) <- "patient avec difficulté de comprehension"
var_label(pneumo_g$pb_social) <- "patient avec difficulté sociale"
var_label(pneumo_g$actif_pro) <- "patient avec activité professionnelle"
var_label(pneumo_g$ddi) <- "patient avec interaction médicamenteuse"
var_label(pneumo_g$evt_tox) <- "patient avec evenement lié au médicament"
var_label(pneumo_g$charlson_2) <- "score de charlson >=2 (hors tumeur)" 
var_label(pneumo_g$patient_seul) <- "patient vivant seul"
##réation de variables à plusieurs catégorie selon valeurs variable continue



##tableau descriptif population globales ----
tbl_summary(
  pneumo_g, include = c("age", "pathologie", "dci", "polymedique","stade", "ligne", "evt_tox", "charlson", "charlson_2", "meta_snc", "comprehension", "pb_social", "actif_pro", "patient_seul", "ddi"),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 941
age 67 (58, 75)
pathologie
    ADK Bronchique 82 (87.2%)
    ADK Thymique 2 (2.1%)
    Carcinome Epidermoïde 1 (1.1%)
    Carcinome épidermoïde bronchique 1 (1.1%)
    Carcinome épidermoïde pulmonaire 1 (1.1%)
    Carcinome épidermoïde thymique 1 (1.1%)
    THYMOME 1 (1.1%)
    Thymome B3 1 (1.1%)
    Tumeur carcinoïde 1 (1.1%)
    Tumeur carcinoïde atypique 1 (1.1%)
    Tumeur carcinoïde typique, neuroendocrine 1 (1.1%)
    Tumeur neuro endocrine 1 (1.1%)
dci
    Afatinib 2 (2.1%)
    AFINITOR 3 (3.2%)
    ALECTINIB 4 (4.3%)
    BRIGATINIB 7 (7.4%)
    CABOZANTINIB 1 (1.1%)
    CRIZOTINIB 2 (2.1%)
    DABRAFENIB / TRAME 1 (1.1%)
    Dabrafénib / Tramétinib 6 (6.4%)
    Erlotinib 1 (1.1%)
    Everolimus 4 (4.3%)
    GIOTRIF 3 (3.2%)
    IRESSA 1 (1.1%)
    Lorlatinib 1 (1.1%)
    LORLATINIB 8 (8.5%)
    MOBOCERTINIB 2 (2.1%)
    Osimertinib 13 (13.8%)
    OSIMERTINIB 1 (1.1%)
    Osimertinib + Crizotinib 1 (1.1%)
    PRALSETINIB 1 (1.1%)
    SOTORASIB 8 (8.5%)
    SUTENT 1 (1.1%)
    TAGRISSO 22 (23.4%)
    XELODA+TEMODAL 1 (1.1%)
patient polymediqué 44 (46.8%)
stade
    Localement avancé 2 (2.1%)
    métastatique 58 (61.7%)
    Métastatique 33 (35.1%)
    Primitif 1 (1.1%)
ligne
    1ère ligne 39 (41.5%)
    2ème ligne 18 (19.1%)
    3ème ligne 21 (22.3%)
    4ème ligne 6 (6.4%)
    5ème ligne 6 (6.4%)
    6ème ligne 2 (2.1%)
    8ème ligne 1 (1.1%)
    Récidive 1 (1.1%)
patient avec evenement lié au médicament 30 (31.9%)
charlson
    0 4 (4.3%)
    1 13 (13.8%)
    2 20 (21.3%)
    3 26 (27.7%)
    4 17 (18.1%)
    5 7 (7.4%)
    6 4 (4.3%)
    7 1 (1.1%)
    8 2 (2.1%)
score de charlson >=2 (hors tumeur) 77 (81.9%)
presence de métastase cérébrale 29 (30.9%)
patient avec difficulté de comprehension 6 (6.4%)
patient avec difficulté sociale 5 (5.3%)
patient avec activité professionnelle 28 (30.8%)
    Unknown 3
patient vivant seul 11 (12.1%)
    Unknown 3
patient avec interaction médicamenteuse 48 (78.7%)
    Unknown 33
1 Median (IQR); n (%)
##Description des evènements liés aux traitement 
tbl_summary(
  pneumo_g, include = c("type_evt"),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 941
evenement lié au médicament
    0 64 (68.1%)
    ANOREXIE ET DIARRHEES GRADE 2 1 (1.1%)
    Anorexie GRADE 2 1 (1.1%)
    ASTHENIE 1 (1.1%)
    Asthénie / hyperbilirubinémie 1 (1.1%)
    ASTHENIE / Perturbation triglycérides / Glycémie 1 (1.1%)
    Asthénie et nausées grade 3 1 (1.1%)
    Asthénie grade 1 / Myalgies grade 1 1 (1.1%)
    Asthénie, AEG 1 (1.1%)
    COLITE / MTEV 1 (1.1%)
    Conjonctivite bilatérale / Mucite / Syndrome Lyell 1 (1.1%)
    CRAMPES DIGESTIVES 1 (1.1%)
    CYTOLYSE HEPATIQUE 1 (1.1%)
    CYTOLYSE HEPATIQUE GRADE 4 1 (1.1%)
    DECOMPENSATION CARDIAQUE 1 (1.1%)
    Décompensation cardiaque gauche / OAP Dr Mazières ne retrouve pas d'imputabilité dans la biblio à posteriori de l'osimertinib = reprise ttt 1 (1.1%)
    DELIRE, Troubles Psy 1 (1.1%)
    DIARRHEES / CONSTIPATION 1 (1.1%)
    DIARRHEES GRADE 2 1 (1.1%)
    Diarrhées grade 2 1 (1.1%)
    DIARRHEES GRADE 2 / VOMISSEMENTS GRADE 2 1 (1.1%)
    EMBOLIE PULMONAIRE (THROMBUS INTRACARDIAQUE) 1 (1.1%)
    Hypertension 1 (1.1%)
    OEDEMES GRADE 2 / DEPRESSION (dérégulation thymique) / HYPERTRIGLYCERIDEMIE 1 (1.1%)
    Pneumopathie grade 2, OMI et crampes grade 2 1 (1.1%)
    Pneumopathie liée au traitement 1 (1.1%)
    Toxicité cutanée grade 1 / diarrhées grade 1 1 (1.1%)
    TOXICITE CUTANEO MUQUEUSE / TOXICIT2 Digestive grade 2 1 (1.1%)
    TOXIDERMIE GRADE 2 1 (1.1%)
    TROUBLES DIGESTIFS GRADE 2-3 (DIARRHEES / CONSTIPATIONS) 1 (1.1%)
    TROUBLES MNESIQUES / ASTHENIE 1 (1.1%)
1 n (%)
##Conséquences des évènements liés aux traitement
tbl_summary(
  pneumo_g, include = c("consequence_evt"),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 941
conséquence des evenements liés au médicament
    ARRET DEFINITIF 7 (23.3%)
    ARRET DEFINITIF CRIZOTINIB 1 (3.3%)
    ARRET DEFINITIF MEKINIST 1 (3.3%)
    ARRET TEMPORAIRE 3 (10.0%)
    Arret temporaire / Concession posologique 2 (6.7%)
    Concession posologique 16 (53.3%)
    Unknown 64
1 n (%)
#Courbe de Kaplan Meier survie sans événement toxique lié au médicament----

km_pftox<-survfit(Surv(pneumo_g$pftox, pneumo_g$evt_tox)~1)
km_pftox
## Call: survfit(formula = Surv(pneumo_g$pftox, pneumo_g$evt_tox) ~ 1)
## 
##       n events median 0.95LCL 0.95UCL
## [1,] 94     30     NA      NA      NA
ggsurvplot(km_pftox, data = pneumo_g,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=2,
           surv.median.line = "hv"
)
## Warning in .add_surv_median(p, fit, type = surv.median.line, fun = fun, :
## Median survival not reached.

##modèle de cox----
### modèle univarié avec tableau de résultat----
####charslon
modsurv<-coxph(Surv(pftox, evt_tox)~charlson, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
charlson 1.18 0.97, 1.43 0.11
1 HR = Hazard Ratio, CI = Confidence Interval
####charslon >=2
modsurv<-coxph(Surv(pftox, evt_tox)~charlson_2, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
score de charlson >=2 (hors tumeur) 2.63 0.79, 8.70 0.11
1 HR = Hazard Ratio, CI = Confidence Interval
####présence de méta cérébrale
modsurv<-coxph(Surv(pftox, evt_tox)~meta_snc, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
presence de métastase cérébrale 0.74 0.33, 1.66 0.5
1 HR = Hazard Ratio, CI = Confidence Interval
####problème de compréhension
modsurv<-coxph(Surv(pftox, evt_tox)~comprehension, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient avec difficulté de comprehension 1.67 0.50, 5.51 0.4
1 HR = Hazard Ratio, CI = Confidence Interval
####problème social
modsurv<-coxph(Surv(pftox, evt_tox)~pb_social, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient avec difficulté sociale 1.08 0.26, 4.56 >0.9
1 HR = Hazard Ratio, CI = Confidence Interval
####patient vivant seul
modsurv<-coxph(Surv(pftox, evt_tox)~patient_seul, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient vivant seul 2.39 0.96, 5.92 0.061
1 HR = Hazard Ratio, CI = Confidence Interval
####activité professionnelle
modsurv<-coxph(Surv(pftox, evt_tox)~actif_pro, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient avec activité professionnelle 0.85 0.37, 1.95 0.7
1 HR = Hazard Ratio, CI = Confidence Interval
####interaction médicamenteuse
modsurv<-coxph(Surv(pftox, evt_tox)~ddi, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient avec interaction médicamenteuse 0.74 0.23, 2.33 0.6
1 HR = Hazard Ratio, CI = Confidence Interval
####patient polymédiqué
modsurv<-coxph(Surv(pftox, evt_tox)~polymedique, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
patient polymediqué 1.12 0.54, 2.29 0.8
1 HR = Hazard Ratio, CI = Confidence Interval
##Analyse multivariée
modsurv<-coxph(Surv(pftox, evt_tox)~charlson_2 + patient_seul, data=pneumo_g)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
score de charlson >=2 (hors tumeur) 2.50 0.75, 8.32 0.14
patient vivant seul 2.35 0.95, 5.84 0.065
1 HR = Hazard Ratio, CI = Confidence Interval