Description Usage Arguments Author(s) See Also Examples
Plots data generated from the simulations, either for a single individual or for a population of individuals, with time units in the x axis and nubmer of cells in the y axis.
In "drivers" plots, by default, all clones with the same number of drivers are plotted using the same colour (but different line types), and clones with different number of drivers are plotted in different colours. Plots can alternatively display genotypes instead of drivers.
Plots available are line plots, stacked area, and stream plots.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ## S3 method for class 'oncosimul'
plot(x,
show = "drivers",
type = ifelse(show == "genotypes",
"stacked", "line"),
col = "auto",
log = ifelse(type == "line", "y", ""),
ltyClone = 2:6,
lwdClone = 0.9,
ltyDrivers = 1,
lwdDrivers = 3,
xlab = "Time units",
ylab = "Number of cells",
plotClones = TRUE,
plotDrivers = TRUE,
addtot = FALSE,
addtotlwd = 0.5,
ylim = NULL,
xlim = NULL,
thinData = FALSE,
thinData.keep = 0.1,
thinData.min = 2,
plotDiversity = FALSE,
order.method = "as.is",
stream.center = TRUE,
stream.frac.rand = 0.01,
stream.spar = 0.2,
border = NULL,
lwdStackedStream = 1,
srange = c(0.4, 1),
vrange = c(0.8, 1),
breakSortColors = "oe",
legend.ncols = "auto", ...)
## S3 method for class 'oncosimulpop'
plot(x,
ask = TRUE,
show = "drivers",
type = ifelse(show == "genotypes",
"stacked", "line"),
col = "auto",
log = ifelse(type == "line", "y", ""),
ltyClone = 2:6,
lwdClone = 0.9,
ltyDrivers = 1,
lwdDrivers = 3,
xlab = "Time units",
ylab = "Number of cells",
plotClones = TRUE,
plotDrivers = TRUE,
addtot = FALSE,
addtotlwd = 0.5,
ylim = NULL,
xlim = NULL,
thinData = FALSE,
thinData.keep = 0.1,
thinData.min = 2,
plotDiversity = FALSE,
order.method = "as.is",
stream.center = TRUE,
stream.frac.rand = 0.01,
stream.spar = 0.2,
border = NULL,
lwdStackedStream = 1,
srange = c(0.4, 1),
vrange = c(0.8, 1),
breakSortColors = "oe",
legend.ncols = "auto",
...)
|
x |
An object of class |
ask |
Same meaning as in |
show |
One of "drivers" or "genotypes". If "drivers" the legend will reflect the number of drivers. If "genotypes" you will be shown genotypes. You probably want to limit "genotypes" to those cases where only a relatively small number of genotypes exist (or the plot will be an unmanageable mess). The default is "drivers". |
type |
One of "line", "stacked", "stream". If "line", you are shown lines for each genotype or clone. This
means that to get an idea of the total population size you need to
use If "stacked" a stacked area plot. If "stream" a stream plot. Since
these stack areas, you immediately get the total population. But that
also means you cannot use The default is to use "line" for |
col |
Colour of the lines/areas. For The default is "auto". If you have You can specify your own vector of colors, but it will be ignored
with |
log |
See
|
ltyClone |
Line type for each clone. Recycled as needed. You probably do not
want to use lty=1 for any clone, to differentiate from the clone
type, unless you change the setting for |
lwdClone |
Line width for clones. |
ltyDrivers |
Line type for the driver type. |
lwdDrivers |
Line width for the driver type. |
xlab |
Same as |
ylab |
Same as |
plotClones |
Should clones be plotted? |
plotDrivers |
Should clone types (which are defined by number of drivers), be
plotted? (Only applies when using |
addtot |
If TRUE, add a line with the total populatino size. |
addtotlwd |
Line width for total population size. |
ylim |
If non NULL, limits of the y axis. Same as in
|
xlim |
If non NULL, limits of the x axis. Same as in
|
thinData |
If TRUE, the data plotted is a subset of the original data. The original data are "thinned" in such a way that the origin of each clone is not among the non-shown data (i.e., so that we can see when each clone/driver originates). Thinning is done to reduce the plot size and to speed up plotting. Note that thinning is carried out before dealing with the plot axis, so the actual number of points to be plotted could be a lot less (if you reduce the x-axis considerably) than those returned from the thinning. (In extreme cases this could lead to crashes when trying to use stream plots if, say, you end up plotting only three values). |
thinData.keep |
The fraction of the data to keep (actually, a lower bound on the fraction of data to keep). |
thinData.min |
Any time point for which a clone has a population size > thinData.min will be kept (i.e., will not be removed from) in the data. |
plotDiversity |
If TRUE, we also show, on top of the main figure, Shannon's diversity index (and we consider as distinct those genotypes with different order of mutations when order matters). If you set this to true, using |
order.method |
For stacked and stream plots. |
stream.center |
For stream plots. If TRUE, the stacked polygons will be centered so that the middle, i.e. baseline ("g0"), of the stream is approximately equal to zero. Centering is done before the addition of random wiggle to the baseline. |
stream.frac.rand |
For stream plots. Fraction of the overall data "stream" range used to define the range of random wiggle (uniform distribution) to be added to the baseline 'g0'. |
stream.spar |
Setting for smooth.spline function to make a smoothed version of baseline "g0". |
border |
For stacked and stream plots. Border colors for polygons
corresponding to y columns (will recycle) (see |
lwdStackedStream |
border line width for polygons corresponding to y columns (will recycle). |
srange |
Range of values of s in the HSV specification of colors
(see |
vrange |
Range of values of v in the HSV specification of colors
(see |
breakSortColors |
How to try to minimize that similar colors be
used for contiguous or nearby driver categories. The default is "oe"
which resorts them in alternating way. The other two options are
"distave", where we alternate after folding from the mean and "random"
where the colors are randomly sorted. Only applies when using
"stacked" or "stream" plots and |
legend.ncols |
The number of columns of the legend. If
|
... |
Other arguments passed to |
Ramon Diaz-Uriarte. Marc Taylor for stacked and stream plots.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | data(examplePosets)
p701 <- examplePosets[["p701"]]
## Simulate and plot a single individual, including showing
## Shannon's diversity index
b1 <- oncoSimulIndiv(p701)
plot(b1, addtot = TRUE, plotDiversity = TRUE)
## A stacked area plot
plot(b1, type = "stacked", plotDiversity = TRUE)
## And what if I show a stream plot?
plot(b1, type = "stream", plotDiversity = TRUE)
## Simulate and plot 2 individuals
## (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(2, p701, mc.cores = 2)
par(mfrow = c(1, 2))
plot(p1, ask = FALSE)
## Stacked; we cannot log here, and harder to see patterns
plot(p1, ask = FALSE, type = "stacked")
## Show individual genotypes and drivers for an
## epistasis case with at most eight genotypes
sa <- 0.1
sb <- -0.2
sab <- 0.25
sac <- -0.1
sbc <- 0.25
sv2 <- allFitnessEffects(epistasis = c("-A : B" = sb,
"A : -B" = sa,
"A : C" = sac,
"A:B" = sab,
"-A:B:C" = sbc),
geneToModule = c(
"Root" = "Root",
"A" = "a1, a2",
"B" = "b",
"C" = "c"))
evalAllGenotypes(sv2, order = FALSE, addwt = TRUE)
e1 <- oncoSimulIndiv(sv2, model = "McFL",
mu = 5e-6,
sampleEvery = 0.02,
keepEvery = 1,
initSize = 2000,
finalTime = 3000,
onlyCancer = FALSE)
## Drivers and clones
plot(e1, show = "drivers")
## Make genotypes explicit
plot(e1, show = "genotypes")
## Oh, but I want other colors
plot(e1, show = "genotypes", col = rainbow(8))
## and actually I want a line plot
plot(e1, show = "genotypes", type = "line")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.