Skip to contents

This method returns the mutations of the sample cells.

Arguments

cell_id

The identifier of the cell whose mutations are aimed (optional).

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.

See also

PhylogeneticForest$$get_sampled_cell_CNAs()

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")
#> 
 [█---------------------------------------] 0% [00m:00s] Loading context index                                                  

 [████████████████████████████████████████] 100% [00m:00s] Context index loaded                                                 

#> 
 [█---------------------------------------] 0% [00m:00s] Loading RS index                                                       

 [█████████████████-----------------------] 40% [00m:01s] Loading RS index                                                      

 [████████████████████████████████--------] 78% [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-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                                                      

 [████████████████████████████████████████] 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 16138762      0   T   G  SNV  SBS1 passenger
#> 2    1119  22 17125263      0   G   T  SNV  SBS1 passenger
#> 3    1119  22 17212996      0   T   C  SNV  SBS1 passenger
#> 4    1119  22 17337169      0   C   T  SNV  SBS1 passenger
#> 5    1119  22 17482307      0   T   G  SNV  SBS2 passenger
#> 6    1119  22 17756454      0   C   A  SNV  SBS2 passenger