# Load required libraries
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── 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(knitr)
library(kableExtra)
Attaching package: 'kableExtra'
The following object is masked from 'package:dplyr':
group_rows
# Table 1: The rate and risk factors for pegasparaginase toxicities in adults
toxicity_rates <- data.frame(
Toxicity = c("Hypersensitivity", "Hyperbilirubinemia", "Pancreatitis",
"Hypertriglyceridemia", "Thrombosis", "Hypofibrinogenemia (<100)",
"Hyperglycemia"),
Any_Grade_Percent = c("7-22", "86", "24", "77", "11-27", "48-51", "91"),
High_Grade_3_Plus_Percent = c("4-10", "24-39", "5-13", "11-51", "11-27", "48-51", "31-33"),
Risk_Factors = c(
"Second dose and future doses, HLA-DRB1*07:01 polymorphism, no concurrent rituximab administration, younger age, no premedications",
"During the induction cycle, older age, obesity, higher dose of pegasparaginase, low albumin, low platelet count, CC genotype of rs4880 polymorphism",
"Older age, high-risk ALL stratification, germline polymorphisms in ULK2 variant rs281366 and RGS6 variant rs17179470",
"Beyond first cycle, high BMI, younger age",
"First cycle, older age, obesity, mediastinal mass, cryoprecipitate replacement",
"First cycle, severe obesity (BMI >35)",
"Concomitant use of steroid"
)
)
# Table 2: Management and prevention of pegasparaginase toxicities
management_prevention <- data.frame(
Toxicity = c("Hypersensitivity", "Hyperbilirubinemia", "Transaminitis",
"Pancreatitis", "Hypertriglyceridemia", "Thrombosis",
"Hypofibrinogenemia", "Hyperglycemia"),
Management = c(
"Administer corticosteroid and antihistamine; Replace future doses of L-asparaginase with Erwinia asparaginase",
"Adjust other medications and delay subsequent cycle until grade 1 is achieved; Consider L-carnitine and ursodiol; Not an indication to discontinue pegasparaginase or reduce the dose",
"Consider delaying therapy for grades 3 and 4 until resolved to grade 2; Consider L-carnitine; Not an indication to discontinue pegasparaginase or reduce dose",
"Early diagnosis and treatment; Supportive medical care; Further avoid asparaginase therapy of any form after clinical asparaginase-associated pancreatitis; No intervention for chemical pancreatitis in the absence of clinical or imaging features",
"Consider gemfibrozil; Not an indication to discontinue pegasparaginase",
"Anticoagulation 'not clear'; Maintain adequate platelet counts while patient is receiving anticoagulation; Not an indication to discontinue pegasparaginase",
"Cryoprecipitate replacement only during active bleeding or before procedures; Not an indication to discontinue pegasparaginase",
"Insulin and other anti-glycemic medications; Not an indication to discontinue pegasparaginase"
),
Prevention = c(
"Pre-medicate with hydrocortisone and antihistamine; Infuse slowly over 2 h",
"Avoid hepatotoxic medications or adjust doses; Not an indication to discontinue pegasparaginase or reduce the dose",
"Avoid hepatotoxic medications or adjust doses; Not an indication to discontinue pegasparaginase or reduce dose",
"Avoid administering pegasparaginase or any other formulation of asparaginase after clinical asparaginase-associated pancreatitis",
"Not an indication to discontinue pegasparaginase",
"ATIII replacement for low activity level is not yet standard; Prophylactic anticoagulation is controversial; Avoid replacement with cryoprecipitate to correct laboratory abnormalities in the absence of clinical bleed",
"Not an indication to discontinue pegasparaginase",
"Not an indication to discontinue pegasparaginase"
)
)
# Case summaries
case_summaries <- data.frame(
Case = 1:5,
Age = c(26, 36, 41, 44, 22),
Sex = c("Female", "Female", "Female", "Female", "Male"),
ALL_Type = c("B-cell", "B-cell", "T-cell", "B-cell", "B-cell"),
Toxicity = c("Allergic reaction", "Hepatotoxicity", "Thrombosis",
"Hypertriglyceridemia", "Pancreatitis"),
Grade = c("3", "4", "-", "4", "-"),
Management = c(
"Switched to Erwinia asparaginase",
"Delayed treatment 2 weeks, continued pegasparaginase",
"Enoxaparin anticoagulation, continued pegasparaginase",
"No intervention, resolved spontaneously",
"Permanently discontinued pegasparaginase"
),
Outcome = c(
"MRD-negative CR",
"MRD-negative CR after consolidation",
"No additional DVTs",
"No clinical pancreatitis",
"Started maintenance, later CNS relapse"
)
)
# Create formatted tables
print("Table 1: Rate and Risk Factors for Pegasparaginase Toxicities")[1] "Table 1: Rate and Risk Factors for Pegasparaginase Toxicities"
kable(toxicity_rates, format = "markdown",
col.names = c("Toxicity", "Any Grade (%)", "High Grade (≥3) (%)", "Risk Factors"))| Toxicity | Any Grade (%) | High Grade (≥3) (%) | Risk Factors |
|---|---|---|---|
| Hypersensitivity | 7-22 | 4-10 | Second dose and future doses, HLA-DRB1*07:01 polymorphism, no concurrent rituximab administration, younger age, no premedications |
| Hyperbilirubinemia | 86 | 24-39 | During the induction cycle, older age, obesity, higher dose of pegasparaginase, low albumin, low platelet count, CC genotype of rs4880 polymorphism |
| Pancreatitis | 24 | 5-13 | Older age, high-risk ALL stratification, germline polymorphisms in ULK2 variant rs281366 and RGS6 variant rs17179470 |
| Hypertriglyceridemia | 77 | 11-51 | Beyond first cycle, high BMI, younger age |
| Thrombosis | 11-27 | 11-27 | First cycle, older age, obesity, mediastinal mass, cryoprecipitate replacement |
| Hypofibrinogenemia (<100) | 48-51 | 48-51 | First cycle, severe obesity (BMI >35) |
| Hyperglycemia | 91 | 31-33 | Concomitant use of steroid |
print("\nTable 2: Management and Prevention of Pegasparaginase Toxicities")[1] "\nTable 2: Management and Prevention of Pegasparaginase Toxicities"
kable(management_prevention, format = "markdown")| Toxicity | Management | Prevention |
|---|---|---|
| Hypersensitivity | Administer corticosteroid and antihistamine; Replace future doses of L-asparaginase with Erwinia asparaginase | Pre-medicate with hydrocortisone and antihistamine; Infuse slowly over 2 h |
| Hyperbilirubinemia | Adjust other medications and delay subsequent cycle until grade 1 is achieved; Consider L-carnitine and ursodiol; Not an indication to discontinue pegasparaginase or reduce the dose | Avoid hepatotoxic medications or adjust doses; Not an indication to discontinue pegasparaginase or reduce the dose |
| Transaminitis | Consider delaying therapy for grades 3 and 4 until resolved to grade 2; Consider L-carnitine; Not an indication to discontinue pegasparaginase or reduce dose | Avoid hepatotoxic medications or adjust doses; Not an indication to discontinue pegasparaginase or reduce dose |
| Pancreatitis | Early diagnosis and treatment; Supportive medical care; Further avoid asparaginase therapy of any form after clinical asparaginase-associated pancreatitis; No intervention for chemical pancreatitis in the absence of clinical or imaging features | Avoid administering pegasparaginase or any other formulation of asparaginase after clinical asparaginase-associated pancreatitis |
| Hypertriglyceridemia | Consider gemfibrozil; Not an indication to discontinue pegasparaginase | Not an indication to discontinue pegasparaginase |
| Thrombosis | Anticoagulation ‘not clear’; Maintain adequate platelet counts while patient is receiving anticoagulation; Not an indication to discontinue pegasparaginase | ATIII replacement for low activity level is not yet standard; Prophylactic anticoagulation is controversial; Avoid replacement with cryoprecipitate to correct laboratory abnormalities in the absence of clinical bleed |
| Hypofibrinogenemia | Cryoprecipitate replacement only during active bleeding or before procedures; Not an indication to discontinue pegasparaginase | Not an indication to discontinue pegasparaginase |
| Hyperglycemia | Insulin and other anti-glycemic medications; Not an indication to discontinue pegasparaginase | Not an indication to discontinue pegasparaginase |
print("\nCase Summaries")[1] "\nCase Summaries"
kable(case_summaries, format = "markdown")| Case | Age | Sex | ALL_Type | Toxicity | Grade | Management | Outcome |
|---|---|---|---|---|---|---|---|
| 1 | 26 | Female | B-cell | Allergic reaction | 3 | Switched to Erwinia asparaginase | MRD-negative CR |
| 2 | 36 | Female | B-cell | Hepatotoxicity | 4 | Delayed treatment 2 weeks, continued pegasparaginase | MRD-negative CR after consolidation |
| 3 | 41 | Female | T-cell | Thrombosis | - | Enoxaparin anticoagulation, continued pegasparaginase | No additional DVTs |
| 4 | 44 | Female | B-cell | Hypertriglyceridemia | 4 | No intervention, resolved spontaneously | No clinical pancreatitis |
| 5 | 22 | Male | B-cell | Pancreatitis | - | Permanently discontinued pegasparaginase | Started maintenance, later CNS relapse |
# Create visualizations
library(ggplot2)
# Parse the toxicity rates for visualization
toxicity_viz <- toxicity_rates %>%
mutate(
Any_Grade_Min = as.numeric(str_extract(Any_Grade_Percent, "^[0-9]+")),
Any_Grade_Max = as.numeric(str_extract(Any_Grade_Percent, "[0-9]+$")),
High_Grade_Min = as.numeric(str_extract(High_Grade_3_Plus_Percent, "^[0-9]+")),
High_Grade_Max = as.numeric(str_extract(High_Grade_3_Plus_Percent, "[0-9]+$"))
) %>%
mutate(
Any_Grade_Mid = (Any_Grade_Min + coalesce(Any_Grade_Max, Any_Grade_Min)) / 2,
High_Grade_Mid = (High_Grade_Min + coalesce(High_Grade_Max, High_Grade_Min)) / 2
)
# Plot 1: Toxicity rates comparison
toxicity_plot_data <- toxicity_viz %>%
select(Toxicity, Any_Grade_Mid, High_Grade_Mid) %>%
pivot_longer(cols = -Toxicity, names_to = "Grade", values_to = "Percent") %>%
mutate(Grade = ifelse(Grade == "Any_Grade_Mid", "Any Grade", "High Grade (≥3)"))
p1 <- ggplot(toxicity_plot_data, aes(x = reorder(Toxicity, -Percent), y = Percent, fill = Grade)) +
geom_bar(stat = "identity", position = "dodge") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Pegasparaginase Toxicity Rates in Adults",
x = "Toxicity Type",
y = "Incidence (%)",
fill = "Grade") +
scale_fill_manual(values = c("Any Grade" = "#3498db", "High Grade (≥3)" = "#e74c3c"))
print(p1)
# Plot 2: Case outcomes by toxicity type
case_plot <- ggplot(case_summaries, aes(x = Toxicity, fill = Toxicity)) +
geom_bar() +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
legend.position = "none") +
labs(title = "Distribution of Case Reports by Toxicity Type",
x = "Toxicity Type",
y = "Number of Cases")
print(case_plot)
# Summary statistics
print("\n=== Summary Statistics ===")[1] "\n=== Summary Statistics ==="
print(paste("Total number of cases reviewed:", nrow(case_summaries)))[1] "Total number of cases reviewed: 5"
print(paste("Female patients:", sum(case_summaries$Sex == "Female")))[1] "Female patients: 4"
print(paste("Male patients:", sum(case_summaries$Sex == "Male")))[1] "Male patients: 1"
print(paste("Mean age:", mean(case_summaries$Age), "years"))[1] "Mean age: 33.8 years"
print(paste("Age range:", min(case_summaries$Age), "-", max(case_summaries$Age), "years"))[1] "Age range: 22 - 44 years"
print(paste("B-cell ALL cases:", sum(case_summaries$ALL_Type == "B-cell")))[1] "B-cell ALL cases: 4"
print(paste("T-cell ALL cases:", sum(case_summaries$ALL_Type == "T-cell")))[1] "T-cell ALL cases: 1"
# Export tables to CSV
write.csv(toxicity_rates, "pegasparaginase_toxicity_rates.csv", row.names = FALSE)
write.csv(management_prevention, "pegasparaginase_management.csv", row.names = FALSE)
write.csv(case_summaries, "pegasparaginase_cases.csv", row.names = FALSE)
print("\nData exported to CSV files successfully!")[1] "\nData exported to CSV files successfully!"