samplePop(x, timeSample = "last", typeSample = "whole",
thresholdWhole = 0.5, geneNames = NULL)
oncosimulpop
. We quote "sample genotype" because when not using single cell, a row
(a sample genotype) need not be, of course, any really existing
genotype in a population as we are genotyping a whole tumor. Suppose
there are really two genotypes present in the population, genotype A,
which has gene A mutated and genotype B, which has gene B
mutated. Genotype A has a frequency of 60% (so B's frequency is
40%). If you use whole tumor sampling with thresholdWhole =
0.4
you will obtain a genotype with A and B mutated.
Please see oncoSimulSample
for a much more efficient way
of sampling when you are sure what you want to sample.
Note that if you have set onlyCancer = FALSE
in the call to
oncoSimulSample
, you can end up trying to sample from
simulations where the population size is 0. In this case, you will get
a vector/matrix of NAs and a warning.
Similarly, when using timeSample = "last"
you might end up with
a vector of 0 (not NAs) because you are sampling from a population
that contains no clones with mutated genes. This event (sampling from
a population that contains no clones with mutated genes), by
construction, cannot happen when timeSample = "unif"
as
"uniform" sampling is taken here to mean sampling at a time choosen
uniformly from all the times recorded in the simulation between the
time when the first driver appeared and the final time
period. However, you might still get a vector of 0, with uniform
sampling, if you sample from a population that contains only a few
cells with any mutated genes, and most cells with no mutated genes.
oncoSimulPop
, oncoSimulSample
data(examplePosets)
p705 <- examplePosets[["p705"]]
## (I set mc.cores = 2 to comply with --as-cran checks, but you
## should either use a reasonable number for your hardware or
## leave it at its default value).
p1 <- oncoSimulPop(4, p705, mc.cores = 2)
samplePop(p1)
## Now single cell sampling
r1 <- oncoSimulIndiv(p705)
samplePop(r1, typeSample = "single")
Run the code above in your browser using DataLab