Convert columns in curve_summary
to
trelliscopejs
cognostics for the Trelliscope
display
Usage
convert_to_cog(
curve_summary,
dilution_summary = lifecycle::deprecated(),
cog_df = NULL,
grouping_variable = c("Curve_Name", "Curve_Batch_Name"),
panel_variable = NULL,
col_name_vec = "col_name_vec",
desc_vec = "desc_vec",
type_vec = "type_vec"
)
Arguments
- curve_summary
The summary data frame or tibble generated by function
summarise_curve_table()
and/orevaluate_linearity()
.- dilution_summary
- cog_df
A data frame or tibble that contains cognostics information If no input is given the cognostics information generated by function
create_default_cog_df()
will be used. Default: NULL- grouping_variable
A character vector of column names in
curve_summary
to indicate how each curve should be grouped by. It is also going to be used as a conditional cognostics in thetrelliscopejs
report. Default: c("Curve_Name", "Curve_Batch_Name")- panel_variable
A column name in
curve_summary
to be converted into a panel for theTrelliscope
display. Default: NULL- col_name_vec
Column name in
cog_df
to indicate the columns incurve_summary
that needs to be converted to a cognostics. Default: 'col_name_vec'- desc_vec
Column name in
cog_df
to indicate the description for each cognostics as define intrelliscopejs::cog
. Default: 'desc_vec'- type_vec
Column name in
cog_df
to indicate the type of each cognostics as define intrelliscopejs::cog
. Default: 'type_vec'
Value
The curve summary table with grouping variable
columns
converted to conditional cognostics.
other columns in curve_summary
converted to cognostics
to be used in the in the trelliscopejs
report.
Examples
# Data Creation
concentration <- c(
10, 20, 25, 40, 50, 60,
75, 80, 100, 125, 150,
10, 25, 40, 50, 60,
75, 80, 100, 125, 150
)
curve_batch_name <- c(
"B1", "B1", "B1", "B1", "B1",
"B1", "B1", "B1", "B1", "B1", "B1",
"B2", "B2", "B2", "B2", "B2",
"B2", "B2", "B2", "B2", "B2"
)
sample_name <- c(
"Sample_010a", "Sample_020a",
"Sample_025a", "Sample_040a", "Sample_050a",
"Sample_060a", "Sample_075a", "Sample_080a",
"Sample_100a", "Sample_125a", "Sample_150a",
"Sample_010b", "Sample_025b",
"Sample_040b", "Sample_050b", "Sample_060b",
"Sample_075b", "Sample_080b", "Sample_100b",
"Sample_125b", "Sample_150b"
)
curve_1_saturation_regime <- c(
5748124, 16616414, 21702718, 36191617,
49324541, 55618266, 66947588, 74964771,
75438063, 91770737, 94692060,
5192648, 16594991, 32507833, 46499896,
55388856, 62505210, 62778078, 72158161,
78044338, 86158414
)
curve_2_good_linearity <- c(
31538, 53709, 69990, 101977, 146436, 180960,
232881, 283780, 298289, 344519, 430432,
25463, 63387, 90624, 131274, 138069,
205353, 202407, 260205, 292257, 367924
)
curve_3_noise_regime <- c(
544, 397, 829, 1437, 1808, 2231,
3343, 2915, 5268, 8031, 11045,
500, 903, 1267, 2031, 2100,
3563, 4500, 5300, 8500, 10430
)
curve_4_poor_linearity <- c(
380519, 485372, 478770, 474467, 531640, 576301,
501068, 550201, 515110, 499543, 474745,
197417, 322846, 478398, 423174, 418577,
426089, 413292, 450190, 415309, 457618
)
curve_batch_annot <- tibble::tibble(
Sample_Name = sample_name,
Curve_Batch_Name = curve_batch_name,
Concentration = concentration
)
curve_data <- tibble::tibble(
Sample_Name = sample_name,
`Curve_1` = curve_1_saturation_regime,
`Curve_2` = curve_2_good_linearity,
`Curve_3` = curve_3_noise_regime,
`Curve_4` = curve_4_poor_linearity
)
# Create curve table
curve_table <- create_curve_table(
curve_batch_annot = curve_batch_annot,
curve_data_wide = curve_data,
common_column = "Sample_Name",
signal_var = "Signal",
column_group = "Curve_Name"
)
# Create curve statistical summary
curve_summary <- curve_table |>
summarise_curve_table(
grouping_variable = c(
"Curve_Name",
"Curve_Batch_Name"
),
conc_var = "Concentration",
signal_var = "Signal"
) |>
dplyr::arrange(.data[["Curve_Name"]]) |>
evaluate_linearity(grouping_variable = c(
"Curve_Name",
"Curve_Batch_Name"
))
updated_summary <- convert_to_cog(
curve_summary,
grouping_variable = c("Curve_Name",
"Curve_Batch_Name")
)
# Observe that the columns has been converted
# to class cognostics
curve_summary
#> # A tibble: 8 × 11
#> Curve_Name Curve_Bat…¹ wf1_g…² wf2_g…³ r_corr pra_l…⁴ mande…⁵ concav…⁶ r2_li…⁷
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Curve_1 B1 Poor L… Satura… 0.963 70.5 2.97e-5 -4.17e+3 0.928
#> 2 Curve_1 B2 Poor L… Satura… 0.950 62.3 1.66e-4 -4.14e+3 0.903
#> 3 Curve_2 B1 Good L… Good L… 0.990 92.8 1.50e-1 -4.91e+0 0.980
#> 4 Curve_2 B2 Good L… Good L… 0.995 94.3 3.82e-1 -1.94e+0 0.990
#> 5 Curve_3 B1 Poor L… Noise … 0.964 71.2 6.78e-6 4.68e-1 0.930
#> 6 Curve_3 B2 Poor L… Noise … 0.978 74.7 2.56e-3 3.21e-1 0.956
#> 7 Curve_4 B1 Poor L… Poor L… 0.311 -251. 6.60e-3 -2.05e+1 0.0970
#> 8 Curve_4 B2 Poor L… Poor L… 0.608 -73.1 5.33e-2 -2.29e+1 0.370
#> # … with 2 more variables: r2_adj_linear <dbl>, mandel_stats <dbl>, and
#> # abbreviated variable names ¹Curve_Batch_Name, ²wf1_group, ³wf2_group,
#> # ⁴pra_linear, ⁵mandel_p_val, ⁶concavity, ⁷r2_linear
updated_summary
#> # A tibble: 8 × 11
#> Curve…¹ Curve…² wf1_g…³ wf2_g…⁴ r_corr pra_linear mandel_p_val concavity
#> <cog> <cog> <cog> <cog> <cog> <cog> <cog> <cog>
#> 1 Curve_1 B1 Poor L… Satura… 0.963362 70.49412 2.968599e-05 -4174.1333061
#> 2 Curve_1 B2 Poor L… Satura… 0.950007 62.30351 1.662149e-04 -4136.5254757
#> 3 Curve_2 B1 Good L… Good L… 0.989903 92.75456 1.501138e-01 -4.9071785
#> 4 Curve_2 B2 Good L… Good L… 0.994815 94.32046 3.824145e-01 -1.9381407
#> 5 Curve_3 B1 Poor L… Noise … 0.964252 71.18372 6.775079e-06 0.4677827
#> 6 Curve_3 B2 Poor L… Noise … 0.977958 74.69452 2.563269e-03 0.3206020
#> 7 Curve_4 B1 Poor L… Poor L… 0.311458 -251.44937 6.599208e-03 -20.5225862
#> 8 Curve_4 B2 Poor L… Poor L… 0.608365 -73.12451 5.331838e-02 -22.8704194
#> # … with 3 more variables: r2_linear <cog>, r2_adj_linear <cog>,
#> # mandel_stats <cog>, and abbreviated variable names ¹Curve_Name,
#> # ²Curve_Batch_Name, ³wf1_group, ⁴wf2_group