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 all 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
152 changes: 152 additions & 0 deletions book/listings/pharmacokinetic/adal01.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
title: ADAL01
subtitle: Listing of Anti-Drug Antibody Data for Patients with At Least One ADA Sample Datum by Treatment
---

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

{{< include ../../_utils/envir_hook.qmd >}}

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

library(dplyr)
library(rlistings)
library(random.cdisc.data)

adpc <- cadpc
adab <- cadab

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)


# 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

::: {.panel-tabset .nav-justified group="webr"}
## {{< fa regular file-lines sm fw >}} Preview

```{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, ]
```

`r webr_code_labels <- c("setup", "lsting")` {{< include ../../_utils/webr.qmd >}}
:::

## Data Setup

```{r setup}
#| code-fold: show
```
::::

{{< include ../../_utils/save_results.qmd >}}

{{< include ../../repro.qmd >}}
2 changes: 2 additions & 0 deletions book/tables/efficacy/rbmit01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Define which imputation method to use, then create samples for the imputation pa

```{r, warning = FALSE, opts.label = "skip_test_strict"}
#| code-fold: show


set.seed(123)
draws_method <- method_bayes()

Expand Down
20 changes: 20 additions & 0 deletions package/tests/testthat/_snaps/development/listings-ADA-adal01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# listings/ADA/adal01.qmd lsting development

Code
print(data_snap[[i]])
Output
# A tibble: 268 × 11
USUBJID VISIT ISTPT NFRLT ADA NAB RESULT1 RESULT2 ADASTAT1 ADASTAT2 AVAL_pk
<lstng_ky> <lstng_ky> <fct> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 AB12345-BRA-1-id-105 Day 1 Predose 0.00 N/A N/A Negative Negative "Negative" "Negative" N/A
2 AB12345-BRA-1-id-105 Day 2 24H 1.00 N/A N/A Negative Negative "" "" N/A
3 AB12345-BRA-1-id-134 Day 1 Predose 0.00 N/A N/A Negative Negative "Negative" "Negative" N/A
4 AB12345-BRA-1-id-134 Day 2 24H 1.00 N/A N/A Negative Negative "" "" N/A
5 AB12345-BRA-1-id-42 Day 1 Predose 0.00 N/A N/A Negative Negative "Negative" "Negative" N/A
6 AB12345-BRA-1-id-42 Day 2 24H 1.00 N/A N/A Negative Negative "" "" N/A
7 AB12345-BRA-1-id-93 Day 1 Predose 0.00 N/A N/A Negative Negative "Positive" "Negative" N/A
8 AB12345-BRA-1-id-93 Day 2 24H 1.00 1.01 1.01 Positive Positive "" "" N/A
9 AB12345-BRA-11-id-217 Day 1 Predose 0.00 1.08 1.08 Positive Positive "Positive" "Negative" N/A
10 AB12345-BRA-11-id-217 Day 2 24H 1.00 1.23 1.23 Positive Positive "" "" N/A
# i 258 more rows

Loading