Skip to content

Commit 6ad8686

Browse files
author
Ke Yuan
committed
fixing a bug of using true vaf to compute ccf.
1 parent 39fd36b commit 6ad8686

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

vignettes/ccube.Rmd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ First, we generate a toy dataset with 500 mutations
3838
```{r, cache=TRUE}
3939
set.seed(1234)
4040
numSnv <- 500
41-
ccfSet <- c(1, 0.4, 0.6) # true ccf pool
41+
ccfSet <- c(1, 0.7, 0.3) # true ccf pool
4242
ccfTrue <- sample(ccfSet, numSnv, c(0.5,0.2,0.3), replace = T) # simulate true clusters
43-
purity <- 0.9
43+
purity <- 0.8
4444
cnPoolMaj <- c(1,2,3,4) # a pool of possible major copy numbers
4545
cnPoolMin <- c(0,1,2) # a pool of possible minor copy numbers
46-
cnPoolMajFractions <- c(0.50, 0.30, 0.1,0.1) # prevalence of possible major copy numbers
47-
cnPoolMinFractions <- c(1/4, 1/2, 1/4) # prevalence of possible minor copy numbers
46+
cnPoolMajFractions <- c(1/4, 1/4, 1/4, 1/4) # prevalence of possible major copy numbers
47+
cnPoolMinFractions <- c(1/3, 1/3, 1/3) # prevalence of possible minor copy numbers
4848
4949
cnProfile = GenerateCopyNumberProfile(cnPoolMaj, cnPoolMin,
5050
cnPoolMajFractions, cnPoolMinFractions, numSnv)
@@ -55,7 +55,7 @@ head(cnProfile) # column 1: minor copy number, column 2: major copy number, colu
5555

5656
Simulate cancer cell fractions, multiplicity, and reads counts
5757
```{r}
58-
baseDepth = 50
58+
baseDepth = 40
5959
mydata <- data.frame(mutation_id = paste0("ss","_", seq_len(numSnv)) ,
6060
ccf_true = ccfTrue,
6161
minor_cn = cnProfile[,1],
@@ -66,9 +66,9 @@ mydata <- data.frame(mutation_id = paste0("ss","_", seq_len(numSnv)) ,
6666
6767
mydata <- dplyr::mutate(rowwise(mydata),
6868
mult_true = sample(seq(1,if (major_cn ==1) { 1 } else {major_cn}), 1), # simulate multiplicity
69-
vaf = cp2ap(ccf_true, purity, normal_cn, total_cn, total_cn, mult_true), # simulate vaf
69+
vaf_true = cp2ap(ccf_true, purity, normal_cn, total_cn, total_cn, mult_true), # simulate vaf
7070
total_counts = rpois(1, total_cn/2 * baseDepth), # simulate total read counts
71-
var_counts = rbinom(1, total_counts, vaf), # simulate variant read counts
71+
var_counts = rbinom(1, total_counts, vaf_true), # simulate variant read counts
7272
ref_counts = total_counts - var_counts)
7373
7474
head(mydata)
@@ -107,6 +107,7 @@ The `results` list contains four variables:
107107
* `ccube_ccf`: Event CCF, i.e. CCF estimates for individual SNV
108108
* `results`: A list all fitted models. Each element is structured the same as `res`
109109
* `lb`: Best ELBO across fitted models
110+
* `droppedSsm`: Dropped variants (i.e. variants in regions where major copy number is zero)
110111

111112
Finally, we make a default plot of Ccube results
112113
```{r}

0 commit comments

Comments
 (0)