
Getting the sampled cells' CNAs
Source:R/RcppExports.R
PhylogeneticForest-cash-get_sampled_cell_CNAs.RdThis method returns the CNAs of the sample cells.
Value
A data frame 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 data frame representing all the CNAs in the cells sampled during the simulation and represented by the leaves of the phylogenetic forest.
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)
#>
[█---------------------------------------] 0% [00m:00s] Saving snapshot
[█---------------------------------------] 0% [00m:00s] Cells: 0
[█---------------------------------------] 0% [00m:00s] Cells: 0
[█---------------------------------------] 0% [00m:00s] Cells: 0
sim$sample_cells("Sample_A", c(475, 475), c(525, 525))
sample_forest <- sim$get_sample_forest()
m_engine <- MutationEngine(setup_code = "demo")
#> Downloading reference genome...
#> Reference genome downloaded
#> Decompressing reference genome...done
#> Downloading signature files...
#> Signature file downloaded
#> Downloading driver mutation file...
#> Driver mutation file downloaded
#> Decompressing driver mutation file...done
#> Downloading passenger CNAs file...
#> Passenger CNAs file downloaded
#> Decompressing passenger CNAs file...done
#> Downloading germline...
#> Germline downloaded
#> Decompressing mutations...
#> done
#> Building context index...
#>
[█---------------------------------------] 0% [00m:00s] Processing chr. 22
[█████████████████-----------------------] 40% [00m:01s] Processing chr. 22
[█████████████████████████████████-------] 81% [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] Reading 22
[█---------------------------------------] 0% [00m:01s] Reading 22
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] Reading 22
#>
[████████████████████████████████████████] 100% [00m:02s] RS index built
#>
[█---------------------------------------] 0% [00m:00s] Saving RS index
[█---------------------------------------] 0% [00m:00s] Saving RS index
[███████████████████████████-------------] 66% [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" SIDs
[█---------------------------------------] 0% [00m:00s] Found 22
[█---------------------------------------] 0% [00m:00s] Reading 22
[████████--------------------------------] 18% [00m:01s] Reading 22
[███████████████-------------------------] 36% [00m:02s] Reading 22
[███████████████████████-----------------] 55% [00m:03s] Reading 22
[██████████████████████████████----------] 74% [00m:04s] Reading 22
[█████████████████████████████████████---] 91% [00m:05s] Reading 22
[████████████████████████████████████████] 100% [00m:05s] "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
[█---------------------------------------] 0% [00m:00s] Mutations placed
[█---------------------------------------] 0% [00m:00s] Mutations placed
[█---------------------------------------] 0% [00m:00s] Mutations placed
mutations <- phylo_forest$get_sampled_cell_CNAs()
head(mutations)
#> [1] cell_id type chr begin end allele src.allele
#> [8] class
#> <0 rows> (or 0-length row.names)