Obtain a sample (a matrix of individuals/samples by genes or, equivalently, a vector of "genotypes") from an oncosimulpop object (i.e., a simulation of multiple individuals) or a single oncosimul object. Sampling schemes include whole tumor and single cell sampling, and sampling at the end of the tumor progression or during the progression of the disease.
sampledGenotypes shows the genotype frequencies from that
sample; Shannon's diversity —entropy— of the genotypes is also
returned. Order effects are ignored.
1 2 3 4 5
An object of class
The output from a call to
"last" means to sample each individual in the very last time period of the simulation. "unif" (or "uniform") means sampling each individual 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. "unif" means that it is almost sure that different individuals will be sampled at different times. "last" does not guarantee that different individuals will be sampled at the same time unit, only that all will be sampled in the last time unit of their simulation.
You can, alternatively, specify the population size at which you
want the sample to be taken. See argument
"singleCell" (or "single") for single cell sampling, where the probability of sampling a cell (a clone) is directly proportional to its population size. "wholeTumor" (or "whole") for whole tumor sampling (i.e., this is similar to a biopsy being the entire tumor).
In whole tumor sampling, whether a gene is detected as mutated depends on thresholdWhole: a gene is considered mutated if it is altered in at least thresholdWhole proportion of the cells in that individual.
An optional vector of gene names so as to label the column names of the output.
An optional vector of total population sizes at
which you want the samples to be taken. If you pass this vector,
This allows you to specify arbitrary sampling schemes with respect to total population size.
The proportion of observations with error (for instance, genotyping error). If larger than 0, this proportion of entries in the sampled matrix will be flipped (i.e., 0s turned to 1s and 1s turned to 0s).
If non-NULL, use only the genes in
samplePop simply repeats the sampling process in each individual of the oncosimulpop object.
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.
A matrix. Each row is a "sample genotype", where 0 denotes no alteration and 1 alteration. When using v.2, columns are named with the gene names.
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
0.4 you will obtain a genotype with A and B mutated.
sampledGenotypes a data frame with two columns: genotypes
and frequencies. This data frame has an additional attribute,
"ShannonI", where Shannon's index of diversity (entropy) is
stored. This is an object of class "sampledGenotypes"
with an S3 print method.
Diaz-Uriarte, R. (2015). Identifying restrictions in the order of accumulation of mutations during tumor progression: effects of passengers, evolutionary models, and sampling http://www.biomedcentral.com/1471-2105/16/41/abstract
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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) (sp1 <- samplePop(p1)) sampledGenotypes(sp1) ## Sample at fixed sizes. Notice the requested size ## for the last population is larger than the any population size ## so we get NAs (sp2 <- samplePop(p1, popSizeSample = c(1e7, 1e6, 4e5, 1e13))) sampledGenotypes(sp2) ## Now single cell sampling r1 <- oncoSimulIndiv(p705) samplePop(r1, typeSample = "single") sampledGenotypes(samplePop(r1, typeSample = "single"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.