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.

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                          

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

 [███████████████████████-----------------] 57% [00m:02s] Loading RS index                         

 [███████████████████████████████████-----] 85% [00m:03s] Loading RS index                         

 [████████████████████████████████████████] 100% [00m:03s] 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     530  22 16317996      0   C   CT indel   ID1 passenger
#> 2     530  22 18715652      0 GAT    G indel   ID1 passenger
#> 3     530  22 21538459      0   G    T   SNV  SBS2 passenger
#> 4     530  22 22887135      0   A ATCC indel   ID1 passenger
#> 5     530  22 23106566      0   C   CT indel   ID1 passenger
#> 6     530  22 23212798      0   G    C   SNV  SBS1 passenger