Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ADAL01 #116

Merged
merged 26 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1f34733
Add ADAL01 - missing 4 columns
edelarua Sep 8, 2023
b573710
Update tlg-c index
edelarua Sep 8, 2023
7500ccf
Revert index changes for now to avoid cluttering this PR
edelarua Sep 8, 2023
3d5a5d9
Remove unnecessary columns
edelarua Sep 8, 2023
195d4ad
Merge branch 'main' into 37_adal01@main
edelarua Sep 8, 2023
dd18638
Merge branch 'main' into 37_adal01@main
Melkiades Sep 19, 2023
8f9b155
Merge branch 'main' into 37_adal01@main
edelarua Sep 20, 2023
f75239a
Merge branch 'main' into 37_adal01@main
edelarua Sep 20, 2023
1f047fe
Comment out broken columns
edelarua Sep 20, 2023
1b12da8
Convert 0 AVAL_pk values to NA
edelarua Sep 20, 2023
0ba5d01
Merge 1b12da89622ea55ff8b8478aca269265f3a807fd into 41f1d79448d1ba76e…
edelarua Sep 20, 2023
96ffa5d
[skip actions] Restyle files
github-actions[bot] Sep 20, 2023
f60e542
Empty commit
edelarua Sep 20, 2023
b93be66
Merge branch 'main' into 37_adal01@main
shajoezhu Jan 9, 2024
1325ae3
Update adal01
Sep 28, 2024
d00ea5d
Merge branch 'main' into 37_adal01@main
shajoezhu Sep 28, 2024
aedbeef
Remove comment out
Sep 28, 2024
151d846
Update book/listings/pharmacokinetic/adal01.qmd
shajoezhu Sep 28, 2024
7ae83c4
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 28, 2024
70c5077
Update snapshot
edelarua Sep 30, 2024
34a1304
Update snap
edelarua Sep 30, 2024
46302eb
Empty-Commit
shajoezhu Oct 10, 2024
29ac7fe
Update book/listings/pharmacokinetic/adal01.qmd
shajoezhu Oct 10, 2024
abcb9bf
Update book/listings/pharmacokinetic/adal01.qmd
shajoezhu Oct 10, 2024
9dc6188
Update rbmit01.qmd
shajoezhu Oct 10, 2024
c34f282
Merge branch 'main' into 37_adal01@main
shajoezhu Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions book/listings/pharmacokinetic/adal01.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
title: ADAL01
subtitle: Listing of Anti-Drug Antibody Data for Patients with At Least One ADA Sample Datum by Treatment
---

------------------------------------------------------------------------

{{< include ../../test-utils/envir_hook.qmd >}}
shajoezhu marked this conversation as resolved.
Show resolved Hide resolved

::: panel-tabset
## Data Setup

