Getting the sampled cells CNAs
Source:R/RcppExports.R
PhylogeneticForest-cash-get_sampled_cell_CNAs.Rd
This method returns the CNAs of the sample cells.
Value
A dataframe reporting cell_id
, type
("A"
for amplifications
and "D"
for deletions), chr
, begin
(i.e., the first CNA
locus in the chromosome), end
(i.e., last CNA locus in the chromosome),
allele
, src allele
(the allele origin for amplifications, NA
for
deletions), and class
(i.e., "driver"
, "passenger"
, "germinal"
or "preneoplastic"
).
Details
This method builds a dataframe representing all the CNAs in the cells sampled during the simulation and represented by the leaves of the phylogenetic forest.
Examples
sim <- SpatialSimulation()
sim$add_mutant(name = "Clone_1",
epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
growth_rates = c("+" = 0.2, "-" = 0.08),
death_rates = c("+" = 0.05, "-" = 0.01))
sim$place_cell("Clone_1+", 500, 500)
sim$run_up_to_size("Clone_1-", 1000)
#>
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
sim$sample_cells("Sample_A", c(475, 475), c(525, 525))
sample_forest <- sim$get_samples_forest()
m_engine <- MutationEngine(setup_code = "demo")
#> Downloading reference genome...
#> Reference genome downloaded
#> Decompressing reference file...done
#> Downloading SBS file...
#> SBS file downloaded
#> Downloading indel file...
#> indel file downloaded
#> Downloading driver mutation file...
#> Driver mutation file downloaded
#> Downloading passenger CNAs file...
#> Passenger CNAs file downloaded
#> Downloading germline mutations...
#> Germline mutations downloaded
#> Building context index...
#>
[█---------------------------------------] 0% [00m:00s] Processing chr. 22
[█████████████████-----------------------] 40% [00m:01s] Processing chr. 22
[██████████████████████████████----------] 73% [00m:02s] Processing chr. 22
[████████████████████████████████████████] 100% [00m:02s] Context index built
#>
[█---------------------------------------] 0% [00m:00s] Saving context index
[████████████████████████████████████████] 100% [00m:00s] Context index saved
#> done
#> Building repeated sequence index...
#>
[█---------------------------------------] 0% [00m:00s] Processing chr. 22
[█---------------------------------------] 0% [00m:00s] Processing chr. 22
[█---------------------------------------] 0% [00m:03s] Processing chr. 22
[█---------------------------------------] 0% [00m:04s] Processing chr. 22
[█---------------------------------------] 0% [00m:06s] Processing chr. 22
[█---------------------------------------] 0% [00m:07s] Processing chr. 22
[█---------------------------------------] 0% [00m:09s] Processing chr. 22
[█---------------------------------------] 0% [00m:12s] Processing chr. 22
[████████████████████████████████████████] 100% [00m:12s] RS index built
#>
[█---------------------------------------] 0% [00m:00s] Saving RS index
[█---------------------------------------] 0% [00m:01s] Saving RS index
[███████████████████████████-------------] 65% [00m:02s] Saving RS index
done
#>
[████████████████████████████████████████] 100% [00m:02s] RS index saved
#>
[█---------------------------------------] 0% [00m:00s] Loading germline
[████████████████████████████████████████] 100% [00m:00s] Germline loaded
#>
[█---------------------------------------] 0% [00m:00s] Saving germline
[████████████████████████████████████████] 100% [00m:00s] Germline saved
m_engine$add_mutant("Clone_1", list("+" = c(SNV = 1e-7, indel = 1e-8),
"-" = c(SNV = 3e-7, CNA = 1e-11)),
list(SNV("22", 10510210, "C", allele = 1),
CNA("D", "22", 5010000, 200000,
allele = 1)))
#>
[█---------------------------------------] 0% [00m:00s] Retrieving "Clone_1" SNVs
[█---------------------------------------] 0% [00m:00s] Found 22
[█---------------------------------------] 0% [00m:00s] Reading 22
[█---------------------------------------] 0% [00m:01s] Reading 22
[████████████████████████████████████████] 100% [00m:01s] "Clone_1" SNVs retrieved
m_engine$add_exposure(c(ID1 = 1, SBS1 = 0.5, SBS2 = 0.5))
phylo_forest <- m_engine$place_mutations(sample_forest, 1, 1)
#>
[█---------------------------------------] 0% [00m:00s] Placing mutations
[████████████████████████████████████████] 98% [00m:01s] Placing mutations
[████████████████████████████████████████] 100% [00m:01s] Mutations placed
mutations <- phylo_forest$get_sampled_cell_CNAs()
head(mutations)
#> cell_id type chr begin end allele src.allele class
#> 1 546 D 22 5010000 5209999 1 NA driver
#> 2 1285 D 22 5010000 5209999 1 NA driver
#> 3 1475 D 22 5010000 5209999 1 NA driver
#> 4 1775 D 22 5010000 5209999 1 NA driver
#> 5 1885 D 22 5010000 5209999 1 NA driver
#> 6 2131 D 22 5010000 5209999 1 NA driver