
Getting the sampled cells' mutations
Source:R/RcppExports.R
PhylogeneticForest-cash-get_sampled_cell_mutations.Rd
This method returns the mutations of the sample cells.
Value
A data frame reporting cell_id
, chr
, (i.e., the mutation
chromosome), chr_pos
(i.e., position in the chromosome), allele
(in which the mutation occurs), ref
, alt
, type
(i.e., either
"SNV"
or "indel"
), cause
, and class
(i.e., "driver"
,
"passenger"
, "germinal"
or "preneoplastic"
) for each mutation
in the sampled cell genomes.
Details
This method builds a data frame representing all the SNV and the indel mutations in the cells sampled during the simulation and represented by the leaves of the phylogenetic forest. The data frame also reports the allele in which the mutations occur to support double occurrences due to CNAs.
Examples
sim <- TissueSimulation()
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_sample_forest()
m_engine <- MutationEngine(setup_code = "demo")
#>
[█---------------------------------------] 0% [00m:00s] Loading context index
[████████████████████████████████████████] 100% [00m:00s] Context index loaded
#>
[█---------------------------------------] 0% [00m:00s] Loading RS index
[████████████████------------------------] 39% [00m:01s] Loading RS index
[███████████████████████████████---------] 76% [00m:02s] Loading RS index
[████████████████████████████████████████] 100% [00m:02s] RS index loaded
#>
[█---------------------------------------] 0% [00m:00s] Loading germline
[████████████████████████████████████████] 100% [00m:00s] Germline loaded
m_engine$add_mutant("Clone_1", list("+" = c(SNV = 1e-8, indel = 1e-8),
"-" = c(SNV = 3e-8, CNA = 1e-11)),
list(SNV("22", 10510210, "C", allele = 1),
CNA("D", "22", 5010000, 200000,
allele = 1)))
#>
[█---------------------------------------] 0% [00m:00s] Retrieving "Clone_1" SIDs
[████████████████████████████████████████] 100% [00m:00s] "Clone_1"'s SIDs validated
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
[████████████████████████████████████████] 100% [00m:00s] Mutations placed
mutations <- phylo_forest$get_sampled_cell_mutations()
head(mutations)
#> cell_id chr chr_pos allele ref alt type cause class
#> 1 1119 22 17195209 0 GACTC G indel ID1 passenger
#> 2 1119 22 17369333 0 C T SNV SBS2 passenger
#> 3 1119 22 21076747 0 T C SNV SBS2 passenger
#> 4 1119 22 21674289 0 C T SNV SBS1 passenger
#> 5 1119 22 22100524 0 GACT G indel ID1 passenger
#> 6 1119 22 22112463 0 GCGTA G indel ID1 passenger