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 dataframe 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 dataframe 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 dataframe also reports the allele in which the mutations occur to support double occurrencies 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                                         

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

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

 [██████████████████████████████████████--] 94% [00m:01s] Placing mutations                                       

 [████████████████████████████████████████] 100% [00m:01s] Mutations placed                                       


mutations <- phylo_forest$get_sampled_cell_mutations()

head(mutations)
#>   cell_id chr  chr_pos allele ref alt type cause     class
#> 1     583  22 16557388      0   G   A  SNV  SBS2 passenger
#> 2     583  22 16959608      0   C   T  SNV  SBS2 passenger
#> 3     583  22 17379701      0   G   A  SNV  SBS2 passenger
#> 4     583  22 17430226      0   G   A  SNV  SBS2 passenger
#> 5     583  22 17557381      0   G   A  SNV  SBS1 passenger
#> 6     583  22 18308060      0   G   A  SNV  SBS1 passenger