```{r setup, message=FALSE}
#| code-fold: show

library(dplyr)
library(rlistings)
library(scda)

adpc <- synthetic_cdisc_dataset("latest", "adpc")
adab <- synthetic_cdisc_dataset("latest", "adab")
shajoezhu marked this conversation as resolved.
Show resolved Hide resolved

trt <- "A: Drug X"
min_titer_ada <- 1.10
min_titer_nab <- 1.10
min_conc <- 3.0

if (unique(adpc$RELTMU) == "hr") adpc$NFRLT <- adpc$NFRLT / 24
adpc_f <- adpc %>% filter(PARAM == "Plasma Drug X")


drug_a <- unique(adab$PARCAT1)[1]
drugcd <- unique(adab$PARAMCD[adab$PARAM == "Antibody titer units"])[1]
conc_u <- unique(adpc_f$AVALU)

adpc_f <- adpc_f %>% select(USUBJID, NFRLT, AVAL)
adab1 <- adab %>%
filter(ARM == trt) %>%
select(-PARAM, -PARCAT1, -AVALC, -AVALU) %>%
left_join(
adpc_f,
by = c("USUBJID", "NFRLT"),
suffix = c("_ab", "_pk")
) %>%
filter(!is.na(AVAL_ab))

adab_f <- adab1 %>%
tidyr::pivot_wider(
id_cols = c(USUBJID, VISIT, NFRLT, ISTPT, AVAL_pk),
names_from = PARAMCD,
values_from = AVAL_ab
)
# Select the necessary ADA parameters
adab_f1 <- adab_f %>%
select(USUBJID, VISIT, NFRLT, ISTPT, AVAL_pk, R1800000, R1800001, RESULT1, RESULT2, ADASTAT1, ADASTAT2) %>%
mutate(ADA = R1800000, NAB = R1800001) %>% select(-R1800000, -R1800001)

# %>%
# rename(
# RES_ADA = `ADA interpreted per sample result`,
# TES_ADA = `Treatment Emergent - Positive`,
# TU_ADA = `Antibody titer units`,
# RES_NAB = `NAB interpreted per sample result`,
# TES_NAB = `Treatment Emergent - Positive, Neutralizing Antibody`,
# TU_NAB = `Neutralizing Antibody titer units`
# )

# Find subject level ADA status
adab_s <- adab_f1 %>% select(USUBJID, ADASTAT1, ADASTAT2) %>% filter(!is.na(ADASTAT1), !is.na(ADASTAT2))
# Find time-vary ADA records
adab_r <- adab_f1 %>% select(-ADASTAT1, -ADASTAT2) %>% filter(!is.na(VISIT))

adab_o <- adab_r %>% left_join(adab_s, by = "USUBJID")

out <- adab_o %>%
mutate(AVAL_pk = ifelse(AVAL_pk == 0, NA, AVAL_pk)) %>%
mutate(NFRLT = as.numeric(NFRLT)) %>%
mutate(
RESULT1 = ifelse(RESULT1 == 1, "Positive", "Negative"),
RESULT2 = ifelse(RESULT2 == 1, "Positive", "Negative"),
ADASTAT1 = ifelse(ADASTAT1 == 1, "Positive", "Negative"),
ADASTAT2 = ifelse(ADASTAT2 == 1, "Positive", "Negative")
,
# ADA = ifelse(ADA < min_titer_ada, NA, ADA),
# NAB = ifelse(NAB < min_titer_nab, NA, NAB),
AVAL_pk = ifelse(AVAL_pk < min_conc, "BLQ", AVAL_pk)
) %>%
select(
USUBJID, VISIT, ISTPT, NFRLT, ADA, NAB, RESULT1, RESULT2, ADASTAT1, ADASTAT2,
AVAL_pk
) %>%
mutate_at(
c("NFRLT", "ADA", "NAB", "AVAL_pk"),
~ ifelse(is.na(.), replace(., is.na(.), "N/A"), format(round(., 2), nsmall = 2))
)

var_labels(out) <- names(out)

out <- out %>%
arrange(USUBJID, VISIT, desc(ISTPT), NFRLT) %>%
group_by(USUBJID) %>%
mutate(ADASTAT1 = ifelse(row_number() == 1, ADASTAT1, ""),
ADASTAT2 = ifelse(row_number() == 1, ADASTAT2, "")) %>% # Keep only the first value in ADA status, set others to ""
var_relabel(
USUBJID = "Subject ID",
VISIT = "Visit",
ISTPT = "Timepoint",
NFRLT = "Nominal\nTime\n(hr)",
RESULT1 = "Sample\nADA\nResult",
ADA = "ADA\nTiter\nUnits\n(1)",
ADASTAT1 = "Patient\nTreatment\nEmergent ADA\nStatus",
RESULT2 = "Sample\nNeutralizing\nAntibody\n(NAb) Result",
NAB = "NAb\nTiter\nUnits\n(2)",
ADASTAT2 = "Patient\nTreatment\nEmergent NAb\nStatus",
AVAL_pk = paste0("Drug\nConcentration\n(", conc_u, ") (3)")
)


```

## Standard Listing

```{r lsting, test = list(lsting = "lsting")}
lsting <- as_listing(
out,
key_cols = c("USUBJID", "VISIT"),
disp_cols = names(out),
main_title = paste0(
"Listing of Anti-", drugcd, " Antibody Data for Patients with At Least One ADA Sample Datum by Treatment, ",
"PK Population\nProtocol: ", drug_a
),
subtitles = paste("\nTreatment Group:", trt),
main_footer = "(1) Minimum reportable titer = 1.10 (example only)
(2) Minimum reportable titer = 1.10 (example only)
(3) Minimum reportable concentration = 3.0 (example only)
BLQ = Below Limit of Quantitation, LTR = Lower than Reportable, N/A = Not Applicable, N.C. = Not Calculable,
ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies)
ROXXXXXXX is also known as [drug]"
)

tail(lsting, 50)[1:24, ]
```

{{< include ../../test-utils/save_results.qmd >}}
shajoezhu marked this conversation as resolved.
Show resolved Hide resolved

{{< include ../../repro.qmd >}}
:::
21 changes: 21 additions & 0 deletions package/tests/testthat/_snaps/adal01/markdown-snaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# lsting

```
Code
print(data_snap[[i]])
Output
# A tibble: 24 × 9
USUBJID VISIT ISTPT NFRLT RES_ADA TU_ADA RES_NAB TU_NAB AVAL_pk
<lstng_ky> <lstng_ky> <fct> <dbl> <chr> <chr> <chr> <chr> <chr>
1 AB12345-RUS-16-id-165 Day 2 24H 24 Negative N/A NA N/A 0.00
shajoezhu marked this conversation as resolved.
Show resolved Hide resolved
2 AB12345-RUS-16-id-165 Day 2 24H 24 NA N/A Negative N/A 0.00
3 AB12345-RUS-18-id-359 Day 1 Predose 0 NA BLQ Positive 1.07 0.00
4 AB12345-RUS-18-id-359 Day 1 Predose 0 Positive N/A NA N/A 0.00
5 AB12345-RUS-18-id-359 Day 2 24H 24 Negative N/A NA N/A 0.00
6 AB12345-RUS-18-id-359 Day 2 24H 24 NA N/A Negative N/A 0.00
7 AB12345-RUS-6-id-77 Day 1 Predose 0 Negative N/A NA N/A 0.00
8 AB12345-RUS-6-id-77 Day 1 Predose 0 NA N/A Negative N/A 0.00
9 AB12345-RUS-6-id-77 Day 2 24H 24 NA 1.16 Positive 1.16 0.00
10 AB12345-RUS-6-id-77 Day 2 24H 24 Positive N/A NA N/A 0.00
# i 14 more rows
```
Loading