`R/castle_integrated.R`

`test_tumor_sample_integrated.Rd`

Tests samples for the presence of mutant DNA using the integrated version of the CASTLE algorithm.

```
test_tumor_sample_integrated(
test_samples,
integrated_model,
alpha = 0.01,
include_mutant_CI = TRUE,
include_wildtype_CI = TRUE
)
```

- test_samples
`data.frame`

with samples to be tested as rows. At least the following columns should be present:`WildtypeOnlyDroplets`

`MutantOnlyDroplets`

`DoubleNegativeDroplets`

`DoublePositiveDroplets`

If data from QuataSoft is available, these can be imported using

`import_QS_files`

.- integrated_model
A fitted model as generated by

`train_integrated_ddpcr_model`

.- alpha
The alpha used for the statistical test and confidence intervals. Default is 0.01.

- include_mutant_CI
Logical. Should confidence intervals for mutant DNA statistics be included? Default is

`TRUE`

.- include_wildtype_CI
Logical. Should confidence intervals for wild type DNA statistics be included? Default is

`TRUE`

.

A `data.frame`

with results from the CASTLE algorithm (parameter
estimates, CIs, p-values etc.) joined to the right of `test_samples`

.
Following is the full list of information added:

`test_statistic`

/`p_val`

Log-likelihood-ratio test statistic/p-value from the statistical test for the presence of mutant DNA (H0: No mutant DNA, HA: Mutant DNA present).

`mutation_detected`

Logical. TRUE if the mutation is detected i.e. if the p-value <

`alpha`

.`allele_frequency`

Estimated allele frequency of the mutant allele (error corrected).

`allele_frequency_CI_[lower|upper]`

Confidence interval for

`allele_frequency`

.`mutant_molecules_per_droplet`

Estimated number of mutant molecules per droplet (error corrected).

`mutant_molecules_per_droplet_CI_[lower|upper]`

Confidence interval for

`mutant_molecules_per_droplet`

.`wildtype_molecules_per_droplet`

Estimated number of wildtype molecules per droplet.

`wildtype_molecules_per_droplet_CI_[lower|upper]`

Confidence interval for

`wildtype_molecules_per_droplet`

.`total_mutant_molecules`

Estimated total number of mutant molecules in sample (error corrected).

`total_mutant_molecules_CI_[lower|upper]`

Confidence interval for

`total_mutant_molecules`

.`total_wildtype_molecules`

Estimated number of wildtype molecules per droplet.